Skip to content

Commit 2e80cac

Browse files
committed
wip
1 parent 333dac5 commit 2e80cac

File tree

1 file changed

+115
-112
lines changed

1 file changed

+115
-112
lines changed

Diff for: .github/workflows/ci.yaml

+115-112
Original file line numberDiff line numberDiff line change
@@ -23,112 +23,117 @@ permissions:
2323
pull-requests: write
2424

2525
jobs:
26-
# create-images:
27-
# timeout-minutes: 15
28-
# strategy:
29-
# matrix:
30-
# host:
31-
# - { name: ubuntu-24.04, arch: x64 }
32-
# - { name: 4-core-ubuntu-arm, arch: arm64 }
33-
# distribution:
34-
# - { name: fedora, version: "41" }
35-
# - { name: fedora, version: "40" }
36-
# - { name: fedora, version: "39" }
37-
# - { name: ubuntu, version: "24.10" }
38-
# - { name: ubuntu, version: "24.04" }
39-
# runs-on: [ "${{ matrix.host.name }}" ]
40-
# name: "Image: ${{ matrix.distribution.name }} ${{ matrix.distribution.version }} (${{ matrix.host.arch}})"
41-
# steps:
42-
# - name: Checkout bpfilter
43-
# uses: actions/checkout@v2
44-
# - name: Set up Docker Buildx
45-
# uses: docker/setup-buildx-action@v3
46-
# - name: Log to GHCR
47-
# uses: docker/login-action@v2
48-
# with:
49-
# registry: ${{ env.REGISTRY }}
50-
# username: ${{ github.actor }}
51-
# password: ${{ secrets.GITHUB_TOKEN }}
52-
# # Build the container images and use the existing images as cache
53-
# - name: Build and push container image
54-
# uses: docker/build-push-action@v4
55-
# with:
56-
# file: .github/${{ matrix.distribution.name }}-${{ matrix.distribution.version }}.Dockerfile
57-
# push: ${{ github.ref == 'refs/heads/main' && 'true' || 'false' }}
58-
# tags: ghcr.io/facebook/bpfilter:${{ matrix.distribution.name }}-${{ matrix.distribution.version }}-${{ matrix.host.arch}}
59-
# cache-from: type=gha,scope=${{ matrix.distribution.name }}-${{ matrix.distribution.version }}-${{ matrix.host.arch}}
60-
# cache-to: type=gha,mode=max,scope=${{ matrix.distribution.name }}-${{ matrix.distribution.version }}-${{ matrix.host.arch}}
26+
create-images:
27+
timeout-minutes: 15
28+
strategy:
29+
matrix:
30+
host:
31+
- { name: ubuntu-24.04, arch: x64 }
32+
- { name: 4-core-ubuntu-arm, arch: arm64 }
33+
distribution:
34+
- { name: fedora, version: "41" }
35+
- { name: fedora, version: "40" }
36+
- { name: fedora, version: "39" }
37+
- { name: ubuntu, version: "24.10" }
38+
- { name: ubuntu, version: "24.04" }
39+
runs-on: [ "${{ matrix.host.name }}" ]
40+
name: "Image: ${{ matrix.distribution.name }} ${{ matrix.distribution.version }} (${{ matrix.host.arch}})"
41+
steps:
42+
- name: Checkout bpfilter
43+
uses: actions/checkout@v2
44+
- name: Set up Docker Buildx
45+
uses: docker/setup-buildx-action@v3
46+
- name: Log to GHCR
47+
uses: docker/login-action@v2
48+
with:
49+
registry: ${{ env.REGISTRY }}
50+
username: ${{ github.actor }}
51+
password: ${{ secrets.GITHUB_TOKEN }}
52+
# Build the container images and use the existing images as cache
53+
- name: Build and push container image
54+
uses: docker/build-push-action@v4
55+
with:
56+
file: .github/${{ matrix.distribution.name }}-${{ matrix.distribution.version }}.Dockerfile
57+
push: ${{ github.ref == 'refs/heads/main' && 'true' || 'false' }}
58+
tags: ghcr.io/facebook/bpfilter:${{ matrix.distribution.name }}-${{ matrix.distribution.version }}-${{ matrix.host.arch}}
59+
cache-from: type=gha,scope=${{ matrix.distribution.name }}-${{ matrix.distribution.version }}-${{ matrix.host.arch}}
60+
cache-to: type=gha,mode=max,scope=${{ matrix.distribution.name }}-${{ matrix.distribution.version }}-${{ matrix.host.arch}}
6161

