Skip to content

Add ua::Array::into_array() helper #386

Add ua::Array::into_array() helper

Add ua::Array::into_array() helper #386

Workflow file for this run

# yaml-language-server: $schema=https://json.schemastore.org/github-workflow
name: test
permissions:
contents: read
on:
pull_request:
push:
branches:
- main
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_INCREMENTAL: 0
CARGO_TERM_COLOR: always
RUST_BACKTRACE: short
jobs:
run:
strategy:
fail-fast: false # don't give up on the whole matrix if one variant fails
matrix:
# Keep list of targets in sync with `latest-dependencies.yaml`.
include:
- target: aarch64-apple-darwin
# M1 runner on macos-14
runner_os: macos-14
default_target: true
runnable: true
- target: armv7-unknown-linux-gnueabihf
runner_os: ubuntu-latest
default_target: false
runnable: false
- target: x86_64-apple-darwin
runner_os: macos-latest
default_target: true
runnable: true
- target: x86_64-pc-windows-msvc
runner_os: windows-latest
default_target: true
runnable: true
- target: x86_64-unknown-linux-gnu
runner_os: ubuntu-latest
default_target: true
runnable: true
- target: x86_64-unknown-linux-musl
runner_os: ubuntu-latest
default_target: false
runnable: true
runs-on: ${{ matrix.runner_os }}
steps:
- name: Install build tools for musl libc
if: endsWith(matrix.target, '-musl')
# To avoid HTTP 404 when package index has been updated, we run `update` first.
run: >-
sudo apt -y update &&
sudo apt -y install musl-tools
- name: Install build tools for ARMv7
if: startsWith(matrix.target, 'armv7-')
# To avoid HTTP 404 when package index has been updated, we run `update` first.
run: >-
sudo apt -y update &&
sudo apt -y install gcc-arm-linux-gnueabihf
- name: Adjust build settings for Windows
if: contains(matrix.target, '-windows-')
# Required for Windows builds: for version numbers with pre-release part
# as suffix, the resulting paths would get too long to build otherwise.
run: >-
echo "CARGO_TARGET_DIR=D:\t" >> $env:GITHUB_ENV
- name: Install Rust toolchain
# Use specific Rust version that is the minimum supported `rust-version`
# (MSRV) from `Cargo.toml`.
uses: dtolnay/rust-toolchain@1.77
with:
# This target also needs to be specified explicitly in every build step!
# Otherwise the default toolchain might be used unintentionally.
targets: ${{ matrix.target }}
- name: Install Cargo helpers
run: >-
cargo install cargo-hack
# Check out the repository before the remaining steps that depend on it.
# All preceding steps are independent of the repository contents.
- name: Check out repository
uses: actions/checkout@v4
- name: Cache Rust toolchain and build artifacts
uses: Swatinem/rust-cache@v2
with:
# The cache should not be shared between different workflows, jobs, and targets.
shared-key: ${{ github.workflow }}-${{ github.job }}-${{ matrix.target }}
- name: Build with feature combinations
run: >-
cargo hack --each-feature build --locked
--target ${{ matrix.target }}
- name: Run tests (bins/lib/tests/examples) with feature combinations
if: matrix.runnable
run: >-
cargo hack --each-feature test --locked
--target ${{ matrix.target }}
--bins --lib --tests --examples
# Compile and run doctests, which have been excluded in the previous
# step(s).
#
# Doctests may use any features and there is no easy way to activate
# certain features only for some doctests, so we run them without
# `cargo-hack`.
#
# When cross-compiling the doctests are skipped silently, even with the
# default target options that should include them!
#
# See https://github.com/rust-lang/cargo/issues/7040 for an (unstable)
# feature flag that should one day allow us to cross-compile doctests.
#
# For now, we cannot cross-compile doctests and must always run them on
# the runner's native platform.
- name: Run doctests with all features enabled
if: matrix.default_target
run: >-
cargo test --locked --all-features
--doc
- name: Build package with all features enabled
run: >-
cargo package --locked --all-features
--target ${{ matrix.target }}