Skip to content

test: Use the bash container and a matrix strategy for bash versions #1116

test: Use the bash container and a matrix strategy for bash versions

test: Use the bash container and a matrix strategy for bash versions #1116

Workflow file for this run

name: Cargo & Clippy Test

Check failure on line 1 in .github/workflows/rust.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/rust.yml

Invalid workflow file

No steps defined in `steps` and no workflow called in `uses` for the following jobs: matrix
on:
push:
branches: [master]
paths:
- src/**
- test_files/**
- .cargo/**
- Cargo.toml
- Cargo.lock
- rust-toolchain.toml
- flake.nix
- flake.lock
pull_request:
paths:
- src/**
- test_files/**
- .cargo/**
- Cargo.toml
- Cargo.lock
- rust-toolchain.toml
- flake.nix
- flake.lock
env:
CARGO_TERM_COLOR: always
jobs:
matrix:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
sed:
- "GNU"
bash_version:
- "5.3"
- "5.2"
- "5.1"
- "5.0"
- "4.4"
- "4.3"
- "4.2"
- "4.1"
- "4.0"
include:
- sed: BusyBox
bash_version: "latest"
build_and_test:
name: Rust and clippy tests
runs-on: ubuntu-latest
needs: matrix
if: ${{ ( matrix.sed == "GNU" && matrix.bash_version != "BusyBox" ) || ( matrix.sed == "BusyBox" && matrix.bash_version == "BusyBox" ) }}
steps:
- uses: actions/checkout@v4
- uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: bc shfmt
version: 1.0
- name: Install bshchk
run: |
sudo curl https://github.com/b1ek/bshchk/releases/download/1.1/bshchk.linux.amd64 -L -o /usr/bin/bshchk
sudo chmod +x /usr/bin/bshchk
- uses: dtolnay/rust-toolchain@stable
- name: Cache dependencies installed with cargo
uses: actions/cache@v4
with:
path: |
./target/deps
~/.cargo
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-
- name: Build binary
# the binary will be used by the next cargo test step
run: cargo build
- run: |
bash --version
cargo run -- build src/tests/stdlib/replace.ab -
- name: Run cargo tests
env:
GITHUB_ACTIONS_BASH_CONTAINER: 1
run: |
docker run --volume $PWD:/root --network host --detach --name bash bash:${{ matrix.bash_version }} sleep infinity
# coreutils includes mktemp
docker exec bash apk add coreutils curl
if "${{ matrix.sed }}" == "GNU"; then
docker exec bash apk add sed
fi
cargo test --all-targets --all-features
docker rm --force bash
- name: Run clippy check
run: cargo clippy --all-targets --all-features -- -D warnings