functional_test.yml 1.92 KB
name: functional test

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:
  functional_test:

    runs-on: ubuntu-latest

    strategy:
      max-parallel: 1
      fail-fast: false
      matrix:
        # Current ubuntu-latest (Ubuntu 22.04) provides the following versions of Python:
        python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']

    steps:

    - name: Set up Python ${{ matrix.python-version }}
      uses: actions/setup-python@v4
      with:
        python-version: ${{ matrix.python-version }}

    - name: Install package
      run: |
        python -m pip install --upgrade pip
        echo "Install the package via pip..."
        pip --verbose install git+https://github.com/a13xp0p0v/kconfig-hardened-check
        echo "Run the installed tool..."
        kconfig-hardened-check

    - name: Check all configs with the installed tool
      run: |
        echo "Check all configs with the installed tool..."
        CONFIG_DIR=`find /opt/hostedtoolcache/Python/ -name config_files`
        KCONFIGS=`find $CONFIG_DIR -type f | grep -e "\.config" -e "\.gz"`
        COUNT=0
        for C in $KCONFIGS
        do
                COUNT=$(expr $COUNT + 1)
                echo -e "\n>>>>> checking kconfig number $COUNT <<<<<"
                kconfig-hardened-check -c $C -l /proc/cmdline
        done
        echo -e "\nHave checked $COUNT kconfigs"

    - name: Get source code for collecting coverage
      uses: actions/checkout@v3

    - name: Run the functional tests and collect the coverage
      run: |
        pip install coverage
        sh .github/workflows/functional_test.sh

    - name: Prepare final coverage report
      run: |
        coverage xml -i -o coverage.xml

    - name: Handle coverage
      uses: codecov/codecov-action@v3
      with:
        files: ./coverage.xml
        flags: functional_test
        name: functional_test_upload
        fail_ci_if_error: true
        verbose: true