Skip to content

Update readme with TOML #28

Update readme with TOML

Update readme with TOML #28

Workflow file for this run

name: CI
permissions: {}
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
env:
CARGO_TERM_COLOR: always
RUSTDOCFLAGS: -D warnings
RUSTFLAGS: -D warnings
# Ubuntu versions: https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources
jobs:
commit_list:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get commit list (push)
id: get_commit_list_push
if: ${{ github.event_name == 'push' }}
run: |
echo "id0=$GITHUB_SHA" > $GITHUB_OUTPUT
echo "List of tested commits:" > $GITHUB_STEP_SUMMARY
sed -n 's,^id[0-9]\+=\(.*\),- https://github.com/landlock-lsm/landlockconfig/commit/\1,p' -- $GITHUB_OUTPUT >> $GITHUB_STEP_SUMMARY
- name: Get commit list (PR)
id: get_commit_list_pr
if: ${{ github.event_name == 'pull_request' }}
run: |
git rev-list --reverse refs/remotes/origin/${{ github.base_ref }}..${{ github.event.pull_request.head.sha }} | awk '{ print "id" NR "=" $1 }' > $GITHUB_OUTPUT
git diff --quiet ${{ github.event.pull_request.head.sha }} ${{ github.sha }} || echo "id0=$GITHUB_SHA" >> $GITHUB_OUTPUT
echo "List of tested commits:" > $GITHUB_STEP_SUMMARY
sed -n 's,^id[0-9]\+=\(.*\),- https://github.com/landlock-lsm/landlockconfig/commit/\1,p' -- $GITHUB_OUTPUT >> $GITHUB_STEP_SUMMARY
outputs:
commits: ${{ toJSON(steps.*.outputs.*) }}
ubuntu_24_json:
runs-on: ubuntu-24.04
needs: commit_list
strategy:
fail-fast: false
matrix:
commit: ${{ fromJSON(needs.commit_list.outputs.commits) }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ matrix.commit }}
- name: Install check-jsonschema
run: pipx install check-jsonschema
- name: Check schema format
run: diff -u ./schema/landlockconfig.json <(jq < ./schema/landlockconfig.json)
- name: Check JSON mini
run: ./schema/check.sh examples/mini-write-tmp.json
- name: Check JSON verbose
run: ./schema/check.sh examples/verbose-write-tmp.json
ubuntu_24_rust_msrv:
runs-on: ubuntu-24.04
needs: commit_list
strategy:
fail-fast: false
matrix:
commit: ${{ fromJSON(needs.commit_list.outputs.commits) }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ matrix.commit }}
- name: Get MSRV
run: sed -n 's/^rust-version = "\([0-9.]\+\)"$/RUST_TOOLCHAIN=\1/p' Cargo.toml >> $GITHUB_ENV
- name: Install Rust MSRV
run: |
rm ~/.cargo/bin/{cargo-fmt,rustfmt} || :
rustup default ${{ env.RUST_TOOLCHAIN }}
rustup update ${{ env.RUST_TOOLCHAIN }}
- name: Build
run: rustup run ${{ env.RUST_TOOLCHAIN }} cargo build --verbose
- name: Build tests
run: rustup run ${{ env.RUST_TOOLCHAIN }} cargo build --tests --verbose
- name: Run tests
run: rustup run ${{ env.RUST_TOOLCHAIN }} cargo test --verbose
- name: Build examples
run: rustup run ${{ env.RUST_TOOLCHAIN }} cargo build --examples --verbose
- name: Run the sandboxer example with JSON
run: rustup run ${{ env.RUST_TOOLCHAIN }} cargo run --example sandboxer -- --json examples/mini-write-tmp.json true
- name: Run the sandboxer example with TOML
run: rustup run ${{ env.RUST_TOOLCHAIN }} cargo run --example sandboxer -- --toml examples/mini-write-tmp.toml true
ubuntu_24_rust_stable:
runs-on: ubuntu-24.04
needs: commit_list
strategy:
fail-fast: false
matrix:
commit: ${{ fromJSON(needs.commit_list.outputs.commits) }}
steps:
- name: Install Rust stable
run: |
rm ~/.cargo/bin/{cargo-fmt,rustfmt} || :
rustup default stable
rustup component add rustfmt clippy
rustup update
- uses: actions/checkout@v4
with:
ref: ${{ matrix.commit }}
- name: Build
run: rustup run stable cargo build --verbose
- name: Build examples
run: rustup run stable cargo build --examples --verbose
- name: Run tests
run: rustup run stable cargo test --verbose
- name: Run the sandboxer example with JSON
run: rustup run stable cargo run --example sandboxer -- --json examples/mini-write-tmp.json true
- name: Run the sandboxer example with TOML
run: rustup run stable cargo run --example sandboxer -- --toml examples/mini-write-tmp.toml true
- name: Check format
run: rustup run stable cargo fmt --all -- --check
- name: Check source with Clippy
run: rustup run stable cargo clippy -- --deny warnings
- name: Check tests with Clippy
run: rustup run stable cargo clippy --tests -- --deny warnings
- name: Check examples with Clippy
run: rustup run stable cargo clippy --examples -- --deny warnings
- name: Check documentation
run: rustup run stable cargo doc --no-deps