62-
# build:
63-
# needs: create-images
64-
# timeout-minutes: 5
65-
# strategy:
66-
# matrix:
67-
# host:
68-
# - { name: ubuntu-24.04, arch: x64 }
69-
# - { name: 4-core-ubuntu-arm, arch: arm64 }
70-
# distribution:
71-
# - { name: fedora, version: "41" }
72-
# - { name: fedora, version: "40" }
73-
# - { name: fedora, version: "39" }
74-
# - { name: ubuntu, version: "24.10" }
75-
# - { name: ubuntu, version: "24.04" }
76-
# runs-on: [ "${{ matrix.host.name }}" ]
77-
# container: ghcr.io/facebook/bpfilter:${{ matrix.distribution.name }}-${{ matrix.distribution.version }}-${{ matrix.host.arch}}
78-
# name: "Build: ${{ matrix.distribution.name }} ${{ matrix.distribution.version }} (${{ matrix.host.arch}})"
79-
# steps:
80-
# - name: Checkout bpfilter
81-
# uses: actions/checkout@v2
82-
# - name: Configure the build
83-
# run: cmake -S $GITHUB_WORKSPACE -B $GITHUB_WORKSPACE/build
84-
# - name: Build all
85-
# run: make -C $GITHUB_WORKSPACE/build -j `nproc`
62+
build:
63+
needs: create-images
64+
timeout-minutes: 5
65+
strategy:
66+
matrix:
67+
host:
68+
- { name: ubuntu-24.04, arch: x64 }
69+
- { name: 4-core-ubuntu-arm, arch: arm64 }
70+
distribution:
71+
- { name: fedora, version: "41" }
72+
- { name: fedora, version: "40" }
73+
- { name: fedora, version: "39" }
74+
- { name: ubuntu, version: "24.10" }
75+
- { name: ubuntu, version: "24.04" }
76+
runs-on: [ "${{ matrix.host.name }}" ]
77+
container: ghcr.io/facebook/bpfilter:${{ matrix.distribution.name }}-${{ matrix.distribution.version }}-${{ matrix.host.arch}}
78+
name: "Build: ${{ matrix.distribution.name }} ${{ matrix.distribution.version }} (${{ matrix.host.arch}})"
79+
steps:
80+
- name: Checkout bpfilter
81+
uses: actions/checkout@v2
82+
- name: Configure the build
83+
run: cmake -S $GITHUB_WORKSPACE -B $GITHUB_WORKSPACE/build
84+
- name: Build all
85+
run: make -C $GITHUB_WORKSPACE/build -j `nproc`
8686

87-
# check:
88-
# needs: create-images
89-
# timeout-minutes: 5
90-
# runs-on: [ "ubuntu-24.04" ]
91-
# container: ghcr.io/facebook/bpfilter:fedora-41-x64
92-
# name: "Check"
93-
# steps:
94-
# - name: Checkout bpfilter
95-
# uses: actions/checkout@v2
96-
# - name: Configure the build
97-
# run: cmake -S $GITHUB_WORKSPACE -B $GITHUB_WORKSPACE/build
98-
# - name: Build
99-
# run: make -C $GITHUB_WORKSPACE/build -j `nproc` check
87+
check:
88+
needs: create-images
89+
timeout-minutes: 5
90+
runs-on: [ "ubuntu-24.04" ]
91+
container: ghcr.io/facebook/bpfilter:fedora-41-x64
92+
name: "Check"
93+
steps:
94+
- name: Checkout bpfilter
95+
uses: actions/checkout@v2
96+
- name: Configure the build
97+
run: cmake -S $GITHUB_WORKSPACE -B $GITHUB_WORKSPACE/build
98+
- name: Build
99+
run: make -C $GITHUB_WORKSPACE/build -j `nproc` check
100100

