Skip to content

Update CI configuration for improved build and test processes #260

Update CI configuration for improved build and test processes

Update CI configuration for improved build and test processes #260

Workflow file for this run

name: Test
on:
push:
branches:
- '*'
tags-ignore:
- 'v*'
pull_request:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
test:
strategy:
fail-fast: false
matrix:
# setup different OS and targets
include:
- name: x86_64-ubuntu-20
os: ubuntu-20.04
target-cpu: x86-64
target: x86_64-unknown-linux-gnu
nuget-rid: linux-x64
- name: x86_64-ubuntu-22
os: ubuntu-22.04
target-cpu: x86-64
target: x86_64-unknown-linux-gnu
nuget-rid: linux-x64
- name: x86_64-windows
os: windows-2022
target-cpu: x86-64
target: x86_64-pc-windows-msvc
nuget-rid: win-x64
- name: x86_64-macos-13
os: macos-13
target-cpu: haswell
target: x86_64-apple-darwin
nuget-rid: osx-x64
- name: ARM64-macos-14
os: macos-14
target-cpu: apple-m1
target: aarch64-apple-darwin
nuget-rid: osx-arm64
- name: ARM64-ubuntu-24
os: ubuntu-24-arm-32gb
target-cpu: generic
target: aarch64-unknown-linux-gnu
features: neon
cross: 'true'
nuget-rid: linux-arm64
- name: win32
os: windows-2022
target: i686-pc-windows-msvc
cross: 'true'
nuget-rid: win-x86
- name: x64-linux-musl
os: ubuntu-24.04
target-cpu: x86-64
target: x86_64-unknown-linux-musl
target-feature: +crt-static
features: mimalloc
cross: 'true'
nuget-rid: linux-x64
# todo target: aarch64-pc-windows-msvc instead of in test_woa.yml (once an official image is released)
# todo: Someday rewrite imageflow for wasm32-unknown-emscripten
# todo: Won't pass tests due to https://github.com/NoXF/libwebp-sys/issues/36
- name: arm64-linux-musl
os: ubuntu-24-arm-32gb # ubuntu-24.04 # cross doesn't support ubuntu-24-arm-32gb
target-cpu: generic
target-feature: +crt-static
target: aarch64-unknown-linux-musl
features: mimalloc
cross: 'true'
nuget-rid: linux-arm64
runs-on: ${{matrix.os}}
name: "${{ (matrix.cross == 'true') && 'cross ' || ''}}${{ matrix.name }}${{ matrix.target-cpu && format(' cpu: {0}', matrix.target-cpu) }}${{ matrix.target && format(' target: {0}', matrix.target) }}${{ matrix.features && format(' features: {0}', matrix.features) }} runs-on:${{ matrix.os }}"
steps:
- run: rustup show
- name: Checkout code
uses: actions/checkout@v4
# matrix item NOT using cross
- uses: Swatinem/rust-cache@v2
with:
key: ${{matrix.name}}
if: matrix.cross != 'true'
- uses: dtolnay/rust-toolchain@stable
if: matrix.cross != 'true'
- run: rustup show
- name: Install NASM
uses: ./.github/actions/install-nasm
if: matrix.cross != 'true'
- name: Set ENV vars TARGET_DIR, REL_BINARIES_DIR, RUSTFLAGS
shell: bash
run: |
echo "TARGET_DIR=target/${{ matrix.target }}/" >> $GITHUB_ENV
echo "REL_BINARIES_DIR=target/${{ matrix.target }}/release/" >> $GITHUB_ENV
echo "RUSTFLAGS=${{ matrix.target-cpu && format('-C target-cpu={0}',matrix.target-cpu) }} ${{ matrix.target-feature && format('-C target-feature={0}',matrix.target-feature) }}" >> $GITHUB_ENV
- name: Test
run: cargo test --all --locked --target ${{ matrix.target }} --release ${{ matrix.features && format('--features={0}',matrix.features) }}
shell: bash
if: matrix.cross != 'true'
# matrix items USING CROSS
- name: Cross Test
uses: houseabsolute/[email protected]
env:
RUSTFLAGS: ${{ env.RUSTFLAGS }}
with:
command: "test"
target: ${{ matrix.target }}
toolchain: stable
args:
"--locked --release ${{ matrix.features && format('--features={0}',matrix.features) }}"
if: matrix.cross == 'true'