Skip to content

Commit

Permalink
CI: extract common logic into setup action
Browse files Browse the repository at this point in the history
  • Loading branch information
athre0z committed Jun 27, 2024
1 parent df487dd commit a7c7aa2
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 87 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/env/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Common environment setup

runs:
using: composite
steps:
- name: Install dependencies
shell: bash
run: sudo apt-get install -y llvm clang dwz cmake curl unzip
- name: Build and install static Zydis
shell: bash
run: |
cd /tmp
git clone --depth 1 --branch v3.1.0 --recursive https://github.com/zyantific/zydis.git
cd zydis
rm -rf build
mkdir build
cd build
cmake -DZYDIS_BUILD_EXAMPLES=OFF ..
make -j$(nproc)
sudo make install
cd zycore
sudo make install
- name: Set up Go ${{matrix.go}}
uses: actions/setup-go@v5
with:
go-version: ${{matrix.go}}
check-latest: true
cache-dependency-path: go.sum
id: go
124 changes: 37 additions & 87 deletions .github/workflows/unit-test-on-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,37 +16,15 @@ jobs:
matrix:
go: ["stable"]
steps:
- name: Install dependencies
run: sudo apt-get install -y llvm clang dwz cmake curl unzip
- name: Install Zydis
shell: bash
run: |
cd /tmp
git clone --depth 1 --branch v3.1.0 --recursive https://github.com/zyantific/zydis.git
cd zydis
rm -rf build
mkdir build
cd build
cmake -DZYDIS_BUILD_EXAMPLES=OFF ..
make -j$(nproc)
sudo make install
cd zycore
sudo make install
- name: Set up Go ${{matrix.go}}
uses: actions/setup-go@v5
with:
go-version: ${{matrix.go}}
check-latest: true
cache-dependency-path: |
go.sum
id: go
- name: Check out
uses: actions/checkout@v4
- name: Linter
run: |
go version
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.56.2
make lint
- name: Clone code
uses: actions/checkout@v4
- name: Set up environment
uses: ./.github/workflows/environment
- name: Linter
run: |
go version
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.56.2
make lint
test:
name: Test
Expand All @@ -57,63 +35,27 @@ jobs:
matrix:
go: ["stable"]
steps:
- name: Install dependencies
run: sudo apt-get install -y llvm clang-16 dwz cmake curl unzip
- name: Install Zydis
shell: bash
run: |
cd /tmp
git clone --depth 1 --branch v3.1.0 --recursive https://github.com/zyantific/zydis.git
cd zydis
rm -rf build
mkdir build
cd build
cmake -DZYDIS_BUILD_EXAMPLES=OFF ..
make -j$(nproc)
sudo make install
cd zycore
sudo make install
- name: Set up Go ${{matrix.go}}
uses: actions/setup-go@v5
with:
go-version: ${{matrix.go}}
check-latest: true
cache-dependency-path: |
go.sum
id: go
- name: Check out
uses: actions/checkout@v4
- name: Build
run: |
echo $PATH
make test
- name: Tests
run: |
make test
- name: Clone code
uses: actions/checkout@v4
- name: Set up environment
uses: ./.github/workflows/environment
- name: Build
run: |
echo $PATH
make test
- name: Tests
run: |
make test
build-integration-test-binaries:
name: Build integration test binaries
runs-on: ubuntu-24.04
timeout-minutes: 10
steps:
- name: Checkout code
- name: Clone code
uses: actions/checkout@v4
- name: Install dependencies
run: sudo apt-get install -y llvm clang-16 dwz cmake curl unzip
- name: Install Zydis
shell: bash
run: |
cd /tmp
git clone --depth 1 --branch v3.1.0 --recursive https://github.com/zyantific/zydis.git
cd zydis
rm -rf build
mkdir build
cd build
cmake -DZYDIS_BUILD_EXAMPLES=OFF ..
make -j$(nproc)
sudo make install
cd zycore
sudo make install
- name: Set up environment
uses: ./.github/workflows/environment
- name: Prepare integration test binaries for qemu tests
run: |
make integration-test-binaries
Expand All @@ -129,15 +71,22 @@ jobs:
needs: build-integration-test-binaries
strategy:
matrix:
kernel-version: [ "4.19.314", "5.4.276", "5.10.217", "5.15.159", "6.1.91", "6.6.31", "6.8.10", "6.9.1" ]
kernel-version:
- "4.19.314"
- "5.4.276"
- "5.10.217"
- "5.15.159"
- "6.1.91"
- "6.6.31"
- "6.8.10"
- "6.9.1"
steps:
- name: Checkout code
- name: Clone code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
- name: Set up environment
uses: ./.github/workflows/environment
- name: Install dependencies
run: |
sudo apt-get -y update
sudo apt-get -y install qemu-system-x86
go install github.com/florianl/[email protected]
sudo mv ~/go/bin/bluebox /usr/local/bin/.
Expand All @@ -147,7 +96,8 @@ jobs:
- name: Fetch precompiled kernels
run: |
install -d ci-kernels
echo "FROM ghcr.io/cilium/ci-kernels:${{ matrix.kernel-version }}" | docker buildx build --quiet --pull --output="ci-kernels" -
echo "FROM ghcr.io/cilium/ci-kernels:${{ matrix.kernel-version }}" \
| docker buildx build --quiet --pull --output="ci-kernels" -
mv ci-kernels/boot/ ci-kernels/${{ matrix.kernel-version }}/
- name: Test on kernel ${{ matrix.kernel-version }}
run: |
Expand Down

0 comments on commit a7c7aa2

Please sign in to comment.