This test should pass next! #666
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: Scala CI | |
# Run on every push to main and every change on pull requests | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
permissions: | |
contents: read | |
jobs: | |
# Formatting checks | |
format: | |
name: "Format checks" | |
runs-on: ubuntu-latest | |
# Checkout the code | |
steps: | |
- name: Checkout Scair | |
uses: actions/checkout@v4 | |
with: | |
path: scair | |
# Restore SBT's incremental build cache | |
- name: Cache Incremental Build | |
uses: actions/cache@v4 | |
with: | |
# All the target/ subdirectories are cached | |
path: "scair/**/target" | |
# Caches are immutable; we need to uniquely identify them to always push the recent ones | |
# There is an LRU-like policy in place on GitHub's side, capped at 10GB caches per repo | |
key: sbt-incremental-format-${{ github.run_id }}-${{ github.run_attempt }} | |
# When restoring, we restore the most recent one pushed by such a job | |
# Those are scoped by branch too; e.g., the most recent one from the main branch would | |
# be fetched in a fresh PR, then the most recent one from this PR. | |
restore-keys: | | |
sbt-incremental-format- | |
- name: Cache coursier packages | |
uses: coursier/cache-action@v6 | |
- name: Install coursier packages (Scala and SBT) | |
uses: coursier/setup-action@v1 | |
with: | |
apps: scala:3.3.1 sbt | |
# Check if the code is formatted as expected | |
- name: Run format checks | |
run: | | |
cd scair | |
sbt formatCheckAll | |
# Unit tests | |
unit-tests: | |
name: "Unit tests" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Scair | |
uses: actions/checkout@v4 | |
with: | |
path: scair | |
# Restore SBT's incremental build cache | |
- name: Restore Incremental Build Cache | |
uses: actions/cache@v4 | |
with: | |
# All the target/ subdirectories are cached | |
path: "scair/**/target" | |
# Caches are immutable; we need to uniquely identify them to always push the recent ones | |
# There is an LRU-like policy in place on GitHub's side, capped at 10GB caches per repo | |
key: sbt-incremental-tests-${{ github.run_id }}-${{ github.run_attempt }} | |
# When restoring, we restore the most recent one pushed by such a job | |
# Those are scoped by branch too; e.g., the most recent one from the main branch would | |
# be fetched in a fresh PR, then the most recent one from this PR. | |
restore-keys: | | |
sbt-incremental-tests- | |
- name: Cache coursier packages | |
uses: coursier/cache-action@v6 | |
- name: Install coursier packages (Scala and SBT) | |
uses: coursier/setup-action@v1 | |
with: | |
apps: scala:3.3.1 sbt | |
- name: Compile and run tests | |
run: | | |
cd scair | |
sbt test | |
# Filecheck tests | |
filechecks: | |
name: "Filechecks" | |
runs-on: ubuntu-latest | |
env: | |
MLIR-Version: 98e674c9f16d677d95c67bc130e267fae331e43c | |
steps: | |
############## | |
# MLIR SETUP # | |
############## | |
# Get from cache | |
- name: Cache MLIR build | |
id: cache-binary | |
uses: actions/cache@v4 | |
with: | |
path: llvm-project/build | |
key: mlir-${{ runner.os }}-${{ env.MLIR-Version }} | |
restore-keys: mlir-${{ runner.os }}-${{ env.MLIR-Version }} | |
# Otherwise, get it and build it | |
- name: Checkout MLIR | |
if: steps.cache-binary.outputs.cache-hit != 'true' | |
uses: actions/checkout@v4 | |
with: | |
repository: llvm/llvm-project.git | |
path: llvm-project | |
ref: ${{ env.MLIR-Version }} | |
- name: Clang Setup | |
if: steps.cache-binary.outputs.cache-hit != 'true' | |
uses: egor-tensin/setup-clang@v1 | |
- name: Ninja Setup | |
if: steps.cache-binary.outputs.cache-hit != 'true' | |
uses: lukka/get-cmake@9e431acfe656e5db66cd4930386328fce59cfaba | |
- name: MLIR configuration | |
if: steps.cache-binary.outputs.cache-hit != 'true' | |
run: | | |
mkdir llvm-project/build | |
cd llvm-project/build | |
cmake -G Ninja ../llvm \ | |
-DLLVM_ENABLE_PROJECTS=mlir \ | |
-DLLVM_TARGETS_TO_BUILD="Native" \ | |
-DLLVM_ENABLE_LLD=ON \ | |
-DLLVM_INCLUDE_BENCHMARKS=OFF \ | |
-DLLVM_INCLUDE_EXAMPLES=OFF \ | |
-DCMAKE_C_COMPILER=clang \ | |
-DCMAKE_CXX_COMPILER=clang++ \ | |
-DCMAKE_C_FLAGS="-pipe" \ | |
-DCMAKE_CXX_FLAGS="-pipe" \ | |
-DCMAKE_BUILD_TYPE=Release | |
- name: MLIR build | |
if: steps.cache-binary.outputs.cache-hit != 'true' | |
run: | | |
cd llvm-project/build | |
cmake --build . --target mlir-opt mlir-cpu-runner | |
############# | |
# FILECHECK # | |
############# | |
- name: Python Setup | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- name: Install lit and filecheck (python version) | |
run: | | |
pip install --upgrade pip | |
pip install lit filecheck | |
- name: Checkout Scair | |
uses: actions/checkout@v4 | |
with: | |
path: scair | |
# Restore SBT's incremental build cache | |
- name: Cache Incremental Build | |
uses: actions/cache@v4 | |
with: | |
# All the target/ subdirectories are cached | |
path: "scair/**/target" | |
# Caches are immutable; we need to uniquely identify them to always push the recent ones | |
# There is an LRU-like policy in place on GitHub's side, capped at 10GB caches per repo | |
key: sbt-incremental-filechecks-${{ github.run_id }}-${{ github.run_attempt }} | |
# When restoring, we restore the most recent one pushed by such a job | |
# Those are scoped by branch too; e.g., the most recent one from the main branch would | |
# be fetched in a fresh PR, then the most recent one from this PR. | |
restore-keys: | | |
sbt-incremental-filechecks- | |
- name: Cache coursier packages | |
uses: coursier/cache-action@v6 | |
- name: Install coursier packages (Scala and SBT) | |
uses: coursier/setup-action@v1 | |
with: | |
apps: scala:3.3.1 sbt | |
- name: Filechecks and dependencies | |
run: | | |
export PATH=$PATH:${GITHUB_WORKSPACE}/llvm-project/build/bin/ | |
cd scair | |
sbt filechecks |