name: Ubuntu on: workflow_dispatch: push: paths-ignore: - ".github/workflows/images-*" - ".github/workflows/debian-cache.yml" - ".github/workflows/e2e.yml" - "docs/**" - "README.md" pull_request: concurrency: group: ${{ github.workflow_ref }} cancel-in-progress: true jobs: build: name: Build runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 - uses: actions/setup-go@v5 - name: Build run: go build test-unit: name: Unit Testing runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 - uses: actions/setup-go@v5 - name: Install dependencies for tests run: | sudo apt-get update sudo apt-get install qemu-system-x86 - name: Bootstrap run: ./tools/qemu-ubuntu-img/bootstrap.sh - name: Unit Testing run: | mkdir ~/.out-of-tree go test -parallel 1 -v ./... test-end-to-end-examples: needs: [build] name: Examples runs-on: ubuntu-latest strategy: fail-fast: false matrix: example: [ { dir: "kernel-module", params: "" }, { dir: "kernel-exploit", params: "--threshold=0" }, { dir: "script", params: "" }, { dir: "preload", params: "" } ] steps: - uses: actions/checkout@v1 - uses: actions/setup-go@v5 - name: Setup run: .github/workflows/scripts/setup.sh - name: Build run: go build - name: Install dependencies for tests run: | sudo apt-get update sudo apt-get install -y qemu-system-x86 echo 'deb http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/unstable/xUbuntu_22.04/ /' | sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:unstable.list curl -fsSL https://download.opensuse.org/repositories/devel:kubic:libcontainers:unstable/xUbuntu_22.04/Release.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/devel_kubic_libcontainers_unstable.gpg > /dev/null sudo apt-get update sudo apt-get install -y podman - name: End-to-End Testing [${{ matrix.example.dir }}] run: | cd examples/${{ matrix.example.dir }} ../../out-of-tree --log-level=debug kernel autogen --max=1 ../../out-of-tree --log-level=debug pew --qemu-timeout=10m ${{ matrix.example.params }} - name: Archive logs if: always() uses: actions/upload-artifact@v4 with: name: test-end-to-end-examples-${{ matrix.example.dir }}-logs path: ~/.out-of-tree/logs test-end-to-end: needs: [build] name: E2E runs-on: ubuntu-latest timeout-minutes: 60 strategy: fail-fast: false matrix: #type: [ Script, Module ] type: [ Module ] os: [ { distro: Ubuntu, release: 12.04 }, { distro: Ubuntu, release: 14.04 }, { distro: Ubuntu, release: 16.04 }, { distro: Ubuntu, release: 18.04 }, { distro: Ubuntu, release: 20.04 }, { distro: Ubuntu, release: 22.04 }, { distro: CentOS, release: 6 }, { distro: CentOS, release: 7 }, { distro: CentOS, release: 8 }, { distro: OracleLinux, release: 6 }, { distro: OracleLinux, release: 7 }, { distro: OracleLinux, release: 8 }, { distro: OracleLinux, release: 9 }, { distro: Debian, release: 7 }, { distro: Debian, release: 8 }, { distro: Debian, release: 9 }, { distro: Debian, release: 10 }, { distro: Debian, release: 11 }, { distro: Debian, release: 12 }, { distro: OpenSUSE, release: "12.1" }, { distro: OpenSUSE, release: "12.2" }, { distro: OpenSUSE, release: "12.3" }, { distro: OpenSUSE, release: "13.1" }, { distro: OpenSUSE, release: "13.2" }, { distro: OpenSUSE, release: "42.1" }, { distro: OpenSUSE, release: "42.2" }, { distro: OpenSUSE, release: "42.3" }, # { distro: OpenSUSE, release: "15.0" }, { distro: OpenSUSE, release: "15.1" }, { distro: OpenSUSE, release: "15.2" }, { distro: OpenSUSE, release: "15.3" }, { distro: OpenSUSE, release: "15.4" }, { distro: OpenSUSE, release: "15.5" } ] steps: - name: Backup docker files run: | echo "backup moby/buildkit image" sudo docker image save -o ${GITHUB_WORKSPACE}/images.tar moby/buildkit echo "prune docker" sudo docker system prune -a -f echo "back up /var/lib/docker folder structure and other files" sudo rsync -aPq /var/lib/docker/ ${GITHUB_WORKSPACE}/docker - name: Maximize build space uses: easimon/maximize-build-space@master with: overprovision-lvm: 'true' remove-dotnet: 'true' # instead of using default value to mount to build path, # /var/lib/docker/ is really the place we need more spaces. build-mount-path: '/var/lib/docker/' - name: Restore docker files run: | sudo rsync -aPq ${GITHUB_WORKSPACE}/docker/ /var/lib/docker sudo rm -rf ${GITHUB_WORKSPACE}/docker sudo ls ${GITHUB_WORKSPACE} -l sudo docker image load -i ${GITHUB_WORKSPACE}/images.tar sudo rm ${GITHUB_WORKSPACE}/images.tar - uses: actions/checkout@v1 - uses: actions/setup-go@v5 - name: Setup run: .github/workflows/scripts/setup.sh - name: Build run: go build - name: Install dependencies for tests run: | sudo apt-get update sudo apt-get install qemu-system-x86 - name: End-to-End Testing ${{ matrix.type }} [${{ matrix.os.distro }} ${{ matrix.os.release }}] shell: bash run: | mkdir test cd test echo 'name = "test"' >> .out-of-tree.toml echo 'type = "${{ matrix.type }}"' >> .out-of-tree.toml echo 'script = "script.sh"' >> .out-of-tree.toml echo '[[targets]]' >> .out-of-tree.toml echo 'distro = { id = "${{ matrix.os.distro }}", release = "${{ matrix.os.release }}" }' >> .out-of-tree.toml echo 'kernel = { regex = ".*" }' >> .out-of-tree.toml echo -e '#!/bin/sh\necho ok' >> script.sh cp ../examples/kernel-module/{module.c,Makefile,test.sh} . ../out-of-tree --log-level=debug kernel list-remote --distro=${{ matrix.os.distro }} --ver=${{ matrix.os.release }} ../out-of-tree --log-level=debug kernel autogen --max=1 --shuffle ../out-of-tree --log-level=debug pew --qemu-timeout=20m --include-internal-errors - name: Archive logs if: always() uses: actions/upload-artifact@v4 with: name: test-end-to-end-${{ matrix.type }}-${{ matrix.os.distro }}-${{ matrix.os.release }}-logs path: ~/.out-of-tree/logs