2023-05-16 19:40:39 +00:00
|
|
|
name: Ubuntu
|
2019-08-31 09:04:46 +00:00
|
|
|
|
2023-05-12 09:00:47 +00:00
|
|
|
on:
|
|
|
|
workflow_dispatch:
|
|
|
|
push:
|
|
|
|
paths-ignore:
|
|
|
|
- ".github/workflows/images-*"
|
2023-05-12 09:12:18 +00:00
|
|
|
- ".github/workflows/debian-cache.yml"
|
2023-05-16 12:06:59 +00:00
|
|
|
- ".github/workflows/e2e.yml"
|
2023-05-17 11:09:26 +00:00
|
|
|
- "docs/**"
|
|
|
|
- "README.md"
|
2023-05-12 09:00:47 +00:00
|
|
|
pull_request:
|
2019-08-31 09:04:46 +00:00
|
|
|
|
2023-05-18 11:58:53 +00:00
|
|
|
concurrency:
|
|
|
|
group: ${{ github.workflow_ref }}
|
|
|
|
cancel-in-progress: true
|
|
|
|
|
2019-08-31 09:04:46 +00:00
|
|
|
jobs:
|
|
|
|
build:
|
2023-05-16 19:40:39 +00:00
|
|
|
name: Build
|
2019-08-31 09:04:46 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v1
|
2024-02-22 09:58:42 +00:00
|
|
|
- uses: actions/setup-go@v5
|
2019-08-31 09:04:46 +00:00
|
|
|
|
|
|
|
- name: Build
|
|
|
|
run: go build
|
|
|
|
|
2019-12-26 06:12:42 +00:00
|
|
|
test-unit:
|
|
|
|
name: Unit Testing
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v1
|
2024-02-22 09:58:42 +00:00
|
|
|
- uses: actions/setup-go@v5
|
2019-12-26 06:12:42 +00:00
|
|
|
|
2019-08-31 09:04:46 +00:00
|
|
|
- name: Install dependencies for tests
|
|
|
|
run: |
|
|
|
|
sudo apt-get update
|
2023-01-24 15:32:04 +00:00
|
|
|
sudo apt-get install qemu-system-x86
|
2019-08-31 09:04:46 +00:00
|
|
|
|
|
|
|
- name: Bootstrap
|
2023-04-09 14:16:29 +00:00
|
|
|
run: ./tools/qemu-ubuntu-img/bootstrap.sh
|
2019-08-31 09:04:46 +00:00
|
|
|
|
2019-12-26 06:12:42 +00:00
|
|
|
- name: Unit Testing
|
2023-05-12 19:34:55 +00:00
|
|
|
run: |
|
|
|
|
mkdir ~/.out-of-tree
|
|
|
|
go test -parallel 1 -v ./...
|
2019-12-26 06:12:42 +00:00
|
|
|
|
2023-05-10 10:25:19 +00:00
|
|
|
test-end-to-end-examples:
|
2023-05-17 10:32:49 +00:00
|
|
|
name: Examples
|
2019-12-26 06:12:42 +00:00
|
|
|
runs-on: ubuntu-latest
|
2023-05-16 18:45:59 +00:00
|
|
|
|
|
|
|
strategy:
|
2023-05-17 13:22:30 +00:00
|
|
|
fail-fast: false
|
2023-05-16 18:45:59 +00:00
|
|
|
matrix:
|
|
|
|
example: [
|
2023-05-16 19:12:03 +00:00
|
|
|
{ dir: "kernel-module", params: "" },
|
|
|
|
{ dir: "kernel-exploit", params: "--threshold=0" },
|
|
|
|
{ dir: "script", params: "" },
|
|
|
|
{ dir: "preload", params: "" }
|
2023-05-16 18:45:59 +00:00
|
|
|
]
|
|
|
|
|
2019-12-26 06:12:42 +00:00
|
|
|
steps:
|
2023-05-17 12:04:13 +00:00
|
|
|
- uses: actions/checkout@v1
|
2024-02-22 09:58:42 +00:00
|
|
|
- uses: actions/setup-go@v5
|
2023-05-17 12:04:13 +00:00
|
|
|
|
2023-05-17 11:59:11 +00:00
|
|
|
- name: Setup
|
|
|
|
run: .github/workflows/scripts/setup.sh
|
|
|
|
|
2019-12-26 06:12:42 +00:00
|
|
|
- name: Build
|
|
|
|
run: go build
|
|
|
|
|
|
|
|
- name: Install dependencies for tests
|
|
|
|
run: |
|
|
|
|
sudo apt-get update
|
2024-02-21 18:43:32 +00:00
|
|
|
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
|
2019-12-26 06:12:42 +00:00
|
|
|
|
2023-05-16 19:12:03 +00:00
|
|
|
- name: End-to-End Testing [${{ matrix.example.dir }}]
|
2023-05-10 10:20:15 +00:00
|
|
|
run: |
|
2023-05-16 18:50:39 +00:00
|
|
|
cd examples/${{ matrix.example.dir }}
|
2023-05-10 10:20:15 +00:00
|
|
|
../../out-of-tree --log-level=debug kernel autogen --max=1
|
2023-05-16 19:03:30 +00:00
|
|
|
../../out-of-tree --log-level=debug pew --qemu-timeout=10m ${{ matrix.example.params }}
|
2023-05-10 10:20:15 +00:00
|
|
|
|
2023-04-06 20:14:36 +00:00
|
|
|
- name: Archive logs
|
2023-05-12 07:59:58 +00:00
|
|
|
if: always()
|
2024-02-20 15:09:58 +00:00
|
|
|
uses: actions/upload-artifact@v4
|
2023-04-06 20:14:36 +00:00
|
|
|
with:
|
2023-05-17 11:42:31 +00:00
|
|
|
name: test-end-to-end-examples-${{ matrix.example.dir }}-logs
|
|
|
|
path: ~/.out-of-tree/logs
|
2023-05-16 20:13:09 +00:00
|
|
|
|
|
|
|
test-end-to-end:
|
2023-05-17 10:32:49 +00:00
|
|
|
name: E2E
|
2023-05-16 20:13:09 +00:00
|
|
|
runs-on: ubuntu-latest
|
2023-05-17 04:18:22 +00:00
|
|
|
timeout-minutes: 60
|
2023-05-16 20:13:09 +00:00
|
|
|
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
2023-05-17 15:31:21 +00:00
|
|
|
#type: [ Script, Module ]
|
|
|
|
type: [ Module ]
|
2023-05-16 20:13:09 +00:00
|
|
|
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 },
|
2023-05-17 11:11:24 +00:00
|
|
|
{ distro: OracleLinux, release: 9 },
|
2023-05-16 20:13:09 +00:00
|
|
|
{ distro: Debian, release: 7 },
|
|
|
|
{ distro: Debian, release: 8 },
|
|
|
|
{ distro: Debian, release: 9 },
|
|
|
|
{ distro: Debian, release: 10 },
|
2023-05-24 09:14:18 +00:00
|
|
|
{ distro: Debian, release: 11 },
|
2023-06-15 15:24:29 +00:00
|
|
|
{ distro: Debian, release: 12 },
|
2023-06-17 13:26:11 +00:00
|
|
|
{ distro: OpenSUSE, release: "12.1" },
|
|
|
|
{ distro: OpenSUSE, release: "12.2" },
|
|
|
|
{ distro: OpenSUSE, release: "12.3" },
|
2023-06-17 08:46:07 +00:00
|
|
|
{ distro: OpenSUSE, release: "13.1" },
|
|
|
|
{ distro: OpenSUSE, release: "13.2" },
|
2023-06-15 15:24:29 +00:00
|
|
|
{ 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" }
|
2023-05-16 20:13:09 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
steps:
|
2024-02-21 12:35:51 +00:00
|
|
|
- name: Backup docker files
|
|
|
|
run: |
|
|
|
|
echo "backup moby/buildkit image"
|
|
|
|
sudo docker image save -o ${GITHUB_WORKSPACE}/images.tar moby/buildkit
|
2024-02-21 12:53:16 +00:00
|
|
|
echo "prune docker"
|
|
|
|
sudo docker system prune -a -f
|
|
|
|
echo "back up /var/lib/docker folder structure and other files"
|
2024-02-21 12:35:51 +00:00
|
|
|
sudo rsync -aPq /var/lib/docker/ ${GITHUB_WORKSPACE}/docker
|
|
|
|
|
|
|
|
- name: Maximize build space
|
|
|
|
uses: easimon/maximize-build-space@master
|
2024-02-21 11:51:30 +00:00
|
|
|
with:
|
2024-02-21 12:35:51 +00:00
|
|
|
overprovision-lvm: 'true'
|
2024-02-21 11:51:30 +00:00
|
|
|
remove-dotnet: 'true'
|
2024-02-21 12:35:51 +00:00
|
|
|
# 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
|
2024-02-21 11:51:30 +00:00
|
|
|
|
|
|
|
- uses: actions/checkout@v1
|
2024-02-22 09:58:42 +00:00
|
|
|
- uses: actions/setup-go@v5
|
2024-02-21 11:51:30 +00:00
|
|
|
|
|
|
|
- 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
|