install sbt in container.yml #7143
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
on: | |
# Every pull request | |
pull_request: | |
# Pushes into the trunk | |
# This is important to ensure the trunk is not broken and | |
# to populate the cache for future PRs. | |
# See https://github.community/t/actions-cache-cache-not-being-hit-despite-of-being-present/17956/3 | |
push: | |
branches: | |
- main | |
name: build | |
jobs: | |
build-mdbook: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup mdBook | |
uses: peaceiris/actions-mdbook@v1 | |
with: | |
mdbook-version: "0.4.5" | |
- name: Compile mdBook | |
run: | | |
cd docs | |
mdbook build | |
format-check: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: temurin | |
java-version: 17 | |
cache: sbt | |
# see: https://github.com/actions/runner-images/issues/10788 | |
- uses: sbt/setup-sbt@v1 | |
- name: Check formatting | |
run: make fmt-check | |
scaladoc-check: | |
env: | |
APALACHE_FATAL_WARNINGS: true | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: temurin | |
java-version: 17 | |
# see: https://github.com/actions/runner-images/issues/10788 | |
- uses: sbt/setup-sbt@v1 | |
- name: Check scaladoc | |
run: sbt unidoc | |
compiler-warnings: | |
env: | |
APALACHE_FATAL_WARNINGS: true | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: temurin | |
java-version: 17 | |
# see: https://github.com/actions/runner-images/issues/10788 | |
- uses: sbt/setup-sbt@v1 | |
- name: Coursier cache | |
uses: coursier/cache-action@v6 | |
- name: Set APALACHE_HOME env | |
# See https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-environment-variable | |
run: echo "APALACHE_HOME=$GITHUB_WORKSPACE" >> $GITHUB_ENV | |
- name: Build and Unit Test | |
run: make compile-strict | |
- name: Cleanup before cache | |
# See https://www.scala-sbt.org/1.x/docs/GitHub-Actions-with-sbt.html#Caching | |
shell: bash | |
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 | |
unit-tests: | |
runs-on: ${{ matrix.operating-system }} | |
strategy: | |
# Allows other OS tests to proceed even if one fails | |
fail-fast: false | |
matrix: | |
operating-system: [ubuntu-latest, macos-latest] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Coursier cache | |
uses: coursier/cache-action@v6 | |
- name: Coursier setup | |
uses: coursier/setup-action@v1 | |
with: | |
jvm: temurin:1.17 | |
apps: sbt | |
# see: https://github.com/actions/runner-images/issues/10788 | |
- uses: sbt/setup-sbt@v1 | |
- name: Set APALACHE_HOME env | |
# See https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-environment-variable | |
run: echo "APALACHE_HOME=$GITHUB_WORKSPACE" >> $GITHUB_ENV | |
- name: Build and Unit Test | |
run: make test | |
- name: Cleanup before cache | |
# See https://www.scala-sbt.org/1.x/docs/GitHub-Actions-with-sbt.html#Caching | |
shell: bash | |
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 | |
integration-tests: | |
runs-on: ${{ matrix.operating-system }} | |
strategy: | |
# Allows other OS tests to proceed even if one fails | |
fail-fast: false | |
matrix: | |
operating-system: [ubuntu-latest, macos-latest] | |
smt-encoding: [oopsla19, arrays] | |
exclude: | |
# We don't need an additional run of the arrays encoding just for macos | |
# since no OS-specific differences seem likely. | |
- operating-system: macos-latest | |
smt-encoding: arrays | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Cache local m2 repository | |
uses: actions/cache@v2 | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-sbt-${{ hashFiles('project/Dependencies.scala') }} | |
restore-keys: | | |
${{ runner.os }}-sbt- | |
${{ runner.os }}- | |
- name: Cache nix store | |
# Workaround for cache action not playing well with permissions | |
# See https://github.com/actions/cache/issues/324 | |
uses: john-shaffer/cache@59429c0461095f341a8cf7388e5d3aef37b95edd | |
with: | |
path: | | |
/nix/store | |
/nix/var/nix/profiles | |
key: ${{ runner.os }}-nix-${{ hashFiles('**.nix') }} | |
restore-keys: | | |
${{ runner.os }}-nix- | |
${{ runner.os }}- | |
- name: Install Nix | |
uses: cachix/install-nix-action@v22 | |
with: | |
extra_nix_config: | | |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} | |
- name: Build dev-shell | |
run: nix develop -c bash -c exit | |
- name: Build and run integration tests | |
run: nix develop -c make integration | |
env: | |
SMT_ENCODING: ${{ matrix.smt-encoding }} | |
TEST_FILTER: ${{ matrix.smt-encoding == 'arrays' && 'array-encoding' || '' }} | |
docker-tests: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
# see: https://github.com/actions/runner-images/issues/10788 | |
- uses: sbt/setup-sbt@v1 | |
- name: Cache nix store | |
# Workaround for cache action not playing well with permissions | |
# See https://github.com/actions/cache/issues/324 | |
uses: john-shaffer/cache@59429c0461095f341a8cf7388e5d3aef37b95edd | |
with: | |
path: | | |
/nix/store | |
/nix/var/nix/profiles | |
key: ${{ runner.os }}-nix-${{ hashFiles('**.nix') }} | |
restore-keys: | | |
${{ runner.os }}-nix- | |
${{ runner.os }}- | |
- name: Install Nix | |
uses: cachix/install-nix-action@v22 | |
with: | |
extra_nix_config: | | |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} | |
- name: Build dev-shell | |
run: nix develop -c bash -c exit | |
- name: Build the docker image | |
run: make docker | |
- name: Run integration tests in docker container | |
run: | | |
nix develop -c bash -c "source ./test/.envrc && test/mdx-test.py --debug" | |
env: | |
USE_DOCKER: true | |
APALACHE_TAG: latest |