diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..d293f33 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,38 @@ +name: CI + +on: [push, pull_request] + +jobs: + build: + runs-on: ${{matrix.os}} + strategy: + matrix: + os: ["ubuntu-20.04"] + + steps: + - uses: actions/checkout@v2 + - uses: olafurpg/setup-scala@v10 + with: + java-version: 8 + - name: Mount caches + uses: actions/cache@v2 + with: + path: | + ~/.sbt + ~/.ivy2/cache + ~/.cache/coursier + key: ${{ runner.os }}-sbt-${{ hashFiles('**/*.sbt') }} + - name: Compile and test + run: | + sbt test + shell: bash + - name: Format check + if: ${{ runner.os == 'Linux' }} + run: | + sbt scalafmtCheck test:scalafmtCheck scalafmtSbtCheck + # Single final job for mergify. + ci-passed: + runs-on: ubuntu-latest + needs: build + steps: + - run: ':' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..983e8de --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,41 @@ +name: Release + +on: + push: + branches: [master] + tags: ["v*"] + +jobs: + publish: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v1 + - name: Scala caches + uses: actions/cache@v2 + with: + path: | + ~/.sbt + ~/.ivy2/cache + ~/.cache/coursier + key: ${{ runner.os }}-sbt-docs-${{ hashFiles('**/*.sbt') }} + - uses: actions/setup-java@v1 + with: + java-version: 8 + - uses: olafurpg/setup-gpg@v3 + if: startsWith(github.ref, 'refs/tags/v') + - name: "Publish release: ${{github.ref}}" + if: startsWith(github.ref, 'refs/tags/v') + run: PUBLISH_ONLY=${GITHUB_REF%%/*} RELEASE=1 sbt ci-release + env: + PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} + PGP_SECRET: ${{ secrets.PGP_SECRET }} + SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} + SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} + - name: "Publish snapshot: ${{github.ref}}" + if: "!startsWith(github.ref, 'refs/tags/v')" + run: sbt ci-release + env: + PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} + PGP_SECRET: ${{ secrets.PGP_SECRET }} + SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} + SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 0451053..0000000 --- a/.travis.yml +++ /dev/null @@ -1,18 +0,0 @@ -language: scala -jdk: -- openjdk8 - -before_install: - - git fetch --tags - -stages: - - name: test - - name: release - if: ((branch = master AND type = push) OR (tag IS present)) AND NOT fork - -jobs: - include: - - name: compile and format - script: sbt compile scalafmtCheck scalafmtSbtCheck - - stage: release - script: ./release.sh diff --git a/release.sh b/release.sh deleted file mode 100755 index cdaa3f0..0000000 --- a/release.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash -set -e -if [ -z "${TRAVIS_TAG}" ]; then - echo "Travis tag is unset - will do a snapshot"; - sbt ci-release -else - echo "Travis tag is set to ${TRAVIS_TAG}. Making a release"; - PUBLISH_ONLY=${TRAVIS_TAG%%/*} RELEASE=1 sbt ci-release; -fi