Skip to content

CI

CI #297

Workflow file for this run

name: CI
on:
pull_request:
push:
branches:
- main
schedule:
# Force a run every day at 0007 UTC
- cron: '00 07 * * *'
env:
CI: '1'
CARGO_TERM_COLOR: 'always'
# Emit backtraces on panics (though these may be worthless without debug info).
RUST_BACKTRACE: '1'
# Disable incremental builds; see https://matklad.github.io/2021/09/04/fast-rust-builds.html:
#
# CI builds often are closer to from-scratch builds, as changes are typically much bigger than from a local edit-compile cycle.
# For from-scratch builds, incremental adds an extra dependency-tracking overhead.
# It also significantly increases the amount of IO and the size of ./target, which make caching less effective.
CARGO_INCREMENTAL: '0'
# Disable debug info in CI; speeds up builds and shrinks Actions caches a bit
CARGO_PROFILE_RELEASE_DEBUG: '0'
CARGO_PROFILE_DEV_DEBUG: '0'
CARGO_PROFILE_TEST_DEBUG: '0'
# Enable Cargo output explaining why things are being rebuilt.
# This can be useful to investigate why caching is not working as expected.
#
# https://stackoverflow.com/a/70174212
# https://doc.crates.io/contrib/implementation/debugging.html#logging
# CARGO_LOG: 'cargo::core::compiler::fingerprint=info'
jobs:
tests:
name: CI (${{ matrix.name }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- name: ubuntu-20.04.x86_64.release
os: ubuntu-20.04
rust: stable
profile: release
features: unit_hyperscan
install_dependencies: |
sudo apt-get install zsh libboost-all-dev
check_docs: false
use_ninja: false
- name: ubuntu-22.04.x86_64.test
os: ubuntu-22.04
rust: stable
profile: test
features: unit_hyperscan
install_dependencies: |
sudo apt-get install zsh libboost-all-dev
check_docs: true
use_ninja: false
- name: ubuntu-22.04.x86_64.release.cpu_native
os: ubuntu-22.04
rust: stable
profile: release
features: unit_hyperscan,cpu_native
install_dependencies: |
sudo apt-get install zsh libboost-all-dev
check_docs: false
use_ninja: false
- name: ubuntu-24.04.x86_64.test
os: ubuntu-24.04
rust: stable
profile: test
features: unit_hyperscan
install_dependencies: |
sudo apt-get install zsh libboost-all-dev
check_docs: true
use_ninja: false
- name: macos-13.x86_64.test
os: macos-13
rust: stable
profile: test
features: unit_hyperscan
install_dependencies: |
brew install coreutils boost ninja
check_docs: false
use_ninja: true
- name: macos-13.x86_64.release
os: macos-13
rust: stable
profile: release
features: unit_hyperscan
install_dependencies: |
brew install coreutils boost
check_docs: false
use_ninja: false
# Fails with `unknown target CPU 'x86_64_v2'`:
#
# - name: macos-13.x86_64.release.cpu_native
# os: macos-13
# rust: stable
# profile: release
# features: unit_hyperscan,cpu_native
# install_dependencies: |
# brew install coreutils boost ninja
# check_docs: false
# use_ninja: true
- name: macos-14.arm64.test
os: macos-14 # m1-based macos
rust: stable
profile: test
features: unit_hyperscan
install_dependencies: |
brew install coreutils boost ninja
check_docs: false
use_ninja: true
- name: macos-14.arm64.release
os: macos-14 # m1-based macos
rust: stable
profile: release
features: unit_hyperscan
install_dependencies: |
brew install coreutils boost ninja
check_docs: false
use_ninja: true
# A build that runs with `bindgen` enabled
- name: macos-14.arm64.gen.release
os: macos-14 # m1-based macos
rust: stable
profile: release
features: unit_hyperscan,gen
install_dependencies: |
brew install coreutils boost ninja
check_docs: false
use_ninja: true
- name: macos-14.arm64.release.cpu_native
os: macos-14 # m1-based macos
rust: stable
profile: release
features: unit_hyperscan,cpu_native
install_dependencies: |
brew install coreutils boost ninja
check_docs: false
use_ninja: true
# Fails:
#
# - name: windows-2022.x86_64.test
# os: windows-2022
# rust: stable
# profile: test
# features: unit_hyperscan
# install_dependencies: |
# check_docs: false
# use_ninja: false
env:
CMAKE_GENERATOR: ${{ (matrix.use_ninja && 'Ninja') || 'Unix Makefiles' }}
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Install dependencies
run: ${{ matrix.install_dependencies }}
- name: Install Rust toolchain
id: install-rust-toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
# N.B. cache disabled since certain build configurations end up producing
# microarchitecture-specific code that is not portable across CPUs
# generally
# - name: Cache
# uses: Swatinem/rust-cache@v2
# with:
# prefix-key: 'ci-tests'
# key: ${{ matrix.name }}
- name: Build tests
run: cargo test --no-run -vv --profile=${{ matrix.profile }} --features=${{ matrix.features }} --timings
- name: Run tests
run: cargo test -vv --profile=${{ matrix.profile }} --features=${{ matrix.features }} --timings
- name: Check documentation
if: ${{ matrix.check_docs }}
env:
RUSTDOCFLAGS: -D warnings
run: cargo doc --verbose --profile=${{ matrix.profile }} --features=${{ matrix.features }} --timings --no-deps --document-private-items
# See https://doc.rust-lang.org/nightly/cargo/reference/timings.html for details
- name: Upload build timings
uses: actions/upload-artifact@v4
with:
name: build-timings.${{ matrix.name }}
path: target/cargo-timings
if-no-files-found: error