Skip to content

Look up host macOS version dynamically in framework tests #4084

Look up host macOS version dynamically in framework tests

Look up host macOS version dynamically in framework tests #4084

Workflow file for this run

name: CI
on:
# Every PR
pull_request:
push:
branches:
# Once merged into the head branch.
- main
# And on `ci-full` to allow running time-consuming checks.
- ci-full
# Every monday at 09:00 in the morning
schedule:
- cron: '0 9 * * MON'
permissions:
contents: read
env:
# Disable incremental compilation
CARGO_BUILD_INCREMENTAL: false
# Set prettier + more verbose terminal output
CARGO_TERM_COLOR: always
CARGO_TERM_VERBOSE: true
RUST_BACKTRACE: 1
# Faster compilation, error on warnings and only document current crate
RUSTFLAGS: "--codegen=debuginfo=0 --deny=warnings"
# Minimum deployment targets.
# Follows `rustc --target=x86_64-apple-darwin --print deployment-target`
MACOSX_DEPLOYMENT_TARGET: 10.12
# Follows `rustc --target=x86_64-apple-ios --print deployment-target`
IPHONEOS_DEPLOYMENT_TARGET: 10.0
# We only support compiling Objective-C code with clang
CC: clang
CXX: clang++
# Crates that we want to run `rustdoc` and `clippy` on
#
# This excludes `header-translator`, `test-assembly`, `tests` and `test-ui`.
PUBLIC_CRATES: >-
--package=dispatch2
--package=block2
--package=objc2
--package=objc2-encode
--package=objc2-proc-macros
--package=objc2-exception-helper
# The current nightly Rust version. Keep this synced with `rust-toolchain.toml`
CURRENT_NIGHTLY: nightly-2026-08-23
# https://doc.rust-lang.org/cargo/guide/cargo-home.html#caching-the-cargo-home-in-ci
# Note: We don't cache `~/.cargo/bin`, that is done separately when needed.
CARGO_CACHE_PATH: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
jobs:
fmt:
name: Check formatting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
submodules: true
- name: Use system Rust
run: rustup override set stable
- name: Install rustfmt
run: rustup component add rustfmt
- name: cargo fmt
# This runs on the entire repository, including submodules
run: cargo fmt -- --check
lint:
name: Lint ${{ matrix.name }}
runs-on: ubuntu-latest
strategy:
# These jobs are "cheap" to run, will likely run in parallel anyhow, and
# it can be useful to know exactly which parts failed.
fail-fast: false
matrix:
include:
# Check three major architectures (x86_64, Aarch64 and any 32bit), and
# test three OS'es (macOS, iOS and a more obscure one, visionOS simulator).
#
# This should give us fairly good coverage for normal PRs.
- name: macOS x86_64
target: x86_64-apple-darwin
# `cc` works poorly when cross-compiling, so let's ignore `objc2-exception-helper` for now.
args: >
--workspace
--exclude header-translator --exclude test-assembly
--exclude test-ui --exclude test-fuzz --exclude tests
--exclude objc2-exception-helper --exclude apple-doc
--exclude doc-viewer --exclude fskit-example
- name: iOS ARMv7s
target: armv7s-apple-ios
build-std: true
# FIXME: `objc2-io-usb-host` is excluded for now, some constants overflow on 32-bit.
args: >
-Zbuild-std
--workspace
--exclude header-translator --exclude test-assembly
--exclude test-ui --exclude test-fuzz --exclude tests
--exclude objc2-exception-helper --exclude apple-doc
--exclude doc-viewer --exclude fskit-example
--exclude objc2-io-usb-host
- name: visionOS Aarch64 simulator
target: aarch64-apple-visionos-sim
build-std: true
args: >
-Zbuild-std
--workspace
--exclude header-translator --exclude test-assembly
--exclude test-ui --exclude test-fuzz --exclude tests
--exclude objc2-exception-helper --exclude apple-doc
--exclude doc-viewer --exclude fskit-example
- name: GNUStep + exceptions
target: x86_64-unknown-linux-gnu
args: $PUBLIC_CRATES --package=objc2-app-kit --package=objc2-foundation --features=gnustep-1-9,catch-all
- name: header-translator
target: x86_64-unknown-linux-gnu
args: --package header-translator
- name: test-assembly
target: x86_64-unknown-linux-gnu
args: --package test-assembly
env:
CARGO_BUILD_TARGET: ${{ matrix.target }}
steps:
- uses: actions/checkout@v6
with:
submodules: true
- name: Use nightly toolchain
run: |
rustup toolchain install ${{ env.CURRENT_NIGHTLY }} --profile=minimal --no-self-update
rustup override set ${{ env.CURRENT_NIGHTLY }}
- name: Add clippy component
run: rustup component add clippy
- name: Add rust-src component for -Zbuild-std
if: matrix.build-std
run: rustup component add rust-src
- name: Install target
if: ${{ matrix.target && !matrix.build-std }}
run: rustup target add ${{ matrix.target }}
- name: Cache Cargo
uses: actions/cache@v6
with:
path: ${{ env.CARGO_CACHE_PATH }}
key: cargo-${{ github.job }}-${{ matrix.name }}-${{ hashFiles('**/Cargo.lock') }}
- name: cargo doc
# HACK: Using `-Zrustdoc-mergeable-info` before it's stable to alleviate https://github.com/rust-lang/rust/issues/146895
run: cargo doc -Zrustdoc-mergeable-info --no-deps --document-private-items ${{ matrix.args }}
env:
# docsrs runs on nightly, so we can use nightly features when `docsrs` is enabled.
RUSTDOCFLAGS: "--deny=warnings --cfg=docsrs"
- name: cargo clippy
run: cargo clippy --all-targets ${{ matrix.args }}
msrv:
name: Check MSRV
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
submodules: true
- name: Use MSRV toolchain
run: |
rustup toolchain install 1.71 --profile=minimal --no-self-update
rustup override set 1.71
- name: Install target
run: rustup target add x86_64-apple-darwin
- name: Cache Cargo
uses: actions/cache@v6
with:
path: ${{ env.CARGO_CACHE_PATH }}
key: cargo-${{ github.job }}-${{ matrix.name }}-${{ hashFiles('**/Cargo.lock') }}
- name: Get available packages
run: echo "AVAILABLE_PACKAGES=$(cargo +stable run --bin=available_packages -- x86_64-apple-darwin)" >> $GITHUB_ENV
- name: cargo check
run: cargo check --target x86_64-apple-darwin $AVAILABLE_PACKAGES
env:
RUSTFLAGS: "--codegen=debuginfo=0 --allow=unknown_lints" # Removed --deny=warnings, added --allow=unknown_lints
ui:
name: Compiler UI
runs-on: ubuntu-latest
needs:
- fmt
- lint
env:
TRYBUILD: overwrite
steps:
- uses: actions/checkout@v6
with:
submodules: true
- name: Use nightly toolchain
run: |
rustup toolchain install ${{ env.CURRENT_NIGHTLY }} --profile=minimal --no-self-update
rustup override set ${{ env.CURRENT_NIGHTLY }}
- name: Add rust-src component to allow compiler UI to display sources
run: rustup component add rust-src
- name: Cache Cargo
uses: actions/cache@v6
with:
path: ${{ env.CARGO_CACHE_PATH }}
key: cargo-${{ github.job }}-${{ matrix.name }}-${{ hashFiles('**/Cargo.lock') }}
- name: Run UI tests
run: cargo run --features=run,gnustep-1-7 -ptest-ui --bin=test-ui
- name: Check diff
if: ${{ always() }}
run: git diff --exit-code
assembly:
name: Assembly tests
runs-on: ubuntu-latest
needs:
- fmt
- lint
env:
TEST_OVERWRITE: 1
steps:
- uses: actions/checkout@v6
with:
submodules: true
- name: Use nightly toolchain
run: |
rustup toolchain install ${{ env.CURRENT_NIGHTLY }} --profile=minimal --no-self-update
rustup override set ${{ env.CURRENT_NIGHTLY }}
- name: Add rust-src component for -Zbuild-std
run: rustup component add rust-src
- name: Cache Cargo
uses: actions/cache@v6
with:
path: ${{ env.CARGO_CACHE_PATH }}
key: cargo-${{ github.job }}-${{ matrix.name }}-${{ hashFiles('**/Cargo.lock') }}
- name: Run macOS x86_64 assembly tests
run: cargo run -ptest-assembly --bin=test-assembly -- -Z build-std --target=x86_64-apple-darwin --features=assembly-features
- name: Run all assembly tests
if: ${{ github.ref_name == 'ci-full' }}
run: ./crates/test-assembly/run-all.sh
- name: Check diff
if: ${{ always() }}
run: git diff --exit-code
header-translator:
name: Verify header translator output
runs-on: macos-26 # Aarch64
needs:
- fmt
- lint
env:
DEVELOPER_DIR: /Applications/Xcode_26.6.app/Contents/Developer
steps:
- uses: actions/checkout@v6
with:
submodules: true
- name: Use system Rust
run: rustup override set stable
- name: Install rustfmt
run: rustup component add rustfmt
- name: Cache Cargo
uses: actions/cache@v6
with:
path: ${{ env.CARGO_CACHE_PATH }}
key: cargo-${{ github.job }}-${{ matrix.name }}-${{ hashFiles('**/Cargo.lock') }}
- name: Run header translator tests
run: cargo test -pheader-translator -ptranslation-config
- name: Verify that all of Apple's frameworks are known to us
run: cargo run --bin=check_all_frameworks_known
- name: Run header translator
run: cargo run -pheader-translator --bin=header-translator --release all
- name: Verify that no files changed
run: git diff --exit-code --submodule=diff
- name: Run auto-generated framework tests
if: ${{ github.ref_name == 'ci-full' }}
run: cargo test -ptest-frameworks --features=test-frameworks --no-fail-fast
- name: Install Mac Catalyst
if: ${{ github.ref_name == 'ci-full' }}
run: rustup target add aarch64-apple-ios-macabi
- name: Run auto-generated framework tests on Mac Catalyst
if: ${{ github.ref_name == 'ci-full' }}
run: cargo test -ptest-frameworks --features=test-frameworks --no-fail-fast --target=aarch64-apple-ios-macabi
check-framework-features:
# This will take ~40 minutes
if: ${{ github.ref_name == 'ci-full' }}
name: Check framework features
runs-on: macos-15 # Aarch64
needs:
- fmt
- lint
steps:
- uses: actions/checkout@v6
with:
submodules: true
- name: Use system Rust
run: rustup override set stable
- name: Cache Cargo
uses: actions/cache@v6
with:
path: ${{ env.CARGO_CACHE_PATH }}
key: cargo-${{ github.job }}-${{ matrix.name }}-${{ hashFiles('**/Cargo.lock') }}
- name: Check frameworks with each feature enabled separately
run: cargo run --bin=check_framework_features
# We make sure to have at least one check on macOS that actually runs the code,
# but all other tests are only run if absolutely needed (see `test-apple` below).
test-macos:
name: Test macOS 15 Aarch64
runs-on: macos-15 # Aarch64
needs:
- fmt
# Currently the slowest check, so let's get it started as soon as possible
# - lint
steps:
- uses: actions/checkout@v6
with:
submodules: true
- name: Use nightly toolchain
run: |
rustup toolchain install ${{ env.CURRENT_NIGHTLY }} --profile=minimal --no-self-update
rustup override set ${{ env.CURRENT_NIGHTLY }}
- name: Cache Cargo
uses: actions/cache@v6
with:
path: ${{ env.CARGO_CACHE_PATH }}
key: cargo-${{ github.job }}-${{ matrix.name }}-${{ hashFiles('**/Cargo.lock') }}
- name: Get available packages
run: echo "AVAILABLE_PACKAGES=$(cargo run --bin=available_packages -- aarch64-apple-darwin 15.0)" >> $GITHUB_ENV
- name: Test without features
run: cargo test $PUBLIC_CRATES -ptests
- name: Test all macOS frameworks
run: cargo test $PUBLIC_CRATES $AVAILABLE_PACKAGES -ptests
- name: Run XCTest example
run: cargo run --bin run_xc_test -- default_xcode_game screenshot
- name: Ensure that XCTest successfully created screenshot.png
run: test -f ./screenshot.png
test-apple:
if: ${{ github.ref_name == 'ci-full' }}
name: ${{ matrix.no-run && 'Build' || 'Test' }} ${{ matrix.name }}
runs-on: ${{ matrix.os }}
needs:
- fmt
- lint
strategy:
# MacOS instances are rate-limited, which means that whenever we can
# avoid doing work, we should!
fail-fast: true
matrix:
include:
# Reasonably varied set of macOS targets.
- name: macOS 15 x86_64
target: x86_64-apple-darwin
os: macos-15-intel # x86_64
version: '15'
- name: macOS 26 AArch64
target: aarch64-apple-darwin
os: macos-26 # Aarch64
version: '26'
- name: macOS 14 Aarch64 nightly
target: aarch64-apple-darwin
os: macos-14 # Aarch64
version: '14'
nightly: true
# Old macOS targets.
- name: macOS 13 x86 with 10.13 SDK
target: i686-apple-darwin
# The SDK itself only supports compiling build scripts for x86_64
os: macos-15-intel # x86_64
version: '10.13'
nightly: true
build-std: true
# Newest SDK that supports 32-bit
sdk: "10.13"
no-run: true
- name: macOS 13 x86_64 with 10.12 SDK
target: x86_64-apple-darwin
os: macos-15-intel # x86_64
version: '10.12'
# Oldest macOS version we support.
# The SDK itself only supports compiling build scripts for x86_64.
sdk: "10.12"
# A reasonably varied set of iOS/tvOS/watchOS/visionOS targets.
- name: iOS Aarch64 simulator
target: aarch64-apple-ios-sim
os: macos-26 # Aarch64
version: '26'
simulator: "iPhone 17"
- name: iOS x86_64 simulator
target: x86_64-apple-ios
os: macos-15 # Aarch64, has to be older version to support x86_64 simulator
version: '17'
simulator: "iPad (10th generation)"
- name: Mac Catalyst Aarch64
target: aarch64-apple-ios-macabi
os: macos-26 # Aarch64
version: '26'
- name: visionOS Aarch64 simulator
target: aarch64-apple-visionos-sim
os: macos-26 # Aarch64
version: '26'
simulator: "Apple Vision Pro"
- name: tvOS Aarch64 simulator
target: aarch64-apple-tvos-sim
os: macos-26 # Aarch64
version: '26'
simulator: "Apple TV"
- name: watchOS ARM64_32
target: arm64_32-apple-watchos
os: macos-26 # Aarch64
version: '26'
nightly: true
build-std: true
no-run: true
- name: watchOS Aarch64 simulator
target: aarch64-apple-watchos-sim
os: macos-26 # Aarch64
version: '26'
# simulator: "Apple Watch SE 3 (40mm)"
no-run: true # Waiting on https://github.com/madsmtm/cargo-apple-runner/issues/14.
- name: iOS ARMv7s
target: armv7s-apple-ios
os: macos-14 # Aarch64
version: '10'
nightly: true
build-std: true
no-run: true
- name: iOS x86
target: i386-apple-ios
os: macos-14 # Aarch64
version: '10'
nightly: true
build-std: true
no-run: true
env:
CARGO_BUILD_TARGET: ${{ matrix.target }}
# Modern macOS can only run the target that they're built for.
# So we pass `--no-run` when building for other targets.
ARGS: >-
${{ matrix.build-std && '-Zbuild-std -Zdoctest-xcompile' }}
${{ matrix.no-run && '--no-run' || '' }}
# Mac Catalyst requires a higher version.
IPHONEOS_DEPLOYMENT_TARGET: ${{ contains(matrix.target, 'macabi') && '13.1' || '10.0' }}
CARGO_TARGET_X86_64_APPLE_IOS_RUNNER: cargo-apple-runner
CARGO_TARGET_AARCH64_APPLE_IOS_SIM_RUNNER: cargo-apple-runner
CARGO_TARGET_AARCH64_APPLE_TVOS_SIM_RUNNER: cargo-apple-runner
CARGO_TARGET_AARCH64_APPLE_VISIONOS_SIM_RUNNER: cargo-apple-runner
CARGO_TARGET_AARCH64_APPLE_WATCHOS_SIM_RUNNER: cargo-apple-runner
steps:
- uses: actions/checkout@v6
with:
submodules: true
- name: Use nightly toolchain
if: ${{ matrix.nightly }}
run: |
rustup toolchain install ${{ env.CURRENT_NIGHTLY }} --profile=minimal --no-self-update
rustup override set ${{ env.CURRENT_NIGHTLY }}
- name: Use stable toolchain
if: ${{ !matrix.nightly }}
run: rustup override set stable
- name: Add rust-src component for -Zbuild-std
if: matrix.build-std
run: rustup component add rust-src
- name: Install target
if: ${{ !matrix.build-std }}
run: rustup target add ${{ matrix.target }}
- name: Cache Cargo
uses: actions/cache@v6
with:
path: ${{ env.CARGO_CACHE_PATH }}
key: cargo-${{ github.job }}-${{ matrix.name }}-${{ hashFiles('**/Cargo.lock') }}
- name: Get available packages
run: echo "AVAILABLE_PACKAGES=$(cargo run --bin=available_packages --target $(rustc --print host-tuple) -- ${{ matrix.target }} ${{ matrix.version }})" >> $GITHUB_ENV
- name: Cache SDK
id: sdk-cache
if: matrix.sdk
uses: actions/cache@v6
with:
path: ~/sdk
key: sdk-test-apple-${{ matrix.name }}
- name: Download different macOS SDK
if: matrix.sdk && steps.sdk-cache.outputs.cache-hit != 'true'
# macOS SDKs:
# - https://github.com/alexey-lysiuk/macos-sdk
# - https://github.com/phracker/MacOSX-SDKs
# - https://github.com/hexops/sdk-macos-12.0
#
# iOS SDKs:
# - https://github.com/xybp888/iOS-SDKs
# - https://github.com/theos/sdks
#
# NOTE: These are non-official sources, and are only used to test
# older platforms.
run: |
wget https://github.com/alexey-lysiuk/macos-sdk/releases/download/${{ matrix.sdk }}/MacOSX${{ matrix.sdk }}.tar.bz2
tar -xyf MacOSX${{ matrix.sdk }}.tar.bz2
mv MacOSX${{ matrix.sdk }}.sdk $HOME/sdk
- name: Setup SDK environment
if: matrix.sdk
# This changes a variable, so is only set when a custom SDK is used
run: echo "SDKROOT=$HOME/sdk" >> $GITHUB_ENV
- name: Install `cargo-apple-runner`
if: ${{ matrix.simulator }}
uses: taiki-e/install-action@cargo-apple-runner
# You can find names of existing simulator devices at:
# https://github.com/actions/runner-images/blob/main/images/macos/macos-26-arm64-Readme.md#installed-simulators
- name: Start simulator
if: ${{ matrix.simulator }}
run: xcrun simctl boot "${{ matrix.simulator }}"
- name: Test without features
run: cargo test $ARGS $PUBLIC_CRATES -ptests
- name: Test Foundation
run: cargo test $ARGS $PUBLIC_CRATES -ptests -pobjc2-foundation
- name: Test all frameworks
run: cargo test $ARGS $AVAILABLE_PACKAGES -ptests --features=catch-all
- name: Test Foundation in release mode
run: cargo test $ARGS $PUBLIC_CRATES -ptests -pobjc2-foundation --features=catch-all --release
- name: Test Foundation with unstable features
if: ${{ matrix.nightly }}
run: cargo test $ARGS $PUBLIC_CRATES -ptests -pobjc2-foundation -pobjc2-core-foundation --features=catch-all ${{ matrix.sdk != '10.12' && '--features=unstable-simd --features=unstable-allocator-api' || '' }}
# TODO: Re-enable this on all of Foundation once we do some form of
# availability checking.
- name: Test static class and selectors with Clang naming
if: ${{ matrix.version == '15' }}
# TODO: Re-enable `unstable-static-nsstring` when it gets less broken.
run: >-
cargo test $ARGS -ptests -pobjc2-foundation
--no-default-features
--features=objc2/unstable-static-sel,objc2/unstable-static-class,objc2/unstable-clang-statics
--features=std,NSString
- name: Test static class and selectors with Rust naming
if: ${{ matrix.version == '15' }}
# TODO: Re-enable `unstable-static-nsstring` when it gets less broken.
run: >-
cargo test $ARGS -ptests -pobjc2-foundation
--no-default-features
--features=objc2/unstable-static-sel,objc2/unstable-static-class
--features=std,NSString
test-gnustep:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os || 'ubuntu-latest' }}
needs:
- fmt
- lint
strategy:
# GNUStep tests are currently flaky, this makes it easier to see
fail-fast: false
matrix:
include:
- name: Test GNUStep with libobjc2 v1.9
target: x86_64-unknown-linux-gnu
runtime: gnustep-1-9
libobjc2: "1.9"
# Fails for some reason on Ubuntu 22
# - name: Test GNUStep with libobjc2 v2.0
# os: ubuntu-20.04
# target: x86_64-unknown-linux-gnu
# runtime: gnustep-2-0
# libobjc2: "2.0"
- name: Test GNUStep with libobjc2 v2.1 on nightly
target: x86_64-unknown-linux-gnu
nightly: true
runtime: gnustep-2-1
libobjc2: "2.1"
# fuzz: true # Disable fuzzing for now, it fails because it tries to load all symbols in Foundation
# Ubuntu 22 image doesn't seem to have the required C++ libraries
# installed for 32-bit
# - name: Test GNUStep 32bit
# os: ubuntu-20.04
# target: i686-unknown-linux-gnu
# cflags: -m32
# configureflags: --target=x86-pc-linux-gnu
# runtime: gnustep-1-9
# libobjc2: "1.9"
env:
CARGO_BUILD_TARGET: ${{ matrix.target }}
CFLAGS: ${{ matrix.cflags }}
CXXFLAGS: ${{ matrix.cflags }}
ASMFLAGS: ${{ matrix.cflags }}
LDFLAGS: ${{ matrix.cflags }}
# http://wiki.gnustep.org/index.php/Building_GNUstep_under_Debian_FreeBSD#installing_gnustep-make
RUNTIME_VERSION: gnustep-${{ matrix.libobjc2 }}
# Exclude `objc2-exception-helper`, for some reason that can't be tested directly on GNUStep
PUBLIC_CRATES: >-
--package=dispatch2
--package=block2
--package=objc2
--package=objc2-encode
--package=objc2-proc-macros
steps:
- uses: actions/checkout@v6
with:
submodules: true
- name: Cache external dependencies
id: extern-cache
uses: actions/cache@v6
with:
# We could have just cached build-files, and then rerun the build tool
# every time, letting it figure out what's changed. However, this has
# the problem that GNUStep-Base ./configure invalidates the cache,
# which makes it very hard to know when to rebuild and when not to.
#
# So instead we just place the final outputs in ~/extern, and cache
# them there:
# - bin/*
# - lib/libobjc.so
# - lib/libgnustep-base.so
# - include/Foundation/*
# - include/objc/*
path: |
~/extern/bin
~/extern/lib
~/extern/include
# Change this key if we start caching more things
key: extern-${{ github.job }}-${{ matrix.name }}-v3
- name: Setup environment
# These add to PATH-like variables, so they can always be set
run: |
mkdir -p $HOME/extern/bin
mkdir -p $HOME/extern/lib
mkdir -p $HOME/extern/include
echo "PATH=$HOME/extern/bin:$PATH" >> $GITHUB_ENV
echo "LIBRARY_PATH=$HOME/extern/lib:$LIBRARY_PATH" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=$HOME/extern/lib:$LD_LIBRARY_PATH" >> $GITHUB_ENV
echo "CPATH=$HOME/extern/include:$CPATH" >> $GITHUB_ENV
# Debug print these
ls -al $HOME/extern/*
- name: Install Clang + Valgrind + TIFF
run: |
sudo apt-get update
sudo apt-get -y install clang valgrind libtiff-dev
- name: Install cross compilation tools
if: matrix.target == 'i686-unknown-linux-gnu'
run: |
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get -y install gcc-multilib libgcc-10-dev:i386 \
libc6-dev:i386 libstdc++-10-dev:i386 libffi-dev:i386 \
libxml2-dev:i386 libicu-dev:i386
- name: Install Make and Cmake
if: steps.extern-cache.outputs.cache-hit != 'true'
run: sudo apt-get -y install make cmake
- name: Install libdispatch
if: steps.extern-cache.outputs.cache-hit != 'true'
run: |
wget https://github.com/swiftlang/swift-corelibs-libdispatch/archive/refs/tags/swift-6.0.3-RELEASE.tar.gz
tar -xzf swift-6.0.3-RELEASE.tar.gz
cd swift-corelibs-libdispatch-swift-6.0.3-RELEASE
mkdir build
cd build
cmake -Wno-dev -DCMAKE_INSTALL_PREFIX=$HOME/extern ..
make install
ls -al $HOME/extern/*
- name: Install GNUStep libobjc2
if: steps.extern-cache.outputs.cache-hit != 'true'
run: |
wget https://github.com/gnustep/libobjc2/archive/refs/tags/v${{ matrix.libobjc2 }}.tar.gz
tar -xzf v${{ matrix.libobjc2 }}.tar.gz
# Install robin-map on v2.1
if test -d libobjc2-2.1; then
cd libobjc2-2.1/third_party
# Remove possibly existing `robin-map` folder
rm -rf robin-map
wget https://github.com/Tessil/robin-map/archive/757de829927489bee55ab02147484850c687b620.tar.gz
tar -xzf 757de829927489bee55ab02147484850c687b620.tar.gz
mv robin-map-757de829927489bee55ab02147484850c687b620 robin-map
cd ../..
fi
mkdir -p libobjc2-${{ matrix.libobjc2 }}/build
cd libobjc2-${{ matrix.libobjc2 }}/build
cmake -Wno-dev -DCMAKE_INSTALL_PREFIX=$HOME/extern -DTESTS=OFF ..
make install
- name: Install GNUStep make
if: steps.extern-cache.outputs.cache-hit != 'true'
run: |
wget https://github.com/gnustep/tools-make/archive/refs/tags/make-2_9_2.tar.gz
tar -xzf make-2_9_2.tar.gz
mkdir -p tools-make-make-2_9_2/build
cd tools-make-make-2_9_2/build
../configure --prefix=$HOME/extern --with-library-combo=ng-gnu-gnu
make install
- name: Install GNUStep base library
if: steps.extern-cache.outputs.cache-hit != 'true'
run: |
wget https://github.com/gnustep/libs-base/archive/refs/tags/base-1_30_0.tar.gz
tar -xzf base-1_30_0.tar.gz
cd libs-base-base-1_30_0
./configure --prefix=$HOME/extern --disable-tls --disable-xslt ${{ matrix.configureflags }}
make install
ls -al $HOME/extern/*
- name: Install GNUStep GUI
if: matrix.target == 'x86_64-unknown-linux-gnu' && steps.extern-cache.outputs.cache-hit != 'true'
run: |
wget https://github.com/gnustep/libs-gui/archive/refs/tags/gui-0_31_1.tar.gz
tar -xzf gui-0_31_1.tar.gz
cd libs-gui-gui-0_31_1
./configure --prefix=$HOME/extern --disable-jpeg ${{ matrix.configureflags }}
make install
ls -al $HOME/extern/*
- name: Use nightly toolchain
if: ${{ matrix.nightly }}
run: |
rustup toolchain install ${{ env.CURRENT_NIGHTLY }} --profile=minimal --no-self-update
rustup override set ${{ env.CURRENT_NIGHTLY }}
- name: Use stable toolchain
if: ${{ !matrix.nightly }}
run: rustup override set stable
- name: Install target
if: ${{ matrix.target }}
run: rustup target add ${{ matrix.target }}
- name: Cache Cargo
uses: actions/cache@v6
with:
path: ${{ env.CARGO_CACHE_PATH }}
key: cargo-${{ github.job }}-${{ matrix.name }}-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo-fuzz
if: ${{ matrix.fuzz }}
id: fuzz-cache
uses: actions/cache@v6
with:
path: ~/.cargo/bin/cargo-fuzz
# Change this key if we update the required cargo-fuzz version
key: cargo-fuzz-${{ github.job }}-${{ matrix.name }}-v0-11-2
- name: Install cargo-fuzz
if: ${{ matrix.fuzz && steps.fuzz-cache.outputs.cache-hit != 'true' }}
run: cargo install cargo-fuzz --version=^0.11.2
- name: Test Foundation
run: cargo test --features=${{ matrix.runtime }} $PUBLIC_CRATES -ptests -pobjc2-foundation --features=catch-all
- name: Test all frameworks
if: ${{ github.ref_name == 'ci-full' && matrix.target == 'x86_64-unknown-linux-gnu' }}
run: cargo test --features=${{ matrix.runtime }} $PUBLIC_CRATES -ptests $(cargo run --bin=available_packages -- ${{ matrix.target }}) --features=catch-all
- name: Test in release mode
# Disabled on GNUStep 2.1 for now
if: ${{ github.ref_name == 'ci-full' && matrix.runtime != 'gnustep-2-1' }}
run: cargo test --features=${{ matrix.runtime }} $PUBLIC_CRATES -pobjc2-foundation --release
- name: Run fuzzing
if: ${{ matrix.fuzz }}
run: |
# Run each fuzz target for 100000 runs (approx. 5 seconds), and
# timeout after 2 seconds.
#
# We specify the number of runs explicitly instead of using
# `max_total_time`, to get more determinism.
for fuzz_target in $(cargo-fuzz list --fuzz-dir=./crates/test-fuzz/)
do
echo "Fuzzing $fuzz_target"
cargo-fuzz run --fuzz-dir=./crates/test-fuzz/ $fuzz_target --features=${{ matrix.runtime }},fuzz-all -- -runs=10000 -timeout=2 -jobs=10
done
# Check if the fuzzer encountered something that should be added to
# the corpus.
git diff --exit-code
- name: Run benchmarks
# Disabled since it started failing for some reason
if: ${{ false }}
# Difficult to install Valgrind on macOS
# See https://github.com/LouisBrunner/valgrind-macos
run: cargo bench --features=${{ matrix.runtime }}
test-compiler-rt:
name: Test Compiler-RT
runs-on: ubuntu-latest
needs:
- fmt
- lint
env:
# `compiler-rt` is only relevant for block2
PUBLIC_CRATES: --package=block2
steps:
- uses: actions/checkout@v6
with:
submodules: true
- name: Use system Rust
run: rustup override set stable
- name: Cache Cargo
uses: actions/cache@v6
with:
path: ${{ env.CARGO_CACHE_PATH }}
key: cargo-${{ github.job }}-${{ matrix.name }}-${{ hashFiles('**/Cargo.lock') }}
- name: Install clang + libBlocksRuntime
run: |
sudo apt-get update
sudo apt-get -y install clang libblocksruntime-dev
- name: Test
run: cargo test $PUBLIC_CRATES --features=compiler-rt
- name: Test in release mode
run: cargo test $PUBLIC_CRATES --features=compiler-rt --release