Improve CI to test all meaningful kernels #200
Workflow file for this run
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
name: Rust checks | |
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-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
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/rust-landlock/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/rust-landlock/commit/\1,p' -- $GITHUB_OUTPUT >> $GITHUB_STEP_SUMMARY | |
outputs: | |
commits: ${{ toJSON(steps.*.outputs.*) }} | |
ubuntu_22_rust_stable: | |
runs-on: ubuntu-22.04 | |
needs: commit_list | |
strategy: | |
fail-fast: false | |
matrix: | |
commit: ${{ fromJSON(needs.commit_list.outputs.commits) }} | |
env: | |
LANDLOCK_CRATE_TEST_ABI: 1 | |
CARGO: rustup run stable cargo | |
steps: | |
- name: Install Rust stable | |
run: | | |
rm ~/.cargo/bin/{cargo-fmt,rustfmt} || : | |
rustup default stable | |
rustup update | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ matrix.commit }} | |
- name: Clone Landlock test tools | |
uses: actions/checkout@v3 | |
with: | |
repository: landlock-lsm/landlock-test-tools | |
path: landlock-test-tools | |
fetch-depth: 0 | |
ref: test | |
- name: Lift limits | |
run: | | |
sudo -s ulimit -Hl unlimited | |
sudo -s ulimit -l unlimited | |
sudo -s ulimit -Hc unlimited | |
sudo -s ulimit -c unlimited | |
- name: Run tests against Linux 5.10 | |
run: ./landlock-test-tools/test-rust.sh linux-5.10 0 | |
- name: Run tests against Linux 5.15 | |
run: ./landlock-test-tools/test-rust.sh linux-5.15 1 | |
- name: Run tests against Linux 6.1 | |
run: ./landlock-test-tools/test-rust.sh linux-6.1 2 |