| 1 |
--- |
| 2 |
name: CI |
| 3 |
|
| 4 |
on: # yamllint disable-line rule:truthy |
| 5 |
- push |
| 6 |
- pull_request |
| 7 |
|
| 8 |
# Note: ca-certificates and git are needed for actions/checkout to use git |
| 9 |
# which is needed for codecov/codecov-action. |
| 10 |
|
| 11 |
jobs: |
| 12 |
install: |
| 13 |
runs-on: ubuntu-latest |
| 14 |
strategy: |
| 15 |
fail-fast: false |
| 16 |
matrix: |
| 17 |
container: |
| 18 |
- debian:stable-slim |
| 19 |
- debian:testing-slim |
| 20 |
- ubuntu:latest |
| 21 |
- ubuntu:rolling |
| 22 |
- ubuntu:devel |
| 23 |
container: |
| 24 |
image: ${{ matrix.container }} |
| 25 |
options: --privileged |
| 26 |
steps: |
| 27 |
- name: Sanitize container name (for artifact name) |
| 28 |
run: | |
| 29 |
container=$(echo "${{ matrix.container }}" | sed 's/:/-/') |
| 30 |
echo "JOB=${GITHUB_JOB}-${container}" >> "$GITHUB_ENV" |
| 31 |
- name: Install dependencies |
| 32 |
run: > |
| 33 |
apt-get update && |
| 34 |
apt-get install --no-install-recommends --yes pandoc python3 |
| 35 |
python3-coverage python3-ruamel.yaml python3-setuptools |
| 36 |
- uses: actions/checkout@v6 |
| 37 |
- name: Run build |
| 38 |
run: python3 -m coverage run --branch setup.py build |
| 39 |
- name: Run install |
| 40 |
run: python3 -m coverage run -a --branch setup.py install |
| 41 |
- name: Run clean |
| 42 |
run: python3 -m coverage run -a --branch setup.py clean |
| 43 |
- name: Coverage report |
| 44 |
run: python3 -m coverage xml |
| 45 |
- name: Upload coverage |
| 46 |
uses: actions/upload-artifact@v7 |
| 47 |
with: |
| 48 |
name: coverage-${{ env.JOB }} |
| 49 |
path: ./coverage.xml |
| 50 |
|
| 51 |
unittest: |
| 52 |
runs-on: ubuntu-latest |
| 53 |
strategy: |
| 54 |
fail-fast: false |
| 55 |
matrix: |
| 56 |
container: |
| 57 |
- debian:stable-slim |
| 58 |
- debian:testing-slim |
| 59 |
- debian:unstable-slim |
| 60 |
- ubuntu:latest |
| 61 |
- ubuntu:rolling |
| 62 |
- ubuntu:devel |
| 63 |
container: |
| 64 |
image: ${{ matrix.container }} |
| 65 |
steps: |
| 66 |
- name: Sanitize container name (for artifact name) |
| 67 |
run: | |
| 68 |
container=$(echo "${{ matrix.container }}" | sed 's/:/-/') |
| 69 |
echo "JOB=${GITHUB_JOB}-${container}" >> "$GITHUB_ENV" |
| 70 |
- name: Install dependencies |
| 71 |
run: > |
| 72 |
apt-get update && |
| 73 |
apt-get install --no-install-recommends --yes black isort mypy pylint |
| 74 |
python3 python3-coverage python3-flake8 python3-ruamel.yaml |
| 75 |
python3-setuptools python3-typeshed shellcheck |
| 76 |
- uses: actions/checkout@v6 |
| 77 |
- name: Run unit tests |
| 78 |
run: | |
| 79 |
python3 -m coverage run -m unittest discover -v |
| 80 |
python3 -m coverage xml |
| 81 |
- name: Upload coverage |
| 82 |
uses: actions/upload-artifact@v7 |
| 83 |
with: |
| 84 |
name: coverage-${{ env.JOB }} |
| 85 |
path: ./coverage.xml |
| 86 |
|
| 87 |
skip-linters: |
| 88 |
runs-on: ubuntu-latest |
| 89 |
strategy: |
| 90 |
fail-fast: false |
| 91 |
matrix: |
| 92 |
container: |
| 93 |
- debian:stable-slim |
| 94 |
- debian:testing-slim |
| 95 |
- debian:unstable-slim |
| 96 |
- ubuntu:latest |
| 97 |
- ubuntu:rolling |
| 98 |
- ubuntu:devel |
| 99 |
container: |
| 100 |
image: ${{ matrix.container }} |
| 101 |
steps: |
| 102 |
- name: Sanitize container name (for artifact name) |
| 103 |
run: | |
| 104 |
container=$(echo "${{ matrix.container }}" | sed 's/:/-/') |
| 105 |
echo "JOB=${GITHUB_JOB}-${container}" >> "$GITHUB_ENV" |
| 106 |
- name: Install dependencies |
| 107 |
run: > |
| 108 |
apt-get update && |
| 109 |
apt-get install --no-install-recommends --yes mypy pylint python3 |
| 110 |
python3-coverage python3-ruamel.yaml python3-setuptools |
| 111 |
python3-typeshed |
| 112 |
- uses: actions/checkout@v6 |
| 113 |
- name: Run unit tests |
| 114 |
run: | |
| 115 |
SKIP_LINTERS=1 python3 -m coverage run -m unittest discover -v |
| 116 |
python3 -m coverage xml |
| 117 |
- name: Upload coverage |
| 118 |
uses: actions/upload-artifact@v7 |
| 119 |
with: |
| 120 |
name: coverage-${{ env.JOB }} |
| 121 |
path: ./coverage.xml |
| 122 |
|
| 123 |
system-testing: |
| 124 |
runs-on: ubuntu-latest |
| 125 |
strategy: |
| 126 |
fail-fast: false |
| 127 |
matrix: |
| 128 |
container: |
| 129 |
- debian:stable-slim |
| 130 |
- debian:testing-slim |
| 131 |
- debian:unstable-slim |
| 132 |
- ubuntu:latest |
| 133 |
- ubuntu:rolling |
| 134 |
- ubuntu:devel |
| 135 |
container: |
| 136 |
image: ${{ matrix.container }} |
| 137 |
options: --privileged |
| 138 |
env: |
| 139 |
DEBIAN_FRONTEND: noninteractive |
| 140 |
steps: |
| 141 |
- uses: actions/checkout@v6 |
| 142 |
- name: Install dependencies |
| 143 |
run: > |
| 144 |
apt-get update && |
| 145 |
apt-get install --no-install-recommends --yes debian-archive-keyring |
| 146 |
diffoscope-minimal distro-info-data dpkg-dev mmdebstrap |
| 147 |
python3-ruamel.yaml python3 squashfs-tools-ng ubuntu-keyring |
| 148 |
- name: Run system-testing |
| 149 |
run: ./system-testing |
| 150 |
|
| 151 |
shfmt: |
| 152 |
runs-on: ubuntu-latest |
| 153 |
container: |
| 154 |
image: debian:testing-slim |
| 155 |
steps: |
| 156 |
- uses: actions/checkout@v6 |
| 157 |
- name: Install dependencies |
| 158 |
run: | |
| 159 |
apt-get update |
| 160 |
apt-get install --no-install-recommends --yes shfmt |
| 161 |
- name: Run shfmt |
| 162 |
run: | |
| 163 |
shfmt -d . |
| 164 |
|
| 165 |
yamllint: |
| 166 |
runs-on: ubuntu-latest |
| 167 |
container: |
| 168 |
image: debian:testing-slim |
| 169 |
steps: |
| 170 |
- uses: actions/checkout@v6 |
| 171 |
- name: Install dependencies |
| 172 |
run: | |
| 173 |
apt-get update |
| 174 |
apt-get install --no-install-recommends --yes yamllint |
| 175 |
- name: Run yamllint |
| 176 |
run: | |
| 177 |
yamllint . |
| 178 |
|
| 179 |
upload-to-codecov: |
| 180 |
if: ${{ always() }} |
| 181 |
needs: |
| 182 |
- install |
| 183 |
- unittest |
| 184 |
- skip-linters |
| 185 |
runs-on: ubuntu-latest |
| 186 |
steps: |
| 187 |
- uses: actions/checkout@v6 |
| 188 |
- name: Download artifacts |
| 189 |
uses: actions/download-artifact@v8 |
| 190 |
- name: Upload coverage to Codecov |
| 191 |
uses: codecov/codecov-action@v6 |
| 192 |
with: |
| 193 |
token: ${{ secrets.CODECOV_TOKEN }} |
| 194 |
fail_ci_if_error: true |