ci #337
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# SPDX-License-Identifier: MIT | |
name: ci | |
on: | |
push: | |
pull_request: | |
schedule: | |
- cron: "0 4 * * *" | |
permissions: | |
contents: read | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
test: | |
name: Build and run tests (rust ${{ matrix.rust }}) | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
rust: | |
- stable | |
- beta | |
- nightly | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Install Rust | |
run: | | |
rm -f ~/.cargo/bin/*fmt ~/.cargo/bin/rust-analyzer | |
curl https://sh.rustup.rs -sSf | sh -s -- -y | |
- name: Install toolchain | |
run: | | |
rustup toolchain install ${{ matrix.rust }} | |
rustup default ${{ matrix.rust }} | |
- name: Build | |
run: cargo build --release --verbose | |
- name: Run check | |
run: cargo check --release --verbose | |
- name: Run tests | |
run: cargo test --release --verbose | |
# Do a tests with and without -j, because the internal modes of operation are quite different | |
- name: Simulate package processing without -j | |
if: ${{ matrix.rust == 'nightly' }} | |
run: | | |
mkdir /var/tmp/buildroot-1 | |
cp -a tests/cases /var/tmp/buildroot-1 | |
RPM_BUILD_ROOT=/var/tmp/buildroot-1 target/release/add-determinism --brp /var/tmp/buildroot-1/ --handler=-pyc | |
- name: Simulate package processing with -j | |
if: ${{ matrix.rust == 'stable' }} | |
run: | | |
mkdir /var/tmp/buildroot-2 | |
cp -a tests/cases /var/tmp/buildroot-2 | |
RPM_BUILD_ROOT=/var/tmp/buildroot-2 target/release/add-determinism -j4 --brp /var/tmp/buildroot-2 | |
- name: Simulate package processing with --check | |
if: ${{ matrix.rust == 'stable' }} | |
run: | | |
RPM_BUILD_ROOT=/var/tmp/buildroot-2 target/release/add-determinism -j4 --brp /var/tmp/buildroot-2 --check | |
clippy: | |
name: clippy | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Install Rust | |
run: | | |
rm -f ~/.cargo/bin/*fmt ~/.cargo/bin/rust-analyzer | |
curl https://sh.rustup.rs -sSf | sh -s -- -y | |
- name: Install toolchain | |
run: | | |
rustup toolchain install nightly | |
rustup default nightly | |
- name: Validate clippy | |
run: cargo clippy -- -D warnings |