1name: Rust 2 3on: 4 push: 5 branches: [ main ] 6 pull_request: 7 branches: [ main ] 8 9jobs: 10 build: 11 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 ] 20 21 steps: 22 - 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 34 - name: Build 35 run: cargo build --verbose 36 37 - name: Run tests (Linux 4.11 support) 38 run: cargo test --verbose 39 - name: Run tests (Linux 4.14 support) 40 run: cargo test --verbose --features linux4_14 41 42 - name: Run tests (Linux 5.7 support) 43 if: ${{ matrix.runner == 'ubuntu-latest' }} 44 run: cargo test --verbose --features linux5_7 45 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 56 audit: 57 58 runs-on: ubuntu-latest 59 60 steps: 61 - uses: actions/checkout@v2 62 - name: Install Cargo Audit 63 run: cargo install cargo-audit 64 - name: Audit 65 run: cargo audit 66