Update sbt-ci-release to 1.9.2 #795
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: | |
push: | |
branches: | |
- '*' | |
tags: | |
- 'v*' | |
pull_request: | |
branches: | |
- main | |
jobs: | |
test: | |
runs-on: blacksmith-2vcpu-ubuntu-2204 | |
env: | |
ENABLE_ASSERTIONS: 1 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- name: Coursier cache | |
uses: useblacksmith/coursier-cache-action@v6 | |
- uses: coursier/setup-action@v1 | |
with: | |
jvm: zulu:11.0.10 | |
apps: sbt scala | |
- name: dynver check | |
run: sbt dynverAssertVersion | |
- name: Scalafmt | |
run: sbt scalafmtCheck test:scalafmtCheck | |
- name: Test | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: sbt coverage test coverageReport | |
- name: Upload coverage | |
uses: codecov/codecov-action@v5 | |
if: ${{ github.actor != 'dependabot[bot]' }} | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
fail_ci_if_error: true | |
- name: Clean up | |
run: | | |
rm -rf "$HOME/.ivy2/local" || true | |
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 | |
test-schemas: | |
runs-on: blacksmith-2vcpu-ubuntu-2204 | |
env: | |
ENABLE_ASSERTIONS: 1 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- name: Coursier cache | |
uses: useblacksmith/coursier-cache-action@v6 | |
- uses: coursier/setup-action@v1 | |
with: | |
jvm: zulu:11.0.10 | |
apps: sbt scala | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '16' | |
cache: 'yarn' | |
- name: Generate example schemas | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: sbt generateSchemas | |
- name: Install ajv | |
run: | | |
yarn global add ajv-cli ajv-formats | |
yarn global bin >> $GITHUB_PATH | |
- name: Validate generated schema | |
run: | | |
for schema in target/jsonoid-schemas/*.json; do | |
ajv compile --spec=draft2020 -s $schema -c ajv-formats | |
done | |
assemble: | |
needs: [test, test-schemas] | |
runs-on: blacksmith-2vcpu-ubuntu-2204 | |
permissions: | |
id-token: write | |
attestations: write | |
contents: read | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- name: Coursier cache | |
uses: useblacksmith/coursier-cache-action@v6 | |
- uses: taiki-e/install-action@parse-changelog | |
- name: Set build timestamp | |
run: echo "SOURCE_DATE_EPOCH=$(date -d $(parse-changelog CHANGELOG.md -t | rev | cut -d' ' -f1 | rev) '+%s')" >> "$GITHUB_ENV" | |
- uses: coursier/setup-action@v1 | |
with: | |
jvm: zulu:11.0.10 | |
apps: sbt scala | |
- name: Assemble | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: sbt assembly | |
- name: Upload JAR | |
uses: actions/upload-artifact@v4 | |
with: | |
name: jsonoid-discovery.jar | |
if-no-files-found: error | |
path: target/scala-2.13/jsonoid-discovery*.jar | |
- name: Attest build provenance | |
uses: actions/attest-build-provenance@v2 | |
if: ${{ github.event_name != 'pull_request' }} | |
with: | |
subject-path: 'target/scala-2.13/jsonoid-discovery*.jar' |