Skip to content

Commit 94ca6ab

Browse files
chore: refactor github actions
Split up many of the jobs to modular actions.
1 parent 7ea5cfe commit 94ca6ab

File tree

8 files changed

+412
-224
lines changed

8 files changed

+412
-224
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Generate Kernel Test Matrix
2+
description: |
3+
Generate kernel test matrix from JSON data file.
4+
Adds timestamp suffix for unique runner identification.
5+
inputs:
6+
data-file-path:
7+
description: 'Path to the kernel matrix JSON data file'
8+
required: false
9+
default: '.github/data/kernel-test-matrix.json'
10+
outputs:
11+
matrix:
12+
description: 'Generated JSON matrix for GitHub Actions'
13+
value: ${{ steps.generate.outputs.matrix }}
14+
runs:
15+
using: composite
16+
steps:
17+
- name: Generate Matrix
18+
id: generate
19+
run: |
20+
DATA_FILE="${{ inputs.data-file-path }}"
21+
22+
if [ ! -f "$DATA_FILE" ]; then
23+
echo "Error: Data file not found at $DATA_FILE"
24+
exit 1
25+
fi
26+
27+
# Read the JSON file and add timestamp suffix to each entry
28+
timestamp=$(date +%s)
29+
matrix=$(jq --arg ts "$timestamp" -c '[.[] | . + {sufix: $ts, job_name: .name}]' "$DATA_FILE")
30+
31+
echo "Generated matrix (pretty printed for display):"
32+
echo "$matrix" | jq .
33+
34+
# Output the matrix as a single line (compact JSON)
35+
echo "matrix=$matrix" >> $GITHUB_OUTPUT
36+
shell: bash
37+
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
name: Run E2E Tests
2+
description: |
3+
Run end-to-end tests including build, compatibility, instrumentation, network, and kernel tests.
4+
Handles test failure detection and artifact uploads.
5+
inputs:
6+
job-name:
7+
description: 'Job name for artifact naming'
8+
required: true
9+
run-id:
10+
description: 'GitHub run ID for artifact naming'
11+
required: true
12+
run-attempt:
13+
description: 'GitHub run attempt for artifact naming'
14+
required: true
15+
runs:
16+
using: composite
17+
steps:
18+
- name: Build Tracee
19+
run: make tracee
20+
shell: bash
21+
- name: Compatibility Test
22+
run: env "PATH=$PATH" make test-compatibility
23+
shell: bash
24+
- name: Instrumentation Test
25+
id: e2e-inst-test
26+
run: |
27+
./tests/e2e-inst-test.sh --keep-artifacts 2>&1 | tee /tmp/e2e-inst-test.log
28+
exit ${PIPESTATUS[0]}
29+
shell: bash
30+
- name: Network Test
31+
id: e2e-net-test
32+
run: |
33+
./tests/e2e-net-test.sh 2>&1 | tee /tmp/e2e-net-test.log
34+
exit ${PIPESTATUS[0]}
35+
shell: bash
36+
- name: Kernel Test
37+
id: e2e-kernel-test
38+
run: |
39+
./tests/e2e-kernel-test.sh 2>&1 | tee /tmp/e2e-kernel-test.log
40+
exit ${PIPESTATUS[0]}
41+
shell: bash
42+
- name: Determine Failed Test
43+
id: failed-test
44+
if: failure() && (
45+
steps.e2e-inst-test.conclusion == 'failure' ||
46+
steps.e2e-net-test.conclusion == 'failure' ||
47+
steps.e2e-kernel-test.conclusion == 'failure'
48+
)
49+
run: |
50+
if [[ "${{ steps.e2e-inst-test.conclusion }}" == "failure" ]]; then
51+
echo "name=inst" >> $GITHUB_OUTPUT
52+
elif [[ "${{ steps.e2e-net-test.conclusion }}" == "failure" ]]; then
53+
echo "name=net" >> $GITHUB_OUTPUT
54+
elif [[ "${{ steps.e2e-kernel-test.conclusion }}" == "failure" ]]; then
55+
echo "name=kernel" >> $GITHUB_OUTPUT
56+
else
57+
echo "No failed tests. Should not reach this point."
58+
exit 1
59+
fi
60+
shell: bash
61+
- name: Upload E2E Test Artifacts
62+
if: always() && steps.failed-test.outputs.name != ''
63+
uses: actions/upload-artifact@v4
64+
with:
65+
name: e2e-${{ steps.failed-test.outputs.name }}-artifacts-${{ inputs.job-name }}-${{ inputs.run-id }}-${{ inputs.run-attempt }}
66+
path: |
67+
/tmp/tracee-log-*
68+
/tmp/tracee-output-*
69+
/tmp/e2e-*.log
70+
retention-days: 7
71+
if-no-files-found: warn
72+
- name: Notify About Available E2E Test Artifacts
73+
if: always() && steps.failed-test.outputs.name != ''
74+
run: |
75+
echo "::notice title=Debug Artifacts Available::E2E tests failed. Debug artifacts have been uploaded and can be downloaded from the Summary tab. Look for: e2e-${{ steps.failed-test.outputs.name }}-artifacts-${{ inputs.job-name }}-${{ inputs.run-id }}-${{ inputs.run-attempt }}"
76+
echo ""
77+
echo "📋 **E2E Test Failed - Debug Information Available**"
78+
echo ""
79+
echo "🔍 **How to access debug artifacts:**"
80+
echo "1. Click on the 'Summary' tab above the jobs list"
81+
echo "2. Scroll to the bottom of the Summary page"
82+
echo "3. Look for the 'Artifacts' section"
83+
echo "4. Download: \`e2e-${{ steps.failed-test.outputs.name }}-artifacts-${{ inputs.job-name }}-${{ inputs.run-id }}-${{ inputs.run-attempt }}\`"
84+
echo ""
85+
echo "📁 **What's included in the artifacts:**"
86+
echo "- **Log file**: Full debug-level logs from all E2E tests (tracee-log-*)"
87+
echo "- **Output file**: JSON events captured during all E2E tests (tracee-output-*)"
88+
echo "- **Pipeline log**: Complete stdout/stderr from the failed test (e2e-*.log)"
89+
echo ""
90+
echo "⚠️ **Note**: Artifacts are available for 7 days from upload"
91+
shell: bash
92+
- name: Cleanup E2E Test Artifacts
93+
if: always()
94+
run: |
95+
# Clean up artifact files from runner filesystem
96+
rm -f /tmp/tracee-log-* /tmp/tracee-output-* /tmp/e2e-*.log 2>/dev/null || true
97+
echo "Cleaned up local artifact files from all E2E tests"
98+
shell: bash
99+
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Run Integration Tests
2+
description: |
3+
Run integration test suite with full eBPF kernel integration.
4+
Uploads coverage results to codecov.
5+
inputs:
6+
codecov-token:
7+
description: 'Codecov token for coverage upload'
8+
required: true
9+
runs:
10+
using: composite
11+
steps:
12+
- name: Run Integration Tests
13+
run: |
14+
env "PATH=$PATH" make test-integration
15+
shell: bash
16+
- name: Upload Integration Test Coverage
17+
uses: codecov/codecov-action@af09b5e394c93991b95a5e7646aeb90c1917f78f # v5.5.1
18+
with:
19+
token: ${{ inputs.codecov-token }}
20+
files: ./integration-coverage.txt
21+
flags: integration
22+
name: integration-tests
23+
fail_ci_if_error: false
24+
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Run Unit Tests
2+
description: |
3+
Run comprehensive unit test suite including main unit tests and script tests.
4+
Uploads coverage results to codecov.
5+
inputs:
6+
codecov-token:
7+
description: 'Codecov token for coverage upload'
8+
required: true
9+
runs:
10+
using: composite
11+
steps:
12+
- name: Run Full Unit Test Suite
13+
run: |
14+
# Run comprehensive test suite for all modules (main + types + common + api)
15+
make test-unit
16+
shell: sh
17+
- name: Upload Unit Test Coverage
18+
uses: codecov/codecov-action@af09b5e394c93991b95a5e7646aeb90c1917f78f # v5.5.1
19+
with:
20+
token: ${{ inputs.codecov-token }}
21+
files: ./coverage.txt
22+
flags: unit
23+
name: unit-tests
24+
fail_ci_if_error: false
25+
- name: Run Scripts Unit Tests
26+
run: |
27+
make run-scripts-test-unit
28+
shell: sh
29+
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Setup Tracee (Alpine)
2+
description: |
3+
Setup Tracee development environment on Alpine Linux.
4+
Fixes Git ownership and installs dependencies.
5+
Note: Checkout must be done before calling this action.
6+
runs:
7+
using: composite
8+
steps:
9+
- name: Fix Git ownership
10+
run: git config --global --add safe.directory $GITHUB_WORKSPACE
11+
shell: sh
12+
- name: Install Dependencies
13+
run: ./scripts/installation/install-deps-alpine.sh
14+
shell: sh
15+
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Setup Tracee (Ubuntu)
2+
description: |
3+
Setup Tracee development environment on Ubuntu.
4+
Installs Git, fixes Git ownership, and installs dependencies.
5+
Note: Checkout must be done before calling this action.
6+
runs:
7+
using: composite
8+
steps:
9+
- name: Install Git
10+
run: |
11+
export DEBIAN_FRONTEND=noninteractive
12+
apt-get update
13+
apt-get install -y --no-install-recommends git-core ca-certificates
14+
update-ca-certificates
15+
shell: bash
16+
- name: Fix Git ownership
17+
run: git config --global --add safe.directory $GITHUB_WORKSPACE
18+
shell: bash
19+
- name: Install Dependencies
20+
run: ./scripts/installation/install-deps-ubuntu.sh
21+
shell: bash
22+
Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
[
2+
{
3+
"name": "GKE 5.4",
4+
"ami": "0013845506cbdf2ca",
5+
"arch": "x86_64"
6+
},
7+
{
8+
"name": "GKE 5.10",
9+
"ami": "049b1b3a4a5fdf9fd",
10+
"arch": "x86_64"
11+
},
12+
{
13+
"name": "GKE 5.15 x86_64",
14+
"ami": "01f6d4f80f256ffe4",
15+
"arch": "x86_64"
16+
},
17+
{
18+
"name": "GKE 5.15 aarch64",
19+
"ami": "079f308677600eebf",
20+
"arch": "aarch64"
21+
},
22+
{
23+
"name": "AMZN2 5.10 x86_64",
24+
"ami": "05d03d50b6008ede7",
25+
"arch": "x86_64"
26+
},
27+
{
28+
"name": "AMZN2 5.10 aarch64",
29+
"ami": "05e46d0a87c96bf69",
30+
"arch": "aarch64"
31+
},
32+
{
33+
"name": "RHEL8 4.18 x86_64",
34+
"ami": "0e6e8bf2181db9d65",
35+
"arch": "x86_64"
36+
},
37+
{
38+
"name": "Focal 5.4 x86_64",
39+
"ami": "0c75089aa342ffa26",
40+
"arch": "x86_64"
41+
},
42+
{
43+
"name": "Focal 5.13 x86_64",
44+
"ami": "094d5310a281c8679",
45+
"arch": "x86_64"
46+
},
47+
{
48+
"name": "Focal 5.13 aarch64",
49+
"ami": "08f88e2a2bd1b72a7",
50+
"arch": "aarch64"
51+
},
52+
{
53+
"name": "Jammy 5.15 x86_64",
54+
"ami": "0d01de8f7b26afe02",
55+
"arch": "x86_64"
56+
},
57+
{
58+
"name": "Jammy 5.15 aarch64",
59+
"ami": "08e91aa07134e6a36",
60+
"arch": "aarch64"
61+
},
62+
{
63+
"name": "Jammy 5.19 x86_64",
64+
"ami": "02691308713b4cec2",
65+
"arch": "x86_64"
66+
},
67+
{
68+
"name": "Jammy 5.19 aarch64",
69+
"ami": "046579f8e52acb104",
70+
"arch": "aarch64"
71+
},
72+
{
73+
"name": "Lunar 6.2 x86_64",
74+
"ami": "034e03e1bdb7c205f",
75+
"arch": "x86_64"
76+
},
77+
{
78+
"name": "Lunar 6.2 aarch64",
79+
"ami": "04b03463ee4e32182",
80+
"arch": "aarch64"
81+
},
82+
{
83+
"name": "Mantic 6.5 x86_64",
84+
"ami": "0a44ad46e5c42e499",
85+
"arch": "x86_64"
86+
},
87+
{
88+
"name": "Mantic 6.5 aarch64",
89+
"ami": "0387f77c4820c98db",
90+
"arch": "aarch64"
91+
},
92+
{
93+
"name": "Mantic 6.6 x86_64",
94+
"ami": "05b5ac8f6c43b3ca5",
95+
"arch": "x86_64"
96+
},
97+
{
98+
"name": "Mantic 6.6 aarch64",
99+
"ami": "05c9d6cd9343f0a43",
100+
"arch": "aarch64"
101+
},
102+
{
103+
"name": "Noble 6.8 x86_64",
104+
"ami": "0cc63426ae75d47c8",
105+
"arch": "x86_64"
106+
},
107+
{
108+
"name": "Noble 6.8 aarch64",
109+
"ami": "0f5260685b3ec2293",
110+
"arch": "aarch64"
111+
},
112+
{
113+
"name": "Noble 6.10 x86_64",
114+
"ami": "0ae23eabda70efc60",
115+
"arch": "x86_64"
116+
},
117+
{
118+
"name": "Noble 6.10 aarch64",
119+
"ami": "01ce0f71400b5ff38",
120+
"arch": "aarch64"
121+
},
122+
{
123+
"name": "Noble 6.11 x86_64",
124+
"ami": "0ce1f88aa63091921",
125+
"arch": "x86_64"
126+
},
127+
{
128+
"name": "Noble 6.11 aarch64",
129+
"ami": "0123508488affb578",
130+
"arch": "aarch64"
131+
},
132+
{
133+
"name": "Noble 6.12 x86_64",
134+
"ami": "0e38f3caba1b4234d",
135+
"arch": "x86_64"
136+
},
137+
{
138+
"name": "Noble 6.12 aarch64",
139+
"ami": "0547f429681dc1f2a",
140+
"arch": "aarch64"
141+
}
142+
]

0 commit comments

Comments
 (0)