ci: move upload to Codecov to separate job #292
Workflow file for this run
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: CI | |
on: # yamllint disable-line rule:truthy | |
- push | |
- pull_request | |
# Note: ca-certificates and git are needed for actions/checkout to use git | |
# which is needed for codecov/codecov-action. | |
jobs: | |
install: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
container: | |
- debian:bookworm-slim | |
- debian:testing-slim | |
- debian:unstable-slim | |
- ubuntu:jammy | |
- ubuntu:noble | |
- ubuntu:oracular | |
container: | |
image: ${{ matrix.container }} | |
options: --privileged | |
steps: | |
- name: Sanitize container name (for artifact name) | |
run: | | |
container=$(echo "${{ matrix.container }}" | sed 's/:/-/') | |
echo "JOB=${GITHUB_JOB}-${container}" >> "$GITHUB_ENV" | |
- name: Install dependencies | |
run: > | |
apt-get update && | |
apt-get install --no-install-recommends --yes pandoc python3 | |
python3-coverage python3-ruamel.yaml python3-setuptools | |
- uses: actions/checkout@v4 | |
- name: Run build | |
run: python3 -m coverage run --branch setup.py build | |
- name: Run install | |
run: python3 -m coverage run -a --branch setup.py install | |
- name: Run clean | |
run: python3 -m coverage run -a --branch setup.py clean | |
- name: Coverage report | |
run: python3 -m coverage xml | |
- name: Upload coverage | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coverage-${{ env.JOB }} | |
path: ./coverage.xml | |
unittest: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
container: | |
- debian:bookworm-slim | |
- debian:testing-slim | |
- debian:unstable-slim | |
- ubuntu:jammy | |
- ubuntu:noble | |
- ubuntu:oracular | |
container: | |
image: ${{ matrix.container }} | |
steps: | |
- name: Sanitize container name (for artifact name) | |
run: | | |
container=$(echo "${{ matrix.container }}" | sed 's/:/-/') | |
echo "JOB=${GITHUB_JOB}-${container}" >> "$GITHUB_ENV" | |
- name: Install dependencies | |
run: > | |
apt-get update && | |
apt-get install --no-install-recommends --yes black isort pylint | |
python3 python3-coverage python3-flake8 python3-ruamel.yaml shellcheck | |
- uses: actions/checkout@v4 | |
- name: Run unit tests | |
run: | | |
python3 -m coverage run -m unittest discover -v | |
python3 -m coverage xml | |
- name: Upload coverage | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coverage-${{ env.JOB }} | |
path: ./coverage.xml | |
skip-linters: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
container: | |
- debian:bookworm-slim | |
- debian:testing-slim | |
- debian:unstable-slim | |
- ubuntu:jammy | |
- ubuntu:noble | |
- ubuntu:oracular | |
container: | |
image: ${{ matrix.container }} | |
steps: | |
- name: Sanitize container name (for artifact name) | |
run: | | |
container=$(echo "${{ matrix.container }}" | sed 's/:/-/') | |
echo "JOB=${GITHUB_JOB}-${container}" >> "$GITHUB_ENV" | |
- name: Install dependencies | |
run: > | |
apt-get update && | |
apt-get install --no-install-recommends --yes pylint python3 | |
python3-coverage python3-ruamel.yaml | |
- uses: actions/checkout@v4 | |
- name: Run unit tests | |
run: | | |
SKIP_LINTERS=1 python3 -m coverage run -m unittest discover -v | |
python3 -m coverage xml | |
- name: Upload coverage | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coverage-${{ env.JOB }} | |
path: ./coverage.xml | |
system-testing: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
container: | |
- debian:testing-slim | |
- debian:unstable-slim | |
- ubuntu:jammy | |
- ubuntu:noble | |
- ubuntu:oracular | |
container: | |
image: ${{ matrix.container }} | |
options: --privileged | |
env: | |
DEBIAN_FRONTEND: noninteractive | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install dependencies | |
run: > | |
apt-get update && | |
apt-get install --no-install-recommends --yes debian-archive-keyring | |
diffoscope-minimal distro-info-data dpkg-dev mmdebstrap | |
python3-ruamel.yaml python3 squashfs-tools-ng ubuntu-keyring | |
- name: Run system-testing | |
run: ./system-testing | |
yamllint: | |
runs-on: ubuntu-latest | |
container: | |
image: debian:testing-slim | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install dependencies | |
run: | | |
apt-get update | |
apt-get install --no-install-recommends --yes yamllint | |
- name: Run yamllint | |
run: | | |
yamllint . | |
upload-to-codecov: | |
if: ${{ always() }} | |
needs: | |
- install | |
- unittest | |
- skip-linters | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
fail_ci_if_error: true |