Skip to content

Commit 18c7d3c

Browse files
author
Pat Hickey
authored
Merge pull request #58 from bchalios/fix_github_actions
Fix failure in Github action
2 parents e2a9066 + 7e2bec4 commit 18c7d3c

File tree

1 file changed

+31
-5
lines changed

1 file changed

+31
-5
lines changed

.github/workflows/rust.yml

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,50 @@ on:
99
jobs:
1010
build:
1111

12-
runs-on: ubuntu-latest
12+
# ubuntu-latest runs a recent kernel with /dev/userfaultfd support whereas
13+
# ubuntu-20.04 has a 5.15 kernel. We run the job in both, so we can test
14+
# both paths for creating the file descriptor, i.e. /dev/userfaultfd ioctl
15+
# and userfaultfd syscall.
16+
runs-on: ${{ matrix.runner }}
17+
strategy:
18+
matrix:
19+
runner: [ ubuntu-latest, ubuntu-20.04 ]
1320

1421
steps:
1522
- uses: actions/checkout@v2
23+
24+
# Keep this step, so that we can check that the Linux kernel is the one we
25+
# expect, depending on the runner kernel.
26+
- name: Check Linux version
27+
run: uname -r
28+
29+
# /dev/userfaultfd is only present on ubuntu-latest.
30+
- name: Setup access to /dev/userfaultfd
31+
if: ${{ matrix.runner == 'ubuntu-latest' }}
32+
run: sudo setfacl -m u:${USER}:rw /dev/userfaultfd
33+
1634
- name: Build
1735
run: cargo build --verbose
1836

19-
# The github ubuntu-latest is now on linux 5.11 kernel,
20-
# so we can test the crate with support for each of the
21-
# kernel featuresets:
22-
2337
- name: Run tests (Linux 4.11 support)
2438
run: cargo test --verbose
2539
- name: Run tests (Linux 4.14 support)
2640
run: cargo test --verbose --features linux4_14
41+
2742
- name: Run tests (Linux 5.7 support)
43+
if: ${{ matrix.runner == 'ubuntu-latest' }}
2844
run: cargo test --verbose --features linux5_7
2945

46+
# On ubuntu-20.04 runner we need to make sure we have the proper kernel
47+
# headers for building the correct bindings
48+
- name: Run tests (Linux 5.7 support)
49+
if: ${{ matrix.runner == 'ubuntu-20.04' }}
50+
run:
51+
sudo apt update &&
52+
sudo apt install -y linux-headers-5.11.0-25-generic &&
53+
export LINUX_HEADERS=/usr/src/linux-headers-5.11.0-25-generic &&
54+
cargo test --verbose --features linux5_7
55+
3056
audit:
3157

3258
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)