101-
# test:
102-
# needs: create-images
103-
# timeout-minutes: 5
104-
# strategy:
105-
# matrix:
106-
# host:
107-
# - { name: ubuntu-24.04, arch: x64 }
108-
# - { name: 4-core-ubuntu-arm, arch: arm64 }
109-
# runs-on: [ "${{ matrix.host.name }}" ]
110-
# container:
111-
# image: ghcr.io/facebook/bpfilter:fedora-41-${{ matrix.host.arch }}
112-
# options: --privileged
113-
# name: "Test: ${{ matrix.host.arch }}"
114-
# steps:
115-
# - name: Checkout bpfilter
116-
# uses: actions/checkout@v2
117-
# - name: Setup the cache mechanism
118-
# uses: actions/cache@v4
119-
# if: ${{ matrix.host.arch }} == "x64"
120-
# with:
121-
# path: build/output/tests
122-
# key: tests-results
123-
# - name: Configure the build
124-
# run: cmake -S $GITHUB_WORKSPACE -B $GITHUB_WORKSPACE/build
125-
# - name: Build
126-
# run: make -C $GITHUB_WORKSPACE/build -j `nproc` test
127-
# - name: Build
128-
# run: make -C $GITHUB_WORKSPACE/build -j `nproc` e2e
101+
test:
102+
needs: create-images
103+
timeout-minutes: 5
104+
strategy:
105+
matrix:
106+
host:
107+
- { name: ubuntu-24.04, arch: x64 }
108+
- { name: 4-core-ubuntu-arm, arch: arm64 }
109+
runs-on: [ "${{ matrix.host.name }}" ]
110+
container:
111+
image: ghcr.io/facebook/bpfilter:fedora-41-${{ matrix.host.arch }}
112+
options: --privileged
113+
name: "Test: ${{ matrix.host.arch }}"
114+
steps:
115+
- name: Checkout bpfilter
116+
uses: actions/checkout@v2
117+
- name: Restore the cached test results
118+
uses: actions/restore@v4
119+
with:
120+
path: build/output/tests
121+
key: tests-results
122+
- name: Configure the build
123+
run: cmake -S $GITHUB_WORKSPACE -B $GITHUB_WORKSPACE/build
124+
- name: Build
125+
run: make -C $GITHUB_WORKSPACE/build -j `nproc` test
126+
- name: Build
127+
run: make -C $GITHUB_WORKSPACE/build -j `nproc` e2e
128+
- name: Cache the test results
129+
uses: actions/save@v4
130+
if: matrix.host.arch == 'x64' && github.ref == 'refs/heads/main'
131+
with:
132+
path: build/output/tests
133+
key: tests-results
129134

130135
benchmark:
131-
# needs: create-images
136+
needs: create-images
132137
timeout-minutes: 5
133138
strategy:
134139
matrix:
@@ -147,24 +152,22 @@ jobs:
147152
run: git config --global --add safe.directory $GITHUB_WORKSPACE
148153
- name: Configure the build
149154
run: cmake -S $GITHUB_WORKSPACE -B $GITHUB_WORKSPACE/build -DWITH_BENCHMARK=on
150-
- name: Setup the cache mechanism
151-
uses: actions/cache@v4
152-
if: matrix.host.arch == 'x64'
155+
- name: Restore the cached benchmark results
156+
uses: actions/cache/restore@v4
153157
with:
154158
path: build/output/benchmarks
155159
key: benchmarks-results
156-
- name: cache content
157-
if: matrix.host.arch == 'x64'
158-
run: ls build/output/benchmarks
159160
- name: Build
160161
run: make -C $GITHUB_WORKSPACE/build -j `nproc` benchmark
161-
- name: cache content
162-
if: matrix.host.arch == 'x64'
163-
run: ls build/output/benchmarks
162+
- name: Cache the benchmark results
163+
uses: actions/cache/save@v4
164+
if: matrix.host.arch == 'x64' && github.ref == 'refs/heads/main'
165+
with:
166+
path: build/output/benchmarks
167+
key: benchmarks-results
164168

165169
doc:
166-
# needs: [ test, benchmark ]
167-
needs: [benchmark]
170+
needs: [ test, benchmark ]
168171
timeout-minutes: 5
169172
runs-on: [ "ubuntu-24.04" ]
170173
container: ghcr.io/facebook/bpfilter:fedora-41-x64

0 commit comments

Comments
 (0)