Skip to content

Instantly share code, notes, and snippets.

@ibacher

ibacher/travis-gh.sh Secret

Created Dec 14, 2020
Embed
What would you like to do?
if [ ! -f ".travis.yml" ]; then
echo "Could not find .travis.yml in $(pwd)"
exit 1
fi
mkdir -p .github/workflows/
cat << EOF >.github/workflows/maven.yml
# this build is designed to replicate the Travis CI workflow
name: Build with Maven
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_dispatch:
jobs:
build:
strategy:
matrix:
platform: [ ubuntu-latest ]
java-version: [ 8 ]
runs-on: \${{ matrix.platform }}
env:
PLATFORM: \${{ matrix.platform }}
JAVA_VERSION: \${{ matrix.java-version }}
steps:
- uses: actions/checkout@v2
- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: \${{ matrix.java-version }}
- name: Cache local Maven repository
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: \${{ runner.os }}-maven-\${{ hashFiles('**/pom.xml') }}
restore-keys: |
\${{ runner.os }}-maven-
- name: Install dependencies
run: mvn clean install -DskipTests=true -Dmaven.javadoc.skip=true --batch-mode --show-version --file pom.xml
- name: Build with Maven
run: mvn test --batch-mode --file pom.xml
EOF
sed -i .tmp 's/\!.travis.yml/\!.github/' .gitignore
[ -f ".gitignore.tmp" ] && rm .gitignore.tmp
rm .travis.yml
git add .
git commit -m "Travis -> GitHub Actions
Feel free to revert, but see https://talk.openmrs.org/t/ci-within-openmrs-bamboo-vs-travis-vs-github-actions-vs-azure-pipelines/31252/6"
smerge .
@kaweesi

This comment has been minimized.

Copy link

@kaweesi kaweesi commented Mar 22, 2021

the build should be able to pickup the existing pom file without pointing it out explicitly

@ibacher

This comment has been minimized.

Copy link
Owner Author

@ibacher ibacher commented Mar 22, 2021

@kaweesi: Yeah, it really should. The Maven commands I used are intentionally quite verbose.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment