Skip to content

Run tests MacOs

Run tests MacOs #1050

name: Run tests MacOs
on:
workflow_call:
pull_request:
schedule:
# Every day at 2 AM UTC
- cron: "0 2 * * *"
workflow_dispatch:
concurrency:
group: macOS-${{ github.head_ref }}-${{ github.event_name }}
cancel-in-progress: true
jobs:
test-runtime:
name: Test runtime
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: macos-12
env:
ENABLE_EXPERIMENTAL_COMPILER: true
strategy:
fail-fast: false
matrix:
scala: [3, 2.13, 2.12]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/macos-setup-env
id: setup
with:
scala-version: ${{matrix.scala}}
- name: Prepare for GC tests
run: brew install bdw-gc
- name: Test GC compilation
timeout-minutes: 30
run: sbt "test-gc ${{ matrix.scala }}"
- name: Run tests
timeout-minutes: 45
env:
SCALANATIVE_TEST_PREFETCH_DEBUG_INFO: 1
run: sbt "test-runtime ${{matrix.scala}}"
- name: Test partests infrastructure
# No partests support for Scala 3
if: ${{ !startsWith(matrix.scala, '3') }}
timeout-minutes: 45
run: >
sbt "scalaPartestTests${{env.project-version}}/testOnly -- --showDiff neg/abstract.scala pos/abstract.scala run/Course-2002-01.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: macos-12
needs: [test-runtime]
env:
ENABLE_EXPERIMENTAL_COMPILER: true
strategy:
fail-fast: false
matrix:
scala: [2.13, 3]
build-mode: [debug, release-fast]
lto: [none, thin]
gc: [boehm, immix, commix]
exclude:
# Covered in basic test-runtime
- scala: 3
build-mode: debug
include:
- scala: 3
build-mode: release-size
lto: thin
gc: immix
# ReleaseFull is flaky
# - scala: 3
# build-mode: release-full
# lto: thin
# gc: commix
# - scala: 2
# build-mode: release-full
# lto: full
# gc: commix
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/macos-setup-env
with:
scala-version: ${{matrix.scala}}
gc: ${{ matrix.gc }}
- name: Prepare setConfig command
# Linking on MacOS in GithubActions fails when using default linker (ld), use lld instead
run: |
SetConfigTemplate=$(cat << EOM
nativeConfig ~= { _.withLinkingOptions(_ :+ "-fuse-ld=lld") }
EOM
)
echo set-native-config=${SetConfigTemplate} >> $GITHUB_ENV
- 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
TEST_COMMAND: >
set sandbox.forBinaryVersion("${{env.binary-version}}")/${{env.set-native-config}};
set tests.forBinaryVersion("${{env.binary-version}}")/${{env.set-native-config}};
set junitTestOutputsNative.forBinaryVersion("${{env.binary-version}}")/${{env.set-native-config}};
set scalaPartestJunitTests.forBinaryVersion("${{env.binary-version}}")/${{env.set-native-config}};
show tests${{env.project-version}}/nativeConfig;
sandbox${{env.project-version}}/run;
testsJVM${{env.project-version}}/test;
tests${{env.project-version}}/test;
junitTestOutputsJVM${{env.project-version}}/test;
junitTestOutputsNative${{env.project-version}}/test;
scalaPartestJunitTests${{env.project-version}}/test
run: |
export LLVM_BIN="$(brew --prefix llvm@15)/bin"
$LLVM_BIN/clang --version
sbt -J-Xmx5G "${TEST_COMMAND}"
run-scripted-tests:
name: Scripted tests
if: "github.event_name == 'pull_request' || ((github.event_name == 'schedule' || github.event_name == 'workflow_call') && github.repository == 'scala-native/scala-native')"
runs-on: macos-12
strategy:
fail-fast: false
matrix:
scala: [3]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/macos-setup-env
with:
scala-version: ${{matrix.scala}}
- name: Test scripted
run: |
export LLVM_BIN=$(brew --prefix llvm@15)/bin
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: macos-12
strategy:
fail-fast: false
matrix:
scala: [3]
llvm: [14, 16, latest] # Last 3 stable versions. 15 is tested by default, latest version == 17
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/macos-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
run: |
if [[ "${{ matrix.llvm }}" == "latest" ]]; then
export LLVM_BIN=$(brew --prefix llvm)/bin
else
export LLVM_BIN=$(brew --prefix llvm@${{ matrix.llvm }})/bin
fi
echo "LLVM_BIN=${LLVM_BIN}"
$LLVM_BIN/clang --version
sbt "test-runtime ${{ matrix.scala }}"