Add Smithy syntax highlighting in docs (#1976) #17
This file contains hidden or 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: | |
| workflow_dispatch: | |
| inputs: | |
| publishSnapshot: | |
| description: "Publish Snapshot" | |
| required: false | |
| default: false | |
| type: boolean | |
| publishSnapshotPr: | |
| description: "PR number to publish snapshot from" | |
| required: false | |
| type: number | |
| 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: | |
| CHECKOUT_REF: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.publishSnapshotPr != '' && format('refs/pull/{0}/head', github.event.inputs.publishSnapshotPr) || github.ref }} | |
| SBT_OPTS: "-XX:MaxMetaspaceSize=4G -XX:MaxInlineLevel=20 -Xss2m -Xms512M -Xmx6G -XX:ReservedCodeCacheSize=256M" | |
| concurrency: | |
| group: ci-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| compile: | |
| name: Compile ${{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@v6 | |
| with: | |
| fetch-depth: 0 | |
| ref: ${{ env.CHECKOUT_REF }} | |
| - name: Cache | |
| uses: coursier/cache-action@v8 | |
| with: | |
| extraKey: ${{ env.BUILD_KEY }} | |
| - name: Setup Java and Scala | |
| uses: coursier/setup-action@v3 | |
| with: | |
| jvm: temurin:1.17 | |
| apps: sbt scala-cli | |
| - name: Setup sbt | |
| uses: sbt/setup-sbt@v1 | |
| - name: Compile | |
| # cs fetch is only needed to work around the following issue https://github.com/VirtusLab/scala-cli/issues/4108 | |
| run: | | |
| cs fetch --no-default -r central ch.epfl.scala::bloop-frontend:2.0.17 | |
| sbt compile_$BUILD_KEY \ | |
| testCompile_$BUILD_KEY \ | |
| pushRemoteCache_$BUILD_KEY | |
| - name: Check for untracked changes | |
| run: | | |
| git status | |
| ./scripts/check-dirty.sh | |
| echo "Built $(cat version)" | |
| - name: Upload compilation cache | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: compilation-${{env.BUILD_KEY}}.zip | |
| path: /tmp/remote-cache | |
| retention-days: 3 | |
| test: | |
| name: Test ${{matrix.scalaVersion}} (${{matrix.scalaPlatform}}) | |
| needs: compile | |
| strategy: | |
| fail-fast: true | |
| matrix: | |
| scalaVersion: ["2_12", "2_13", "3_0"] | |
| scalaPlatform: ["jvm", "js"] | |
| exclude: | |
| - 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@v6 | |
| with: | |
| fetch-depth: 0 | |
| ref: ${{ env.CHECKOUT_REF }} | |
| - name: Cache | |
| uses: coursier/cache-action@v8 | |
| with: | |
| extraKey: ${{ env.BUILD_KEY }} | |
| - name: Setup Java and Scala | |
| uses: coursier/setup-action@v3 | |
| with: | |
| jvm: temurin:1.17 | |
| apps: sbt scala-cli | |
| - name: Setup sbt | |
| uses: sbt/setup-sbt@v1 | |
| - name: Download compilation cache | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: compilation-${{env.BUILD_KEY}}.zip | |
| path: /tmp/remote-cache | |
| - name: Run tests | |
| run: | | |
| cs fetch --no-default -r central ch.epfl.scala::bloop-frontend:2.0.17 | |
| sbt pullRemoteCache_$BUILD_KEY \ | |
| test_$BUILD_KEY | |
| mima: | |
| name: MiMa ${{matrix.scalaVersion}} (jvm) | |
| needs: compile | |
| strategy: | |
| fail-fast: true | |
| matrix: | |
| scalaVersion: ["2_12", "2_13", "3_0"] | |
| runs-on: ubuntu-latest | |
| env: | |
| BUILD_KEY: ${{matrix.scalaVersion}}_jvm | |
| steps: | |
| - name: Checkout current branch | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| ref: ${{ env.CHECKOUT_REF }} | |
| - name: Cache | |
| uses: coursier/cache-action@v8 | |
| with: | |
| extraKey: ${{ env.BUILD_KEY }} | |
| - name: Setup Java and Scala | |
| uses: coursier/setup-action@v3 | |
| with: | |
| jvm: temurin:1.17 | |
| apps: sbt | |
| - name: Setup sbt | |
| uses: sbt/setup-sbt@v1 | |
| - name: Download compilation cache | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: compilation-${{env.BUILD_KEY}}.zip | |
| path: /tmp/remote-cache | |
| - name: Check for Binary Compatibility | |
| run: sbt pullRemoteCache_$BUILD_KEY mimaReportBinaryIssuesIfRelevant_$BUILD_KEY | |
| checks: | |
| name: Checks (scalafmt, scalafix, headers) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout current branch | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| ref: ${{ env.CHECKOUT_REF }} | |
| - name: Cache | |
| uses: coursier/cache-action@v8 | |
| with: | |
| extraKey: checks | |
| - name: Setup Java and Scala | |
| uses: coursier/setup-action@v3 | |
| with: | |
| jvm: temurin:1.17 | |
| apps: sbt | |
| - name: Setup sbt | |
| uses: sbt/setup-sbt@v1 | |
| - name: Run formatter and linters | |
| run: | | |
| sbt scalafmtCheckAll \ | |
| headerCheck \ | |
| scalafix_2_13_jvm \ | |
| scalafixTests_2_13_jvm | |
| docs: | |
| name: Docs (mdoc + website) | |
| needs: compile | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout current branch | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| ref: ${{ env.CHECKOUT_REF }} | |
| - name: Cache | |
| uses: coursier/cache-action@v8 | |
| with: | |
| extraKey: docs | |
| - name: Setup Java and Scala | |
| uses: coursier/setup-action@v3 | |
| with: | |
| jvm: temurin:1.17 | |
| apps: sbt | |
| - name: Setup sbt | |
| uses: sbt/setup-sbt@v1 | |
| - name: Download compilation cache (2_13_jvm) | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: compilation-2_13_jvm.zip | |
| path: /tmp/remote-cache | |
| - name: Render mdoc | |
| run: sbt pullRemoteCache_2_13_jvm "docsRendering/mdoc" | |
| - name: Build website | |
| run: cd ./modules/website && yarn && yarn swizzle docusaurus-lunr-search SearchBar --danger --wrap && yarn build | |
| sbt-plugin-discover: | |
| name: sbt plugin (discover scripted tests) | |
| runs-on: ubuntu-latest | |
| outputs: | |
| tests: ${{ steps.list.outputs.tests }} | |
| steps: | |
| - name: Checkout current branch | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| ref: ${{ env.CHECKOUT_REF }} | |
| - name: List scripted test folders | |
| id: list | |
| run: | | |
| tests=$(ls modules/codegen-plugin/src/sbt-test/codegen-plugin | jq -R . | jq -sc .) | |
| echo "tests=$tests" >> "$GITHUB_OUTPUT" | |
| echo "Discovered: $tests" | |
| sbt-plugin: | |
| name: sbt plugin (${{ matrix.test }}) | |
| needs: [compile, sbt-plugin-discover] | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| test: ${{ fromJSON(needs.sbt-plugin-discover.outputs.tests) }} | |
| steps: | |
| - name: Checkout current branch | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| ref: ${{ env.CHECKOUT_REF }} | |
| - name: Cache | |
| uses: coursier/cache-action@v8 | |
| with: | |
| extraKey: sbt-plugin | |
| - name: Setup Java and Scala | |
| uses: coursier/setup-action@v3 | |
| with: | |
| jvm: temurin:1.17 | |
| apps: sbt | |
| - name: Setup sbt | |
| uses: sbt/setup-sbt@v1 | |
| - name: Download compilation cache (jvm) | |
| uses: actions/download-artifact@v8 | |
| with: | |
| pattern: compilation-*_jvm.zip | |
| path: /tmp/remote-cache | |
| - name: Merge compilation caches | |
| run: cd /tmp/remote-cache && (ls | xargs -I {} sh -c 'cp -r {}/* .') | |
| - name: Run scripted (${{ matrix.test }}) | |
| run: sbt pullRemoteCache_2_12_jvm pullRemoteCache_2_13_jvm pullRemoteCache_3_0_jvm "scripted codegen-plugin/${{ matrix.test }}" | |
| mill-plugin: | |
| name: mill plugin (${{ matrix.project }}) | |
| needs: compile | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| project: ["millCodegenPlugin0_11", "millCodegenPlugin0_12", "millCodegenPlugin13"] | |
| steps: | |
| - name: Checkout current branch | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| ref: ${{ env.CHECKOUT_REF }} | |
| - name: Cache | |
| uses: coursier/cache-action@v8 | |
| with: | |
| extraKey: mill-plugin | |
| - name: Setup Java and Scala | |
| uses: coursier/setup-action@v3 | |
| with: | |
| jvm: temurin:1.17 | |
| apps: sbt | |
| - name: Setup sbt | |
| uses: sbt/setup-sbt@v1 | |
| - name: Download compilation cache (2_13_jvm) | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: compilation-2_13_jvm.zip | |
| path: /tmp/remote-cache/2_13_jvm | |
| - name: Download compilation cache (3_0_jvm) | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: compilation-3_0_jvm.zip | |
| path: /tmp/remote-cache/3_0_jvm | |
| - name: Merge compilation caches | |
| run: cd /tmp/remote-cache && (ls | xargs -I {} sh -c 'cp -r {}/* .') | |
| - name: Run mill plugin tests (${{ matrix.project }}) | |
| run: sbt pullRemoteCache_2_13_jvm pullRemoteCache_3_0_jvm ${{ matrix.project }}/test | |
| build-success-checkpoint: | |
| runs-on: ubuntu-latest | |
| needs: [compile, test, mima, checks, docs, sbt-plugin-discover, sbt-plugin, mill-plugin] | |
| steps: | |
| - name: Build matrix completed | |
| run: | | |
| echo "compile = ${{ needs.compile.result }}" | |
| echo "test = ${{ needs.test.result }}" | |
| echo "mima = ${{ needs.mima.result }}" | |
| echo "checks = ${{ needs.checks.result }}" | |
| echo "docs = ${{ needs.docs.result }}" | |
| echo "sbt-plugin-discover = ${{ needs.sbt-plugin-discover.result }}" | |
| echo "sbt-plugin = ${{ needs.sbt-plugin.result }}" | |
| echo "mill-plugin = ${{ needs.mill-plugin.result }}" | |
| if [[ "${{ needs.compile.result }}" != "success" \ | |
| || "${{ needs.test.result }}" != "success" \ | |
| || "${{ needs.mima.result }}" != "success" \ | |
| || "${{ needs.checks.result }}" != "success" \ | |
| || "${{ needs.docs.result }}" != "success" \ | |
| || "${{ needs.sbt-plugin-discover.result }}" != "success" \ | |
| || "${{ needs.sbt-plugin.result }}" != "success" \ | |
| || "${{ needs.mill-plugin.result }}" != "success" ]]; then | |
| exit 1 | |
| fi | |
| release: | |
| name: Release ${{matrix.scalaVersion}} (${{matrix.scalaPlatform}}) | |
| needs: compile | |
| if: | |
| startsWith(github.ref, 'refs/tags/v') || | |
| github.event.inputs.publishSnapshot == 'true' || | |
| github.event_name == 'schedule' | |
| strategy: | |
| # don't cancel the matrix on first failure: for snapshots we want every | |
| # shard to land independently, and for stable releases we'd rather the | |
| # aggregator skip than half the bundle silently disappear | |
| fail-fast: false | |
| matrix: | |
| scalaVersion: ["2_12", "2_13", "3_0"] | |
| scalaPlatform: ["jvm", "js"] | |
| exclude: | |
| - 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 (full) | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| ref: ${{ env.CHECKOUT_REF }} | |
| - name: Setup Java and Scala | |
| uses: coursier/setup-action@v3 | |
| with: | |
| jvm: temurin:1.17 | |
| apps: sbt | |
| - name: Setup sbt | |
| uses: sbt/setup-sbt@v1 | |
| - name: Cache | |
| uses: coursier/cache-action@v8 | |
| with: | |
| extraKey: ${{ env.BUILD_KEY }} | |
| - name: Download compilation cache | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: compilation-${{env.BUILD_KEY}}.zip | |
| path: /tmp/remote-cache | |
| - name: Publish ${{ github.ref }} (${{env.BUILD_KEY}}) | |
| run: sbt "show version; pullRemoteCache_$BUILD_KEY; ci-release" | |
| env: | |
| # cleaning will removed generated code from bootstrapped module which will | |
| # cause the repo to be dirty and change the version to a -SNAPSHOT version | |
| CI_CLEAN: "" | |
| # Override what ci-release runs so each shard only publishes its own | |
| # (scala, platform) slice. CI_RELEASE replaces "+publishSigned" for | |
| # stable releases; CI_SNAPSHOT_RELEASE replaces "+publish" for snapshots. | |
| # For snapshots, that publishes straight to central-snapshots — done. | |
| # For stable releases, publishSigned_<shard> writes signed artifacts | |
| # into target/sona-staging/, which the aggregator job collects and | |
| # releases as one bundle via sonaRelease. Skip the per-shard release. | |
| CI_RELEASE: publishSigned_${{env.BUILD_KEY}} | |
| CI_SNAPSHOT_RELEASE: publish_${{env.BUILD_KEY}} | |
| CI_SONATYPE_RELEASE: version | |
| PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} | |
| PGP_SECRET: ${{ secrets.PGP_SECRET }} | |
| SONATYPE_PASSWORD: ${{ secrets.CENTRAL_SONATYPE_PASSWORD }} | |
| SONATYPE_USERNAME: ${{ secrets.CENTRAL_SONATYPE_USERNAME }} | |
| - name: Upload signed staging slice | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: sona-staging-${{env.BUILD_KEY}} | |
| path: target/sona-staging | |
| retention-days: 1 | |
| if-no-files-found: error | |
| release-bundle: | |
| name: Release bundle (aggregate) | |
| needs: release | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout current branch (full) | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| ref: ${{ env.CHECKOUT_REF }} | |
| - name: Setup Java and Scala | |
| uses: coursier/setup-action@v3 | |
| with: | |
| jvm: temurin:1.17 | |
| apps: sbt | |
| - name: Setup sbt | |
| uses: sbt/setup-sbt@v1 | |
| - name: Cache | |
| uses: coursier/cache-action@v8 | |
| with: | |
| extraKey: release-bundle | |
| - name: Download per-shard staging slices | |
| uses: actions/download-artifact@v8 | |
| with: | |
| pattern: sona-staging-* | |
| path: /tmp/staging | |
| - name: Merge into one staging tree | |
| # Each shard's artifact unpacks to /tmp/staging/sona-staging-<key>/<contents>. | |
| # Merge them into a single tree at target/sona-staging/. | |
| run: | | |
| mkdir -p target/sona-staging | |
| for d in /tmp/staging/sona-staging-*; do | |
| cp -r "$d"/. target/sona-staging/ | |
| done | |
| echo "Merged staging tree:" | |
| find target/sona-staging -maxdepth 4 -type d | |
| - name: Release bundle | |
| run: sbt "show version; sonaRelease" | |
| env: | |
| SONATYPE_PASSWORD: ${{ secrets.CENTRAL_SONATYPE_PASSWORD }} | |
| SONATYPE_USERNAME: ${{ secrets.CENTRAL_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@v6 | |
| with: | |
| fetch-depth: 0 | |
| ref: ${{ env.CHECKOUT_REF }} | |
| - name: Setup Java and Scala | |
| uses: coursier/setup-action@v3 | |
| with: | |
| jvm: temurin:1.17 | |
| apps: sbt | |
| - name: Setup sbt | |
| uses: sbt/setup-sbt@v1 | |
| - name: Cache | |
| uses: coursier/cache-action@v8 | |
| - 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 --ttl 0 | head -1 | awk -F':' '{print $3}')" >> $GITHUB_ENV | |
| - name: Compile Documentation Markdown Files | |
| run: sbt "docsRendering/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 |