Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 60 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,33 @@ on:
branches: [ master ]

jobs:
# Gate the build/test jobs so doc-only changes (README, renovate.json,
# sync config, …) don't run the suite. The gated jobs keep their names as
# required status checks; skipped via a job-level `if` they report Success.
# `test-cross-platform` is split into one job per platform on purpose:
# skipping a *matrix* job leaves its required inner checks pending forever
# (actions/runner#952).
changes:
name: Detect code changes
runs-on: ubuntu-latest
outputs:
code: ${{ steps.filter.outputs.code }}
steps:
- uses: actions/checkout@v7
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
code:
- '**/*.scala'
- 'project.scala'
- '.scalafmt.conf'
- '.github/workflows/ci.yml'

lint:
name: Scalafmt
needs: changes
if: ${{ needs.changes.outputs.code == 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
Expand All @@ -20,6 +45,8 @@ jobs:

test:
name: Test
needs: changes
if: ${{ needs.changes.outputs.code == 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
Expand Down Expand Up @@ -51,6 +78,8 @@ jobs:

compile:
name: Compile (${{ matrix.platform }})
needs: changes
if: ${{ needs.changes.outputs.code == 'true' }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand All @@ -77,19 +106,15 @@ jobs:
- name: Compile
run: scala-cli --power compile . --platform ${{ matrix.platform }} ${{ matrix.args }}

# JVM is covered by the `test` job above (with coverage/docs); this just runs
# the same suite on the other targets to catch platform-specific regressions.
test-cross-platform:
name: Test (${{ matrix.platform }})
# JVM is covered by the `test` job above (with coverage/docs); these two just
# run the same suite on the other targets to catch platform-specific
# regressions. Kept as separate jobs (not a matrix) so they can be skipped
# individually without hanging their required checks.
test-scala-js:
name: Test (scala-js)
needs: changes
if: ${{ needs.changes.outputs.code == 'true' }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- platform: scala-js
args: "--js-version 1.22.0"
- platform: scala-native
args: "--native-version 0.5.12"
steps:
- uses: actions/checkout@v7
- name: Setup coursier cache
Expand All @@ -98,9 +123,29 @@ jobs:
uses: actions/cache@v6
with:
path: .scala-build
key: scala-build-${{ matrix.platform }}-${{ hashFiles('project.scala', '**/*.scala') }}
key: scala-build-scala-js-${{ hashFiles('project.scala', '**/*.scala') }}
restore-keys: |
scala-build-${{ matrix.platform }}-
scala-build-scala-js-
- uses: VirtusLab/scala-cli-setup@v1
- name: Run tests
run: scala-cli --power test . --platform scala-js --js-version 1.22.0

test-scala-native:
name: Test (scala-native)
needs: changes
if: ${{ needs.changes.outputs.code == 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Setup coursier cache
uses: coursier/cache-action@v8.1
- name: Cache scala-cli/Bloop incremental build
uses: actions/cache@v6
with:
path: .scala-build
key: scala-build-scala-native-${{ hashFiles('project.scala', '**/*.scala') }}
restore-keys: |
scala-build-scala-native-
- uses: VirtusLab/scala-cli-setup@v1
- name: Run tests
run: scala-cli --power test . --platform ${{ matrix.platform }} ${{ matrix.args }}
run: scala-cli --power test . --platform scala-native --native-version 0.5.12
Loading