Skip to content

More clarifications #145

More clarifications

More clarifications #145

Workflow file for this run

# There are two kinds of continuous integration jobs in this project:
#
# - Every code submission or master push passes continuous integration on the
# minimal supported Rust version and the current stable Rust version.
# - Two times a month, a scheduled job makes sure that the code remains
# compatible and lint-free on upcoming Rust toolchains (beta and nightly).
on:
push:
pull_request:
schedule:
- cron: '0 0 4,18 * *'
name: Continuous Integration
env:
RUSTFLAGS: '-D warnings'
HWLOC_VERSION: '2.9.1'
HWLOC_VERSION_SHORT: '2.9' # Used in URL to official tarball/binaries
jobs:
# Formatter output doesn't depend on cargo features, and only needs to be
# tested on the latest supported release of each CI run.
format:
# Only run on "pull_request" event for external PRs. This is to avoid
# duplicate builds for PRs created from internal branches.
if: github.event_name == 'push' || github.event_name == 'schedule' || github.event.pull_request.head.repo.full_name != github.repository
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Set up stable toolchain
if: github.event_name != 'schedule'
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: rustfmt
- name: Set up nightly toolchain
if: github.event_name == 'schedule'
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: nightly
components: rustfmt
- name: Check format
run: cargo fmt --all -- --check
# Clippy and rustc lints depend on cfg(), of which we currently use "feature"
# and "target_os". So far, hwlocality has Linux- and Windows-specific code,
# but nothing macOS-specific, so we can cover all configurations by testing on
# Linux and Windows.
#
# We don't care about warnings on the minimum supported Rust version, only
# about building and running correctly, so we can get away with only testing
# on the latest rustc release.
lints:
# Only run on "pull_request" event for external PRs. This is to avoid
# duplicate builds for PRs created from internal branches.
if: github.event_name == 'push' || github.event_name == 'schedule' || github.event.pull_request.head.repo.full_name != github.repository
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-latest
- windows-latest
features:
- ''
- '--features=hwloc-2_0_4'
- '--features=hwloc-2_1_0'
- '--features=hwloc-2_2_0'
- '--features=hwloc-2_3_0'
- '--features=hwloc-2_4_0'
- '--features=hwloc-2_5_0'
- '--features=hwloc-2_8_0'
- '--features=hwloc-latest'
- '--features=hwloc-latest,quickcheck'
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Set up stable toolchain
if: github.event_name != 'schedule'
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: clippy
- name: Set up nightly toolchain
if: github.event_name == 'schedule'
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: nightly
components: clippy
- name: Set up hwloc dependencies
uses: ./.github/actions/setup-hwloc-dependencies
with:
hwloc-version: ${{ env.HWLOC_VERSION }}
hwloc-version-short: ${{ env.HWLOC_VERSION_SHORT }}
- name: Check clippy lints
run: cargo clippy --all-targets ${{ matrix.features }} -- -D warnings
- name: Build docs
run: cargo doc ${{ matrix.features }}
# Run the tests and examples on all supported OSes and Rust versions (main CI)
#
# FIXME: In an ideal world, it would be enough to test on the first and last
# version of each major hwloc series, as within each series versions
# are additive and almost solely (*cough cough* add_distances *cough
# cough*) add new features to test without removing any.
#
# Unfortunately, `cargo check` does not currently check doctests
# (see https://github.com/rust-lang/cargo/issues/6424 ), so we need to
# test each version individually to make sure that doctests for a
# feature coming from one hwloc version do not use features from newer
# hwloc versions (which would force people to needlessly up their hwloc
# version requirements if they want to follow the doc examples).
test-contrib:
# Only run on "pull_request" event for external PRs. This is to avoid
# duplicate builds for PRs created from internal branches.
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
rust:
- stable
- 1.67.1 # Minimum supported Rust version
features:
- ''
- '--features=hwloc-2_0_4'
- '--features=hwloc-2_1_0'
- '--features=hwloc-2_2_0'
- '--features=hwloc-2_3_0'
- '--features=hwloc-2_4_0'
- '--features=hwloc-2_5_0'
- '--features=hwloc-2_8_0'
- '--features=hwloc-latest'
- '--features=hwloc-latest,quickcheck'
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Set up toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: ${{ matrix.rust }}
- name: Set up hwloc dependencies
uses: ./.github/actions/setup-hwloc-dependencies
with:
hwloc-version: ${{ env.HWLOC_VERSION }}
hwloc-version-short: ${{ env.HWLOC_VERSION_SHORT }}
- name: Collect system information
uses: ./.github/actions/system-information
- name: Run basic tests
run: cargo test ${{ matrix.features }}
- name: Install cargo-examples
uses: baptiste0928/cargo-install@v2
with:
crate: cargo-examples
- name: Run all examples
run: cargo examples ${{ matrix.features }}
# Check compatibility with newer Rust/deps versions (scheduled CI)
#
# FIXME: There should be a way to use conditional build matrices without
# duplicating the whole job recipe...
#
test-scheduled:
if: github.event_name == 'schedule'
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
rust:
- beta
- nightly
- 1.67.1 # Minimum supported Rust version (can be broken by deps)
features:
- ''
- '--features=hwloc-2_0_4'
- '--features=hwloc-2_1_0'
- '--features=hwloc-2_2_0'
- '--features=hwloc-2_3_0'
- '--features=hwloc-2_4_0'
- '--features=hwloc-2_5_0'
- '--features=hwloc-2_8_0'
- '--features=hwloc-latest'
- '--features=hwloc-latest,quickcheck'
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Set up toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: ${{ matrix.rust }}
- name: Set up hwloc dependencies
uses: ./.github/actions/setup-hwloc-dependencies
with:
hwloc-version: ${{ env.HWLOC_VERSION }}
hwloc-version-short: ${{ env.HWLOC_VERSION_SHORT }}
- name: Collect system information
uses: ./.github/actions/system-information
- name: Run basic tests
run: cargo test ${{ matrix.features }}
- name: Install cargo-examples
uses: baptiste0928/cargo-install@v2
with:
crate: cargo-examples
- name: Run all examples
run: cargo examples ${{ matrix.features }}