github: Fix installation of Python dependencies
[strongswan.git] / .github / workflows / linux.yml
1 name: Linux
2
3 on: [push, pull_request]
4
5 env:
6   # this test case does not actually test anything but tries to access system
7   # directories that might be inaccessible on build hosts
8   TESTS_CASES_EXCLUDE: sw_collector
9   TESTS_REDUCED_KEYLENGTHS: yes
10   CCACHE_BASEDIR: ${{ github.workspace }}
11   CCACHE_COMPRESS: true
12   CCACHE_MAXSIZE: 200M
13   OS_NAME: linux
14
15 jobs:
16   pre-check:
17     runs-on: ubuntu-latest
18     outputs:
19       should_skip: ${{ steps.skip-check.outputs.should_skip }}
20     steps:
21       - id: skip-check
22         uses: fkirc/skip-duplicate-actions@master
23         with:
24           concurrent_skipping: 'same_content'
25
26   latest:
27     needs: pre-check
28     if: ${{ needs.pre-check.outputs.should_skip != 'true' }}
29     runs-on: ubuntu-latest
30     strategy:
31       matrix:
32         test: [ all, default, printf-builtin ]
33         compiler: [ gcc, clang ]
34         leak-detective: [ no, yes ]
35         monolithic: [ no, yes ]
36         exclude:
37           # leaks will show up whether we build monolithic or not
38           - leak-detective: yes
39             monolithic: yes
40           # monolithic builds don't affect the printf-hook implementation
41           - test: printf-builtin
42             monolithic: yes
43         include:
44           - test: apidoc
45           - test: coverage
46           - test: dist
47           - test: nm
48           - test: nm-no-glib
49           - test: fuzzing
50             compiler: clang
51             monolithic: yes
52     env:
53       LEAK_DETECTIVE: ${{ matrix.leak-detective || 'no' }}
54       MONOLITHIC: ${{ matrix.monolithic || 'no' }}
55       CC: ${{ matrix.compiler || 'gcc' }}
56       TEST: ${{ matrix.test }}
57     steps:
58       - uses: actions/checkout@v2
59       - uses: actions/cache@v2
60         with:
61           path: ~/.ccache
62           # with regards to ccache, monolithic builds don't differ from regular
63           # builds and, similarly, builds with leak-detective only differ in two
64           # files (LD itself and library.c); but different tests build different
65           # dependencies, so different caches are needed
66           key: ccache-${{ runner.os }}-${{ env.CC }}-${{ matrix.test }}-${{ github.ref }}:${{ github.sha }}
67           restore-keys: |
68             ccache-${{ runner.os }}-${{ env.CC }}-${{ matrix.test }}-${{ github.ref }}:
69             ccache-${{ runner.os }}-${{ env.CC }}-${{ matrix.test }}-
70             ccache-${{ runner.os }}-${{ env.CC }}-
71       - run: |
72           sudo apt-get install -qq ccache
73           echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
74           ccache -z
75       - uses: ./.github/actions/default
76       - run: ccache -s
77       - if: ${{ success() && matrix.test == 'coverage' }}
78         run: bash <(curl -s https://codecov.io/bash)
79       - if: ${{ failure() }}
80         uses: actions/upload-artifact@v2
81         with:
82           name: Logs ${{ github.job }}
83           path: config.log
84           retention-days: 5
85
86   crypto-plugins:
87     needs: pre-check
88     if: ${{ needs.pre-check.outputs.should_skip != 'true' }}
89     runs-on: ubuntu-latest
90     strategy:
91       matrix:
92         test: [ botan, wolfssl, openssl, gcrypt ]
93         leak-detective: [ no, yes ]
94     env:
95       LEAK_DETECTIVE: ${{ matrix.leak-detective || 'no' }}
96       TEST: ${{ matrix.test }}
97     steps:
98       - uses: actions/checkout@v2
99       - uses: actions/cache@v2
100         with:
101           path: ~/.ccache
102           key: ccache-${{ runner.os }}-${{ env.CC }}-${{ matrix.test }}-${{ github.ref }}:${{ github.sha }}
103           restore-keys: |
104             ccache-${{ runner.os }}-${{ env.CC }}-${{ matrix.test }}-${{ github.ref }}:
105             ccache-${{ runner.os }}-${{ env.CC }}-${{ matrix.test }}-
106             ccache-${{ runner.os }}-${{ env.CC }}-
107             ccache-${{ runner.os }}-${{ env.CC }}-all-${{ github.ref }}:${{ github.sha }}
108             ccache-${{ runner.os }}-${{ env.CC }}-all-${{ github.ref }}:
109             ccache-${{ runner.os }}-${{ env.CC }}-all-
110             ccache-${{ runner.os }}-${{ env.CC }}-
111       - run: |
112           sudo apt-get install -qq ccache
113           echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
114           ccache -z
115       - uses: ./.github/actions/default
116       - run: ccache -s
117       - if: ${{ failure() }}
118         uses: actions/upload-artifact@v2
119         with:
120           name: Logs ${{ github.job }}
121           path: config.log
122           retention-days: 5
123
124   xenial:
125     needs: pre-check
126     if: ${{ needs.pre-check.outputs.should_skip != 'true' }}
127     runs-on: ubuntu-16.04
128     strategy:
129       matrix:
130         test: [ all ]
131         compiler: [ gcc, clang ]
132         include:
133           - test: openssl-1.0
134           - test: openssl-1.0
135             leak-detective: yes
136     env:
137       LEAK_DETECTIVE: ${{ matrix.leak-detective || 'no' }}
138       CC: ${{ matrix.compiler || 'gcc' }}
139       TEST: ${{ matrix.test }}
140       UBUNTU_XENIAL: yes
141       # this is the default with newer versions and fixes builds with clang
142       CCACHE_CPP2: true
143     steps:
144       - uses: actions/checkout@v2
145       - uses: actions/cache@v2
146         with:
147           path: ~/.ccache
148           key: ccache-xenial-${{ env.CC }}-${{ matrix.test }}-${{ github.ref }}:${{ github.sha }}
149           restore-keys: |
150             ccache-xenial-${{ env.CC }}-${{ matrix.test }}-${{ github.ref }}:
151             ccache-xenial-${{ env.CC }}-${{ matrix.test }}-
152             ccache-xenial-${{ env.CC }}-
153       - run: |
154           sudo apt-get install -qq ccache
155           echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
156           ccache -z
157       - uses: ./.github/actions/default
158       - run: ccache -s
159       - if: ${{ failure() }}
160         uses: actions/upload-artifact@v2
161         with:
162           name: Logs ${{ github.job }}
163           path: config.log
164           retention-days: 5