Fixing code coverage for native tests (#365) #186
This file contains 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: test and release CI | |
on: | |
push: | |
branches: | |
- main | |
- '*.preview' | |
pull_request: | |
branches: | |
- main | |
- '*.preview' | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
container: ghcr.io/opencyphal/toxic:tx22.4.3 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: lint | |
run: tox -e lint | |
- name: test-nnvg | |
run: tox -e py311-nnvg | |
- name: test-doctest | |
run: tox -e py311-doctest,py311-rstdoctest | |
- name: test-pytest | |
run: tox -e py311-test | |
- name: test-report | |
run: tox -e report | |
- name: package | |
run: tox -e package | |
- name: upload-coverage-reports | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coverage-reports | |
path: .tox/report/tmp/* | |
- name: upload-xunit-results | |
uses: actions/upload-artifact@v4 | |
with: | |
name: xunit-results | |
path: .tox/py311-test/tmp/xunit-result.xml | |
- name: upload-package | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pypi-package | |
path: .tox/package/dist/* | |
sonar: | |
runs-on: ubuntu-latest | |
needs: test | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
# Disabling shallow clone is recommended for improving relevancy of reporting | |
fetch-depth: 0 | |
- name: download-coverage-reports | |
uses: actions/download-artifact@v4 | |
with: | |
name: coverage-reports | |
path: .tox/report/tmp/ | |
- name: download-xunit-results | |
uses: actions/download-artifact@v4 | |
with: | |
name: xunit-results | |
path: .tox/py311-test/tmp/ | |
- name: set-environment | |
run: | | |
echo NUNAVUT_MAJOR_MINOR_VERSION=$(./version_check_nunavut --major-minor-version-only) >> $GITHUB_ENV | |
- name: verify tox artifacts | |
run: ls -R | |
working-directory: .tox | |
- name: report-release | |
if: ${{ github.event_name != 'pull_request' }} | |
uses: SonarSource/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }} | |
with: | |
args: > | |
-Dsonar.token=${{ env.SONAR_TOKEN }} | |
-Dsonar.buildString=${{ env.GITHUB_RUN_ID }} | |
-Dsonar.projectVersion=${{ env.NUNAVUT_MAJOR_MINOR_VERSION }} | |
-Dsonar.python.version=python3.11 | |
-Dsonar.python.coverage.reportPaths=.tox/report/tmp/coverage.xml | |
-Dsonar.python.xunit.reportPath=.tox/py311-test/tmp/xunit-result.xml | |
- name: report-pr | |
if: ${{ github.event_name == 'pull_request' }} | |
uses: SonarSource/[email protected] | |
env: | |
SONAR_TOKEN: "6526e88c286672a7852fea52056c4b6ea583aaf7" | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
args: > | |
-Dsonar.token=${{ env.SONAR_TOKEN }} | |
-Dsonar.buildString=${{ env.GITHUB_RUN_ID }} | |
-Dsonar.projectVersion=${{ env.NUNAVUT_MAJOR_MINOR_VERSION }} | |
-Dsonar.python.version=python3.11 | |
-Dsonar.python.coverage.reportPaths=.tox/report/tmp/coverage.xml | |
-Dsonar.python.xunit.reportPath=.tox/py311-test/tmp/xunit-result.xml | |
compat-test-python3-mac: | |
strategy: | |
matrix: | |
python3-version: ['11', '12', '13'] | |
python3-platform: ['macos-latest'] | |
runs-on: ${{ matrix.python3-platform }} | |
needs: test | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: setup python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.${{ matrix.python3-version }} | |
- name: setup tox | |
run: pip3 install tox | |
- name: python3.${{ matrix.python3-version }} test | |
run: tox -e py3${{ matrix.python3-version }}-nnvg,py3${{ matrix.python3-version }}-test | |
compat-test-python3-ubuntu: | |
strategy: | |
matrix: | |
python3-version: ['8', '9', '10', '11', '12', '13'] | |
runs-on: ubuntu-latest | |
container: ghcr.io/opencyphal/toxic:tx22.4.3 | |
needs: test | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: python3.${{ matrix.python3-version }} test | |
run: tox -e py3${{ matrix.python3-version }}-nnvg,py3${{ matrix.python3-version }}-test | |
language-verification-c: | |
runs-on: ubuntu-latest | |
needs: test | |
container: ghcr.io/opencyphal/toolshed:ts22.4.10 | |
strategy: | |
matrix: | |
architecture: [native32, native] | |
compiler: [gcc, clang] | |
exclude: | |
- architecture: native32 | |
compiler: clang | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: verify | |
# We're using Ninja multi-config so we only have to configure once for all build types | |
working-directory: verification | |
run: | | |
cmake -DNUNAVUT_EXTRA_GENERATOR_ARGS=--embed-auditing-info --preset config-${{ matrix.compiler }}-${{ matrix.architecture }}-c-11 | |
cmake --build --preset build-${{ matrix.compiler }}-${{ matrix.architecture }}-c-11-release | |
cmake --build --preset build-${{ matrix.compiler }}-${{ matrix.architecture }}-c-11-debugasan | |
language-verification-cpp: | |
runs-on: ubuntu-latest | |
needs: test | |
container: ghcr.io/opencyphal/toolshed:ts22.4.10 | |
strategy: | |
matrix: | |
architecture: [native32, native] | |
compiler: [gcc, clang] | |
language: [cpp-14, cpp-17, cpp-20] | |
exclude: | |
- architecture: native32 | |
compiler: clang | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: verify | |
working-directory: verification | |
run: | | |
cmake -DNUNAVUT_EXTRA_GENERATOR_ARGS=--embed-auditing-info --preset config-${{ matrix.compiler }}-${{ matrix.architecture }}-${{ matrix.language }} | |
cmake --build --preset build-${{ matrix.compiler }}-${{ matrix.architecture }}-${{ matrix.language }}-debugasan | |
cmake --build --preset build-${{ matrix.compiler }}-${{ matrix.architecture }}-${{ matrix.language }}-release | |
language-verification-c-cpp-clang-native-extra: | |
runs-on: ubuntu-latest | |
needs: test | |
container: ghcr.io/opencyphal/toolshed:ts22.4.10 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: verify | |
working-directory: verification | |
run: | | |
cmake -DNUNAVUT_EXTRA_GENERATOR_ARGS="--enable-override-variable-array-capacity;--embed-auditing-info" --preset config-clang-native-cpp-20 | |
cmake --build --preset build-clang-native-cpp-20-debugcov --target cov_all | |
cmake -DNUNAVUT_EXTRA_GENERATOR_ARGS="--enable-override-variable-array-capacity;--embed-auditing-info" --preset config-clang-native-c-11 | |
cmake --build --preset build-clang-native-c-11-debugcov --target cov_all | |
- name: upload-verification-coverage-reports | |
uses: actions/upload-artifact@v4 | |
with: | |
name: verification-coverage-reports | |
path: verification/build/DebugCov/coverage/* | |
language-verification-python: | |
runs-on: ubuntu-latest | |
needs: test | |
container: ghcr.io/opencyphal/toxic:tx22.4.3 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: verify | |
run: | | |
cd verification/python | |
nox | |
env: | |
FORCE_COLOR: 1 | |
continue-on-error: true |