85628e73574433e2c7276ac65329973c70b0a732
[kconfig-hardened-check.git] / .github / workflows / main.yml
1 name: functional test
2
3 on:
4   push:
5     branches: [ master ]
6   pull_request:
7     branches: [ master ]
8
9 jobs:
10   check_all_configs:
11
12     runs-on: ubuntu-latest
13
14     strategy:
15       max-parallel: 4
16       fail-fast: false
17       matrix:
18         python-version: [3.6, 3.7, 3.8, 3.9]
19         # github runner with python 3.5 currently fails to install this package
20
21     steps:
22
23     - name: Set up Python ${{ matrix.python-version }}
24       uses: actions/setup-python@v1
25       with:
26         python-version: ${{ matrix.python-version }}
27
28     - name: Install package
29       run: |
30         python -m pip install --upgrade pip
31         pip install coverage
32         pip --verbose install git+https://github.com/a13xp0p0v/kconfig-hardened-check
33         echo ">>>>> first start <<<<<"
34         kconfig-hardened-check
35
36     - name: Check all configs
37       run: |
38         echo ">>>>> check all configs <<<<<"
39         CONFIG_DIR=`find /opt/hostedtoolcache/Python/ -name config_files`
40         CONFIGS=`find $CONFIG_DIR -type f | grep "\.config"`
41         COUNT=0
42         for C in $CONFIGS
43         do
44                 COUNT=$(expr $COUNT + 1)
45                 echo -e "\n>>>>> checking config number $COUNT <<<<<"
46                 kconfig-hardened-check -c $C
47         done
48         echo -e "\n>>>>> checking $COUNT configs is done <<<<<"
49
50     - name: Get source code
51       uses: actions/checkout@v2
52
53     - name: Collect coverage
54       run: |
55         echo ">>>>> get help <<<<<"
56         coverage run -a --branch bin/kconfig-hardened-check
57         coverage run -a --branch bin/kconfig-hardened-check -h
58
59         echo ">>>>> get version <<<<<"
60         coverage run -a --branch bin/kconfig-hardened-check --version
61
62         echo ">>>>> print the security hardening preferences <<<<<"
63         coverage run -a --branch bin/kconfig-hardened-check -p X86_64
64         coverage run -a --branch bin/kconfig-hardened-check -p X86_64 -m verbose
65         coverage run -a --branch bin/kconfig-hardened-check -p X86_64 -m json
66
67         coverage run -a --branch bin/kconfig-hardened-check -p X86_32
68         coverage run -a --branch bin/kconfig-hardened-check -p X86_32 -m verbose
69         coverage run -a --branch bin/kconfig-hardened-check -p X86_32 -m json
70
71         coverage run -a --branch bin/kconfig-hardened-check -p ARM64
72         coverage run -a --branch bin/kconfig-hardened-check -p ARM64 -m verbose
73         coverage run -a --branch bin/kconfig-hardened-check -p ARM64 -m json
74
75         coverage run -a --branch bin/kconfig-hardened-check -p ARM
76         coverage run -a --branch bin/kconfig-hardened-check -p ARM -m verbose
77         coverage run -a --branch bin/kconfig-hardened-check -p ARM -m json
78
79         echo ">>>>> check the example kconfig files <<<<<"
80         CONFIG_DIR=`find . -name config_files`
81         CONFIGS=`find $CONFIG_DIR -type f | grep "\.config"`
82         COUNT=0
83         for C in $CONFIGS
84         do
85                 COUNT=$(expr $COUNT + 1)
86                 echo -e "\n>>>>> checking config number $COUNT <<<<<"
87                 coverage run -a --branch bin/kconfig-hardened-check -c $C
88                 coverage run -a --branch bin/kconfig-hardened-check -c $C -m verbose > /dev/null
89                 coverage run -a --branch bin/kconfig-hardened-check -c $C -m json
90                 coverage run -a --branch bin/kconfig-hardened-check -c $C -m show_ok
91                 coverage run -a --branch bin/kconfig-hardened-check -c $C -m show_fail
92         done
93         echo -e "\n>>>>> checking $COUNT configs is done <<<<<"
94         coverage xml -i -o coverage.xml
95
96     - name: Handle coverage
97       uses: codecov/codecov-action@v1
98       with:
99         file: ./coverage.xml
100         flags: functional_test
101         name: codecov-umbrella
102         fail_ci_if_error: true
103
104