github: Run charon-tkm tests
[strongswan.git] / .github / workflows / tkm.yml
1 name: TKM
2
3 on: [push, pull_request]
4
5 env:
6   CCACHE_DIR: ${{ github.workspace }}/.ccache
7   CCACHE_CONTAINER: /root/.ccache
8   CCACHE_COMPILERCHECK: content
9   CCACHE_COMPRESS: true
10   CCACHE_MAXSIZE: 200M
11
12 jobs:
13   pre-check:
14     runs-on: ubuntu-latest
15     outputs:
16       should_skip: ${{ steps.skip-check.outputs.should_skip }}
17     steps:
18       - id: skip-check
19         uses: fkirc/skip-duplicate-actions@master
20         with:
21           concurrent_skipping: 'same_content'
22
23   tkm:
24     needs: pre-check
25     if: ${{ needs.pre-check.outputs.should_skip != 'true' }}
26     runs-on: ubuntu-latest
27     env:
28       TEST: tkm
29     steps:
30       - uses: actions/checkout@v2
31       - uses: actions/cache@v2
32         with:
33           path: ${{ env.CCACHE_DIR }}
34           key: ccache-tkm-${{ github.sha }}
35           restore-keys: |
36             ccache-tkm-
37       - name: Build Docker Image
38         run: docker build -t strongswan-tkm -f testing/tkm/Dockerfile testing
39       - name: Run Tests in Container
40         uses: addnab/docker-run-action@v3
41         with:
42           image: strongswan-tkm
43           shell: bash
44           options: |
45             --cap-add net_admin
46             -v ${{ github.workspace }}:/strongswan
47             -v ${{ env.CCACHE_DIR }}:${{ env.CCACHE_CONTAINER }}
48             -e CCACHE_DIR=${{ env.CCACHE_CONTAINER }}
49             -e CCACHE_COMPILERCHECK
50             -e CCACHE_COMPRESS
51             -e CCACHE_MAXSIZE
52           run: |
53             ccache -z
54             autoreconf -i /strongswan || exit 1
55             CFLAGS="-g -O2 -Wall -Wno-format -Wno-format-security -Wno-pointer-sign -Werror" \
56             /strongswan/configure --disable-defaults --enable-silent-rules \
57               --enable-ikev2 --enable-kernel-netlink --enable-openssl \
58               --enable-pem --enable-socket-default --enable-swanctl \
59               --enable-tkm || exit 1
60             # run tests without TKM first
61             make -j check TESTS_RUNNERS=tkm || exit 1
62
63             # generate TKM config
64             /usr/local/share/tkm/generate-config.sh
65
66             # start TKM in the background
67             tkm_keymanager -c tkm.conf -k key.der -r ca.der:1 >/tmp/tkm.log &
68             # run the tests against TKM and get TKM log
69             make -j check TESTS_RUNNERS=tkm TESTS_TKM=1 || exit 1
70             cat /tmp/tkm.log
71             ccache -s