Fix workaround for xunit test results #253
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build | |
| on: # Run the workflow for each of the following events: | |
| push: # - A branch is pushed or updated. | |
| paths-ignore: | |
| - 'README.md' | |
| pull_request: # - A pull-request is opened or updated. | |
| paths-ignore: | |
| - 'README.md' | |
| workflow_dispatch: # - A manual run of the workflow is requested from the GitHub web interface. | |
| release: | |
| types: [created] # - A release is created. | |
| jobs: | |
| main: | |
| strategy: | |
| fail-fast: false # Don't stop all the workflows when one of them fails. | |
| matrix: | |
| os: [ubuntu-22.04, windows-latest, macos-14] # List of GitHub Actions platform to run the workflow on | |
| env: | |
| # For WolfSSL: | |
| # set the value of the environment variable OS to Windows when running on the Windows operating system and to Linux_Or_Mac otherwise | |
| OS: ${{ matrix.os == 'windows-latest' && 'Windows' || 'Linux_Or_Mac' }} | |
| # On Windows, the validation profile fails due to "(style) incorrect line terminator [-gnatyd]" | |
| PROFILE: ${{ matrix.os == 'windows-latest' && 'development' || 'validation' }} | |
| # Switches to enable code coverage with gcov | |
| COVERAGE_SWITCHES: "-XCOVERAGE=gcov -cargs -O0 -fno-inline --coverage -largs --coverage" | |
| runs-on: ${{ matrix.os }} # Run the continuous integration workflow on each OS listed in the matrix. | |
| steps: | |
| # Check-out the repository | |
| - uses: actions/checkout@v2 | |
| with: | |
| submodules: 'true' # Also checkout recursively the submodules | |
| # Install and setup Alire package manager | |
| - uses: alire-project/setup-alire@v2 | |
| with: | |
| version: 2.1.0 # Remove this option to use the default (latest stable release) | |
| # Build the project using the validation build profile to enforce static analysis and coding style. | |
| - name: Build library | |
| run: alr --non-interactive build --$PROFILE -- $COVERAGE_SWITCHES | |
| shell: bash | |
| # Build the test programs using the validation build profile to enforce static analysis and coding style. | |
| - name: Build test client | |
| run: alr -C client --non-interactive build --profiles="*=$PROFILE" -- $COVERAGE_SWITCHES | |
| shell: bash | |
| - name: Build test server | |
| run: alr -C server --non-interactive build --profiles="*=$PROFILE" -- $COVERAGE_SWITCHES | |
| shell: bash | |
| # Install binary crates needed for testing | |
| - name: Install binary crates | |
| run: | | |
| git clone --depth 1 https://github.com/LionelDraghi/bbt.git | |
| alr --non-interactive -C bbt install | |
| shell: bash | |
| # Run the instrumented testsuite. This will produce *.gcno and *.gcda files for the coverage analysis. | |
| - name: Library Aunit tests | |
| run: | | |
| cd tests | |
| alr --non-interactive build --profiles="*=$PROFILE" -- $COVERAGE_SWITCHES | |
| echo "## Aunit test results" >> $GITHUB_STEP_SUMMARY | |
| NO_COLOR=1 bin/tests >> $GITHUB_STEP_SUMMARY | |
| shell: bash | |
| # On Linux we can run all the testsuite, after installing coap-server-openssl from libcoap3-bin package. | |
| - if: runner.os == 'Linux' | |
| name: Client tests (CoAP and secure CoAP) | |
| run: | | |
| sudo apt install libcoap3-bin | |
| PATH=$HOME/.alire/bin:$PATH make -C client/tests | |
| shell: bash | |
| # On Windows and macOS we can only run the plain CoAP tests. | |
| - if: runner.os == 'Windows' || runner.os == 'macOS' | |
| name: Client tests (CoAP only) | |
| run: PATH=$HOME/.alire/bin:$PATH make -C client/tests coap_results.md | |
| shell: bash | |
| # Run server tests | |
| - if: runner.os == 'Windows' || runner.os == 'Linux' | |
| name: Server tests | |
| run: | | |
| PATH=$HOME/.alire/bin:$PATH make -C server/tests | |
| shell: bash | |
| - if: runner.os == 'macOS' | |
| name: Server tests (CoAP only on macOS) | |
| run: | | |
| PATH=$HOME/.alire/bin:$PATH make -C server/tests coap_results.md | |
| shell: bash | |
| - name: CoAP test results | |
| run: cat client/tests/coap*_results.md server/tests/coap*_results.md >> $GITHUB_STEP_SUMMARY | |
| shell: bash | |
| # Run gcov on the library, the tests and the test programs. This will produce *.gcov files. | |
| # The library source files are splitted in parts, otherwise gcov fails with | |
| # an unexpected error. | |
| - name: Run gcov | |
| run: | | |
| alr exec -- gcov -o obj/$PROFILE src/rflx*.ad[sb] | |
| alr exec -- gcov -o obj/$PROFILE src/coap_spark*.ad[sb] src/workarounds.ad[sb] | |
| for dir in tests client server | |
| do | |
| cd $dir | |
| alr exec -- gcov -o obj/$PROFILE src/*.ad[sb] | |
| cd - | |
| done | |
| shell: bash | |
| # Upload results to codecov.io | |
| - if: runner.os == 'Linux' | |
| name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| fail_ci_if_error: true # optional (default = false) | |
| name: codecov-umbrella # optional | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| verbose: true # optional (default = false) | |
| - name: Upload test results to Codecov | |
| if: ${{ !cancelled() }} | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| files: server/tests/coap_results.xml,server/tests/coaps_results.xml,client/tests/coap_results.xml,client/tests/coaps_results.xml | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| report_type: test_results |