Skip to content

Run tests Linux

Run tests Linux #210

name: Run tests Linux
on:
workflow_call:
pull_request:
schedule:
# Every day at 2 AM UTC
- cron: "0 2 * * *"
workflow_dispatch:
concurrency:
group: linux-${{ github.head_ref }}-${{ github.event_name }}
cancel-in-progress: true
jobs:
# Compile all sources for given Scala version
# Cache external dependencies
# Test tools, if any of them fails, further tests will not start.
tests-tools:
name: Compile & test tools
if: "github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' || ((github.event_name == 'schedule' || github.event_name == 'workflow_call') && github.repository == 'scala-native/scala-native')"
runs-on: ubuntu-22.04
env:
ENABLE_EXPERIMENTAL_COMPILER: true
strategy:
fail-fast: false
matrix:
scala: [2.12, 2.13, 3, 3-next]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/linux-setup-env
with:
scala-version: ${{matrix.scala}}
java-version: 8
- name: Test tools
run: sbt "test-tools ${{ matrix.scala }}; toolsBenchmarks${{env.project-version}}/Jmh/compile"
tests-compile-scalaPublishVersion:
name: Compile sources with the Scala 3 version used for publishing artifacts
if: "github.event_name == 'pull_request' || ((github.event_name == 'schedule' || github.event_name == 'workflow_call') && github.repository == 'scala-native/scala-native')"
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/linux-setup-env
with:
scala-version: 3
java-version: 8
- name: Compile everything
# Publish 2.13.latest artifacts locally first, these are required by scalalib3
run: sbt "scalalib2_13/publishLocal;clean; ++2.13.8; all Test/compile Compile/doc; ++3.1.3; all Test/compile Compile/doc"
test-scala-cross-build:
runs-on: ubuntu-22.04
if: "(github.event_name == 'schedule' || github.event_name == 'workflow_call') && github.repository == 'scala-native/scala-native'"
env:
ENABLE_EXPERIMENTAL_COMPILER: true
strategy:
fail-fast: false
matrix:
scala: [2.12, 2.13, 3, 3-next]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/linux-setup-env
with:
scala-version: ${{matrix.scala}}
java-version: 8
- name: Test cross compilation of compiler plugins
run: sbt "+nscplugin${{ env.project-version }}/test; +junitPlugin${{ env.project-version }}/compile; +scalalib${{ env.project-version }}/compile"
test-runtime:
name: Test runtime
if: "github.event_name == 'pull_request' || ((github.event_name == 'schedule' || github.event_name == 'workflow_call') && github.repository == 'scala-native/scala-native')"
runs-on: ubuntu-22.04
needs: tests-tools
env:
ENABLE_EXPERIMENTAL_COMPILER: true
strategy:
fail-fast: false
matrix:
scala: [3]
gc: [none, boehm, immix, commix]
include:
- scala: 3-next
gc: immix
- scala: 2.13
gc: immix
- scala: 2.12
gc: immix
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/linux-setup-env
with:
scala-version: ${{matrix.scala}}
- name: Run tests
timeout-minutes: 45
env:
SCALANATIVE_GC: ${{ matrix.gc }}
SCALANATIVE_TEST_PREFETCH_DEBUG_INFO: 1
run: sbt "test-runtime ${{ matrix.scala }}"
test-runtime-ext:
name: Test runtime extension
if: "(github.event_name == 'schedule' || github.event_name == 'workflow_call') && github.repository == 'scala-native/scala-native'"
runs-on: ubuntu-22.04
needs: [tests-tools, test-runtime]
env:
ENABLE_EXPERIMENTAL_COMPILER: true
strategy:
fail-fast: false
matrix:
scala: [2.13, 3, 3-next]
build-mode: [debug, release-fast]
lto: [none, thin]
gc: [boehm, immix, commix]
exclude:
# Covered in basic test-runtime
- scala: 3
build-mode: debug
- scala: 2.13
build-mode: debug
gc: immix
# Slow, leads to timeouts
- build-mode: release-fast
lto: none
include:
- scala: 3
build-mode: release-size
lto: thin
gc: immix
# Release-full is flaky
# - scala: 3
# build-mode: release-full
# lto: thin
# gc: commix
# - scala: 2.13
# build-mode: release-full
# lto: full
# gc: commix
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/linux-setup-env
with:
scala-version: ${{matrix.scala}}
- name: Run tests
timeout-minutes: 45
env:
SCALANATIVE_MODE: ${{ matrix.build-mode }}
SCALANATIVE_GC: ${{ matrix.gc }}
SCALANATIVE_LTO: ${{ matrix.lto }}
SCALANATIVE_OPTIMIZE: true
SCALANATIVE_TEST_PREFETCH_DEBUG_INFO: 1
run: sbt "test-runtime ${{ matrix.scala }}"
# This job is basically copy-paste of test-runtime.
# Main difference is disabled optimization and fixed Immix GC
test-runtime-no-opt:
name: Test runtime no-opt
if: "(github.event_name == 'schedule' || github.event_name == 'workflow_call') && github.repository == 'scala-native/scala-native'"
runs-on: ubuntu-22.04
needs: tests-tools
env:
ENABLE_EXPERIMENTAL_COMPILER: true
strategy:
fail-fast: false
matrix:
scala: [3, 2.13]
build-mode: [debug]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/linux-setup-env
with:
scala-version: ${{matrix.scala}}
- name: Run tests
timeout-minutes: 45
env:
SCALANATIVE_MODE: ${{ matrix.build-mode }}
SCALANATIVE_GC: immix
SCALANATIVE_OPTIMIZE: false
SCALANATIVE_TEST_PREFETCH_DEBUG_INFO: 1
run: sbt "test-runtime ${{ matrix.scala }}"
# This job is basically copy-paste of test-runtime.
# Scripted tests take a long time to run, ~30 minutes, and should be limited and absolute minimum.
test-scripted:
name: Test scripted
if: "github.event_name == 'pull_request' || ((github.event_name == 'schedule' || github.event_name == 'workflow_call') && github.repository == 'scala-native/scala-native')"
runs-on: ubuntu-22.04
needs: tests-tools
strategy:
fail-fast: false
matrix:
scala: [2.12, 3]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/linux-setup-env
with:
scala-version: ${{matrix.scala}}
- name: Run tests
env:
SCALANATIVE_MODE: release-fast
SCALANATIVE_GC: immix
SCALANATIVE_OPTIMIZE: true
run: |
export LLVM_BIN=$(dirname $(readlink -f /usr/bin/clang))
sbt "test-scripted ${{matrix.scala}}"
test-llvm-versions:
if: "(github.event_name == 'schedule' || github.event_name == 'workflow_call') && github.repository == 'scala-native/scala-native'"
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
scala: [3]
llvm: [14, 15, 16, 17, 18] # Last 3 stable versions + available future versions
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/linux-setup-env
with:
scala-version: ${{matrix.scala}}
llvm-version: ${{ matrix.llvm }}
java-version: 8
- name: Run tests
timeout-minutes: 45
env:
SCALANATIVE_MODE: release-fast
SCALANATIVE_LTO: thin
LLVM_BIN: "/usr/lib/llvm-${{ matrix.llvm }}/bin"
SCALANATIVE_TEST_PREFETCH_DEBUG_INFO: 1
run: sbt "test-runtime ${{ matrix.scala }}"
test-scala-partests:
if: "github.event_name == 'pull_request' || ((github.event_name == 'schedule' || github.event_name == 'workflow_call') && github.repository == 'scala-native/scala-native')"
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
scala: [2.13]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/linux-setup-env
with:
scala-version: ${{matrix.scala}}
java-version: 11
# Make sure that Scala partest denylisted tests contain only valid test names
- name: Setup Scala-cli
uses: VirtusLab/[email protected]
- name: Check partest disabled tests list
# No partests support for Scala 3
if: ${{ !startsWith(matrix.scala, '3') }}
run: |
sbt "scalaPartest${{env.project-version}}/fetchScalaSource"
scala-cli scripts/partest-check-files.scala
# scala-cli-setup can override default java version
- uses: ./.github/actions/linux-setup-env
with:
scala-version: ${{matrix.scala}}
java-version: 11
# Running all partests would take ~2h for each Scala version, run only single test of each kind
# to make sure that infrastructure works correctly.
- name: Test partests infrastracture
if: "github.event_name == 'pull_request'"
run: |
sbt \
"-J-Xmx3G" \
"scalaPartestTests${{env.project-version}}/testOnly -- --showDiff neg/abstract.scala pos/abstract.scala run/Course-2002-01.scala"
- name: Run all of partests
if: "github.event_name == 'schedule'"
timeout-minutes: 300
run: |
sbt \
"-J-Xmx3G" \
"scalaPartestTests${{env.project-version}}/testOnly -- --showDiff"