Merge pull request #690 from scala-steward/update/sbt-scalafmt-2.5.2 #840
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
pull_request: | |
branches: ["main", "series/*"] | |
push: | |
branches: ["main", "series/*"] | |
tags: ["v*"] | |
concurrency: | |
group: ci-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
name: Test ${{matrix.scalaVersion}} (${{matrix.scalaPlatform}}) | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest] | |
java: [8] | |
scalaVersion: ["2_12", "2_13", "3"] | |
scalaPlatform: ["jvm", "js", "native"] | |
runs-on: ${{ matrix.os }} | |
env: | |
BUILD_KEY: ${{matrix.scalaVersion}}_${{matrix.scalaPlatform}} | |
steps: | |
- name: Checkout current branch | |
uses: actions/checkout@v2 | |
- name: Cache | |
uses: coursier/cache-action@v6 | |
with: | |
extraKey: ${{ env.BUILD_KEY }} | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: ${{ matrix.java }} | |
cache: 'sbt' | |
- name: Run tests | |
run: | | |
sbt test_$BUILD_KEY \ | |
pushRemoteCache_$BUILD_KEY | |
- name: Run checks | |
if: matrix.scalaVersion == '2_13' && matrix.scalaPlatform == 'jvm' | |
run: | | |
sbt scalafix_$BUILD_KEY \ | |
scalafixTests_$BUILD_KEY \ | |
scalafmt_$BUILD_KEY \ | |
"docs/mdoc --in $PWD/README.md" | |
- name: Upload compilation cache | |
uses: actions/upload-artifact@v2 | |
with: | |
name: compilation-${{env.BUILD_KEY}}.zip | |
path: /tmp/remote-cache | |
# This is dummy stage to configure github checks in a way | |
# that is agnostic to the build matrix | |
build-success-checkpoint: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Build matrix completed | |
run: echo "Build result is a ${{ needs.build.result }}" | |
documentation: | |
name: Documentation | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout current branch | |
uses: actions/checkout@v3 | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: '8' | |
cache: 'sbt' | |
- name: Run mdoc | |
run: sbt "docs/mdoc" | |
publish: | |
name: Publish | |
needs: [documentation, build] | |
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || (github.ref == 'refs/heads/main')) | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout current branch (full) | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: '8' | |
cache: 'sbt' | |
- name: Download compilation cache | |
uses: actions/download-artifact@v2 | |
with: | |
path: /tmp/remote-cache | |
- name: Unpack compilation cache | |
run: cd /tmp/remote-cache && (ls | xargs -I {} sh -c 'cp -r {}/* .') | |
- name: Publish ${{ github.ref }} | |
run: | | |
sbt 'pullRemoteCache; ci-release' | |
env: | |
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} | |
PGP_SECRET: ${{ secrets.PGP_SECRET }} | |
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} | |
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} | |
site: | |
name: Publish Site | |
needs: [publish] | |
if: startsWith(github.ref, 'refs/tags/v') | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout current branch (full) | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
lfs: true | |
- uses: laughedelic/coursier-setup@v1 | |
with: | |
jvm: adopt:8 | |
apps: ammonite sbt | |
- name: Cache | |
uses: coursier/cache-action@v3 | |
- name: Release site | |
run: | | |
mkdir -p $HOME/.ssh | |
ssh-keyscan -t rsa github.com >> $HOME/.ssh/known_hosts | |
sbt docs/docusaurusCreateSite | |
amm scripts/releaseSite.sc | |
env: | |
GITHUB_DEPLOY_KEY: ${{ secrets.GIT_DEPLOY_KEY }} |