From de2cd843c26ca4469e6278727bd3956ff6780956 Mon Sep 17 00:00:00 2001 From: Matthias Kurz Date: Fri, 12 Jan 2024 23:29:07 +0100 Subject: [PATCH] Switch to GitHub actions --- .github/workflows/build-test.yml | 30 ++++++++++++++++++++++ .github/workflows/publish.yml | 44 ++++++++++++++++++++++++++++++++ .travis.yml | 12 --------- 3 files changed, 74 insertions(+), 12 deletions(-) create mode 100644 .github/workflows/build-test.yml create mode 100644 .github/workflows/publish.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml new file mode 100644 index 0000000..6ab438e --- /dev/null +++ b/.github/workflows/build-test.yml @@ -0,0 +1,30 @@ +name: Check + +on: + pull_request: + + push: + branches: + - main # Check branch after merge + +concurrency: + # Only run once for latest commit per ref and cancel other (previous) runs. + group: ci-${{ github.ref }} + cancel-in-progress: true + +jobs: + tests: + name: Tests + uses: playframework/.github/.github/workflows/cmd.yml@v3 + with: + java: 17, 11, 8 + scala: 2.12.18 + cmd: | + sbt ++$MATRIX_SCALA test ^scripted + + finish: + name: Finish + if: github.event_name == 'pull_request' + needs: # Should be last + - "tests" + uses: playframework/.github/.github/workflows/rtm.yml@v3 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..6a6c3ae --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,44 @@ +name: Publish + +on: + push: + branches: # Snapshots + - main + tags: ["**"] # Releases + +jobs: + publish-artifacts: + name: JDK 8 + runs-on: ubuntu-20.04 + if: ${{ github.repository_owner == 'sbt' }} + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + # we don't know what commit the last tag was it's safer to get entire repo so previousStableVersion resolves + fetch-depth: 0 + + - name: Coursier Cache + id: coursier-cache + uses: coursier/cache-action@v6 + + - name: Install Adoptium Temurin OpenJDK + uses: coursier/setup-action@v1 + with: + jvm: adoptium:8 + + - name: Publish artifacts + run: sbt ci-release + env: + SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} + SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} + PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} + PGP_SECRET: ${{ secrets.PGP_SECRET }} + + - name: Cleanup before cache + shell: bash + run: | + find $HOME/Library/Caches/Coursier/v1 -name "ivydata-*.properties" -delete || true + find $HOME/.ivy2/cache -name "ivydata-*.properties" -delete || true + find $HOME/.cache/coursier/v1 -name "ivydata-*.properties" -delete || true + find $HOME/.sbt -name "*.lock" -delete || true diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 7d83433..0000000 --- a/.travis.yml +++ /dev/null @@ -1,12 +0,0 @@ -jdk: openjdk8 -language: scala -sudo: false -script: sbt ^scripted -cache: - directories: - - $HOME/.ivy2/cache -before_cache: - # Ensure changes to the cache aren't persisted - - rm -rf $HOME/.ivy2/cache/scala_*/sbt_*/com.typesafe.sbt/sbt-less - # Delete all ivydata files since ivy touches them on each build - - find $HOME/.ivy2/cache -name "ivydata-*.properties" | xargs rm