Debian Codegraph @

.github/workflows/test.yml

raw symbols SCIP
1 name: test
2 on:
3 push:
4 tags:
5 - v*
6 branches:
7 - main
8 - master
9 - release-*
10 pull_request:
11
12 jobs:
13 test:
14 runs-on: ubuntu-24.04
15 strategy:
16 fail-fast: false
17 matrix:
18 go-version: [1.23.x, 1.24.x]
19 libseccomp: ["v2.3.3", "v2.4.4", "v2.5.6", "v2.6.0", "HEAD"]
20
21 steps:
22
23 - name: checkout
24 uses: actions/checkout@v4
25
26 - name: build libseccomp ${{ matrix.libseccomp }}
27 run: |
28 set -x
29 sudo apt -qq update
30 sudo apt -qq install gperf
31
32 PREFIX="$(pwd)/seccomp"
33 LIBDIR="$PREFIX/lib"
34
35 git clone https://github.com/seccomp/libseccomp
36 cd libseccomp
37 git checkout ${{ matrix.libseccomp }}
38 # In main branch, configure.ac sets libseccomp version to 0.0.0, which
39 # results in error when compiling libseccomp-golang. While 0.0.0 is
40 # there for a reason, here we need to build and test against HEAD, so
41 # set it to a suitable value.
42 #
43 # Version 9.9.9 is used because:
44 # - version >= current is needed;
45 # - chances are good such version won't ever exist;
46 # - it is easy to spot in tests output;
47 # - the LIBFILE pattern below expects single digits.
48 VER="${{ matrix.libseccomp }}"
49 if [ "$VER" == "HEAD" ]; then
50 VER=9.9.9
51 sed -i "/^AC_INIT(/s/0\.0\.0/$VER/" configure.ac
52 fi
53 ./autogen.sh
54 ./configure --prefix="$PREFIX" --libdir="$LIBDIR"
55 make
56 sudo make install
57 cd -
58 rm -rf libseccomp
59
60 # For the next steps to build and execute with the compiled library.
61 echo "PKG_CONFIG_LIBDIR=$LIBDIR/pkgconfig" >> $GITHUB_ENV
62 LIBFILE="$(echo $LIBDIR/libseccomp.so.?.?.?)"
63 echo "LD_PRELOAD=$LIBFILE" >> $GITHUB_ENV
64 # For TestExpectedSeccompVersion.
65 echo "_EXPECTED_LIBSECCOMP_VERSION=$VER" >> $GITHUB_ENV
66
67 - name: install go ${{ matrix.go-version }}
68 uses: actions/setup-go@v5
69 with:
70 go-version: ${{ matrix.go-version }}
71 # Add libseccomp.pc path so that setup-go adds this file hash to cache key.
72 # This way, we'll have different caches for different libseccomp versions.
73 cache-dependency-path: |
74 go.sum
75 ${{ env.PKG_CONFIG_LIBDIR }}/libseccomp.pc
76
77
78 - name: build
79 run: make check-build
80
81 - name: test
82 run: make test
83
84 all-done:
85 needs:
86 - test
87 runs-on: ubuntu-24.04
88 steps:
89 - run: echo "All jobs completed"