on: push: branches: - master pull_request: branches: - master jobs: tests: runs-on: ${{ matrix.runs_on }} strategy: fail-fast: false matrix: include: - displayTargetName: ubuntu-22.04 os: unix runs_on: ubuntu-22.04 shell: bash - displayTargetName: kasan os: unix runs_on: ubuntu-22.04 shell: bash build_options: "kasan=yes kasan_test=yes" - displayTargetName: mmu_kasan os: unix runs_on: ubuntu-22.04 shell: bash build_options: "MMU=1 MMU_KUNIT=1 kasan=yes" - displayTargetName: windows-2022 os: windows runs_on: windows-2022 pip_option: --break-system-packages shell: msys2 {0} - displayTargetName: clang-build os: unix runs_on: ubuntu-22.04 shell: bash build_options: "LLVM=1 CROSS_COMPILE=x86_64-linux-gnu" timeout-minutes: 100 env: CCACHE_DIR: ${{ github.workspace }}/.ccache USE_CCACHE: 1 defaults: run: shell: ${{ matrix.shell }} steps: - name: Set env shell: bash run: | echo "/usr/lib/ccache/bin:/usr/lib/ccache:/mingw64/bin:${{ github.workspace }}/bin" >> $GITHUB_PATH echo "export PATH=/usr/lib/ccache/bin:/usr/lib/ccache:/mingw64/bin:${{ github.workspace }}/bin:$PATH" >> $HOME/.bashrc - uses: msys2/setup-msys2@v2.26.0 if: runner.os == 'Windows' with: msystem: MSYS path-type: minimal update: true install: >- base-devel gcc git bc python-pip dosfstools mingw-w64-x86_64-ccache - name: Checkout if: runner.os == 'Linux' uses: actions/checkout@v4 - name: Install pip dependencies run: pip install ${{ matrix.pip_option }} yamlish junit-xml - name: Install openvpn if: runner.os == 'Windows' shell: pwsh env: file: "OpenVPN-2.6.14-I001-amd64.msi" log: "install.log" run: | curl -L -O "https://swupdate.openvpn.org/community/releases/${{ env.file }}" $procMain = Start-Process "msiexec" "/i ${{ env.file }} /qn /l*! ${{ env.log }}" -NoNewWindow -PassThru $procLog = Start-Process "powershell" "Get-Content -Path ${{ env.log }} -Wait" -NoNewWindow -PassThru $procMain.WaitForExit() $procLog.Kill() - name: Partial Clone if: runner.os == 'Windows' shell: msys2 {0} run: | REPO="https://${GITHUB_ACTOR}:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git" BRANCH="${GITHUB_REF/#refs\/heads\//}" git init . git remote add origin $REPO git config core.sparseCheckout true echo -e '/*\n!*aux.*' >> .git/info/sparse-checkout git -c protocol.version=2 fetch --no-tags --prune --progress --depth=10 origin +${GITHUB_SHA}:refs/remotes/origin/${BRANCH} git checkout --progress --force -B $BRANCH refs/remotes/origin/$BRANCH - uses: actions/cache@v4 with: path: ${{ env.CCACHE_DIR }} key: ${{ runner.os }}-ccache-build-${{ github.sha }} restore-keys: ${{ runner.os }}-ccache-build- - name: Install ccache on ubuntu-latest if: runner.os == 'Linux' run: | sudo apt update -y sudo apt install -y ccache libjsmn-dev libfuse3-dev - name: Install clang toolchain if: runner.os == 'Linux' run: | sudo apt update -y sudo apt install -y clang lld llvm - name: Install patched binutils for Windows if: runner.os == 'Windows' run: | cp -f tools/lkl/bin/*.exe /usr/bin/ - name: Fix broken msys2 ccache if: runner.os == 'Windows' run: | mkdir -p /usr/lib/ccache/bin cd /usr/lib/ccache/bin echo -e '#!/bin/bash\n\nccache /usr/bin/cc "$@"' > cc echo -e '#!/bin/bash\n\nccache /usr/bin/gcc "$@"' > gcc echo -e '#!/bin/bash\n\nccache /usr/bin/cpp "$@"' > cpp export PATH=/usr/lib/ccache/bin:/usr/lib/ccache:/mingw64/bin:$PATH which gcc ccache -z - name: install zpoline if: matrix.displayTargetName == 'zpoline' run: | sudo apt install -y binutils-dev lib32gcc-s1 git clone https://github.com/yasukata/zpoline cd zpoline git checkout 022a3b8c7a5c23bfd99162b478bf3eb5f70c07a2 make cd .. # This is the whole point of zpoline echo "==== setting mmap_min_addr ====" sudo sh -c "echo 0 > /proc/sys/vm/mmap_min_addr" echo "setting env variable (debug)" echo "ZPOLINE_DEBUG=0" >> "$GITHUB_ENV" - name: Build run: | make -j4 -C tools/lkl ${{ matrix.build_options }} - name: Tests run: mkdir /tmp/junit && make -C tools/lkl run-tests tests="--junit-dir /tmp/junit" - name: Save test results uses: actions/upload-artifact@v4 if: success() || failure() with: name: test-results-${{ matrix.displayTargetName }} path: /tmp/junit/*.xml checkpatch: runs-on: ubuntu-24.04 name: checkpatch steps: - name: Checkout with: fetch-depth: 0 uses: actions/checkout@v4 - name: Install pip dependencies run: sudo pip install ply GitPython - name: Check coding style run: tools/lkl/scripts/checkpatch.sh fuzzers: runs-on: ubuntu-22.04 name: fuzzers env: PROTOBUF_MUTATOR_DIR: /tmp/libprotobuf-mutator steps: - name: Checkout with: fetch-depth: 0 uses: actions/checkout@v4 - name: Install clang toolchain run: | sudo apt update -y sudo apt install -y clang lld llvm - name: Install libprotobuf-mutator prerequisites run: | sudo apt update -y sudo apt install -y binutils cmake ninja-build liblzma-dev libz-dev \ pkg-config autoconf libtool - name: Build libprotobuf-mutator run: tools/lkl/scripts/libprotobuf-mutator-build.sh - name: Build fuzzers run: make -j4 -C tools/lkl LKL_FUZZING=1 MMU=1 fuzzers