Skip to content

CI

CI #4817

Workflow file for this run

name: CI
on:
workflow_dispatch:
inputs:
publishSnapshot:
description: "Publish Snapshot"
required: false
default: false
type: boolean
publishMicrosite:
description: "Publish Microsite"
required: false
default: false
type: boolean
push:
branches: ["main", "series/**", "feature/**"]
tags: ["v*"]
pull_request:
branches: ["**"]
schedule:
# midnight, every Monday and Thursday
- cron: '0 0 * * 1,4'
env:
SBT_OPTS: "-XX:MaxMetaspaceSize=4G -XX:MaxInlineLevel=20 -Xss2m -Xms512M -Xmx6G -XX:ReservedCodeCacheSize=256M"
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
name: Test ${{matrix.scalaVersion}} (${{matrix.scalaPlatform}})
strategy:
fail-fast: true
matrix:
scalaVersion: ["2_12", "2_13", "3_0"]
scalaPlatform: ["jvm", "js"]
exclude:
# Do not build 2.12 artifacts for Scalajs
- scalaVersion: "2_12"
scalaPlatform: "js"
include:
- scalaVersion: "3_0"
scalaPlatform: "native"
runs-on: ubuntu-latest
env:
BUILD_KEY: ${{matrix.scalaVersion}}_${{matrix.scalaPlatform}}
steps:
- name: Checkout current branch
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Cache
uses: coursier/cache-action@v6
with:
extraKey: ${{ env.BUILD_KEY }}
- name: Setup Java and Scala
uses: coursier/setup-action@v1
with:
jvm: temurin:1.17
- name: Run tests
run: |
sbt test_$BUILD_KEY \
pushRemoteCache_$BUILD_KEY
- name: Run plugin tests
if: matrix.scalaVersion == '2_12' && matrix.scalaPlatform == 'jvm'
run: |
sbt scripted
- name: Run checks
if: matrix.scalaVersion == '2_13' && matrix.scalaPlatform == 'jvm'
run: |
sbt scalafmtCheckAll \
headerCheck \
"docs/mdoc"
(cd ./modules/website && yarn && yarn swizzle docusaurus-lunr-search SearchBar --danger --wrap && yarn build)
- name: Check for untracked changes
run: |
git status
./scripts/check-dirty.sh
echo "Built $(cat version)"
- name: Check for Binary Compatibility
if: matrix.scalaPlatform == 'jvm'
run: sbt mimaReportBinaryIssuesIfRelevant_$BUILD_KEY
- name: Upload compilation cache
uses: actions/upload-artifact@v4
with:
name: compilation-${{env.BUILD_KEY}}.zip
path: /tmp/remote-cache
build-success-checkpoint:
runs-on: ubuntu-latest
needs: build
steps:
- name: Build matrix completed
run: echo "Build result is a ${{ needs.build.result }}"
release:
name: Release
needs: build
if:
startsWith(github.ref, 'refs/tags/v') ||
github.event.inputs.publishSnapshot == 'true' ||
github.event_name == 'schedule'
runs-on: ubuntu-latest
steps:
- name: Checkout current branch (full)
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Java and Scala
uses: coursier/setup-action@v1
with:
jvm: temurin:1.17
- name: Cache
uses: coursier/cache-action@v6
- name: Download compilation cache
uses: actions/download-artifact@v4
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: |
echo $PGP_SECRET | base64 --decode | gpg --import --no-tty --batch --yes
sbt 'pullRemoteCache; release'
env:
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
PGP_SECRET: ${{ secrets.PGP_SECRET }}
SONATYPE_PASSWORD: ${{ secrets.S01_SONATYPE_PASSWORD }}
SONATYPE_USERNAME: ${{ secrets.S01_SONATYPE_USERNAME }}
microsite:
name: Publish Docs Microsite
if:
startsWith(github.ref, 'refs/tags/v') ||
github.event.inputs.publishMicrosite == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout current branch (full)
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Java and Scala
uses: coursier/setup-action@v1
with:
jvm: temurin:1.17
- name: Cache
uses: coursier/cache-action@v6
- name: Resolve latest smithy4s-core version
# export the version only when we trigger publish manually
if: ${{ github.event_name == 'workflow_dispatch' }}
run: echo "SMITHY4S_VERSION=$(cs resolve com.disneystreaming.smithy4s:smithy4s-core_2.13:latest.stable | head -1 | awk -F':' '{print $3}')" >> $GITHUB_ENV
- name: Compile Documentation Markdown Files
run: sbt "docs/mdoc"
- name: Build Microsite
run: cd ./modules/website && yarn && yarn swizzle docusaurus-lunr-search SearchBar --danger --wrap && yarn build
- name: Publish Microsite
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./modules/website/build
publish_branch: gh-pages