Skip to content

Attempt to use ar command for static libraries when possible #3080

Attempt to use ar command for static libraries when possible

Attempt to use ar command for static libraries when possible #3080

Workflow file for this run

name: Run tests MacOs
on:
workflow_call:
pull_request:
schedule:
# Every day at 2 AM UTC
- cron: "0 2 * * *"
concurrency:
group: macOS-${{ github.head_ref }}-${{ github.event_name }}
cancel-in-progress: true
jobs:
test-runtime:
name: Test runtime
runs-on: macos-12
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@v3
- uses: ./.github/actions/macos-setup-env
id: setup
with:
scala-version: ${{matrix.scala}}
gc: ${{ matrix.gc }}
- name: Test runtime
run: >
export SCALANATIVE_GC=${{matrix.gc}} &&
sbt "test-runtime ${{matrix.scala}}"
- name: Test partests infrastructure
# No partests support for Scala 3
if: ${{ !startsWith(matrix.scala, '3') }}
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
runs-on: macos-12
needs: [test-runtime]
env:
ENABLE_EXPERIMENTAL_COMPILER: true
if: "(github.event_name == 'schedule' || github.event_name == 'workflow_call') && github.repository == 'scala-native/scala-native'"
strategy:
fail-fast: false
matrix:
scala: [3, 3-next, 2.13]
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@v3
- 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
env:
SCALANATIVE_MODE: ${{ matrix.build-mode }}
SCALANATIVE_GC: ${{ matrix.gc }}
SCALANATIVE_LTO: ${{ matrix.lto }}
SCALANATIVE_OPTIMIZE: true
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
runs-on: macos-12
strategy:
fail-fast: false
matrix:
scala: [2.12, 3]
steps:
- uses: actions/checkout@v3
- 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-multihreading:
name: Test experimental multithreading support
runs-on: macos-12
env:
ENABLE_EXPERIMENTAL_COMPILER: true
SCALANATIVE_TEST_PREFETCH_DEBUG_INFO: 1
strategy:
fail-fast: false
matrix:
scala: [3]
build-mode: [debug, release-fast]
gc: [boehm, immix]
lto: [none, thin]
include:
- scala: 3-next
build-mode: release-fast
lto: thin
gc: immix
exclude:
# Takes too much time to build
- build-mode: release-fast
lto: none
# Temporaly disabled, probably due the stack overflow in spawned threads
- build-mode: release-fast
lto: thin
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/macos-setup-env
with:
scala-version: ${{matrix.scala}}
gc: ${{ matrix.gc }}
- name: Prepare native config command
shell: bash
# Linking on MacOS in GithubActions fails when using default linker (ld), use lld instead
run: |
buildMode=${{matrix.build-mode}}
if [[ "$buildMode" == "release-fast" ]]; then
buildMode=releaseFast
fi
SetConfigTemplate=$(cat << EOM
nativeConfig ~= { prev =>
prev
.withMode(scalanative.build.Mode.${buildMode})
.withGC(scalanative.build.GC.${{matrix.gc}})
.withLTO(scalanative.build.LTO.${{matrix.lto}})
.withEmbedResources(true)
.withCheck(true)
.withCheckFatalWarnings(true)
.withMultithreadingSupport(true)
.withLinkingOptions(_ :+ "-fuse-ld=lld")
}
EOM
)
echo set-native-config=${SetConfigTemplate} >> $GITHUB_ENV
- name: Run tests
# 2x more then it should take to build and run tests
timeout-minutes: 60
env:
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}"
test-llvm-versions:
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
if: "(github.event_name == 'schedule' || github.event_name == 'workflow_call') && github.repository == 'scala-native/scala-native'"
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/macos-setup-env
with:
scala-version: ${{matrix.scala}}
llvm-version: ${{ matrix.llvm }}
java-version: 8
- name: Run tests
# env:
# SCALANATIVE_MODE: release-fast
# SCALANATIVE_LTO: thin
run: |
if [[ "${{ matrix.llvm-version }}" == "latest" ]]; then
export LLVM_BIN=$(brew --prefix llvm)/bin
else
export LLVM_BIN=$(brew --prefix llvm@${{ matrix.llvm-version }})/bin
fi
echo "LLVM_BIN=${LLVM_BIN}"
$LLVM_BIN/clang --version
sbt "test-runtime ${{ matrix.scala }}"