|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main, master] |
| 6 | + tags: ['v*'] |
| 7 | + pull_request: |
| 8 | + branches: [main, master] |
| 9 | + |
| 10 | +jobs: |
| 11 | + stylecheck: |
| 12 | + runs-on: ubuntu-latest |
| 13 | + steps: |
| 14 | + - uses: actions/checkout@v4 |
| 15 | + - uses: actions/setup-python@v5 |
| 16 | + with: |
| 17 | + python-version: '3.12' |
| 18 | + - name: Install dependencies |
| 19 | + run: pip install black flake8 tuxpkg |
| 20 | + - name: Run stylecheck |
| 21 | + run: make stylecheck |
| 22 | + |
| 23 | + typecheck: |
| 24 | + runs-on: ubuntu-latest |
| 25 | + steps: |
| 26 | + - uses: actions/checkout@v4 |
| 27 | + - uses: actions/setup-python@v5 |
| 28 | + with: |
| 29 | + python-version: '3.12' |
| 30 | + - name: Install dependencies |
| 31 | + run: | |
| 32 | + pip install -e . |
| 33 | + pip install -r requirements-dev.txt |
| 34 | + - name: Run typecheck |
| 35 | + run: make typecheck |
| 36 | + |
| 37 | + spellcheck: |
| 38 | + runs-on: ubuntu-latest |
| 39 | + steps: |
| 40 | + - uses: actions/checkout@v4 |
| 41 | + - uses: actions/setup-python@v5 |
| 42 | + with: |
| 43 | + python-version: '3.12' |
| 44 | + - name: Install dependencies |
| 45 | + run: pip install codespell tuxpkg |
| 46 | + - name: Run spellcheck |
| 47 | + run: make spellcheck |
| 48 | + |
| 49 | + unit-tests: |
| 50 | + runs-on: ubuntu-latest |
| 51 | + strategy: |
| 52 | + fail-fast: false |
| 53 | + matrix: |
| 54 | + python-version: ['3.9', '3.10', '3.11', '3.12', '3.13'] |
| 55 | + steps: |
| 56 | + - uses: actions/checkout@v4 |
| 57 | + - uses: actions/setup-python@v5 |
| 58 | + with: |
| 59 | + python-version: ${{ matrix.python-version }} |
| 60 | + - name: Install dependencies |
| 61 | + run: | |
| 62 | + pip install -e . |
| 63 | + pip install -r requirements-dev.txt |
| 64 | + - name: Run tests |
| 65 | + run: make test |
| 66 | + |
| 67 | + unit-tests-arm64: |
| 68 | + runs-on: ubuntu-24.04-arm |
| 69 | + strategy: |
| 70 | + fail-fast: false |
| 71 | + matrix: |
| 72 | + python-version: ['3.9', '3.10', '3.11', '3.12', '3.13'] |
| 73 | + steps: |
| 74 | + - uses: actions/checkout@v4 |
| 75 | + - uses: actions/setup-python@v5 |
| 76 | + with: |
| 77 | + python-version: ${{ matrix.python-version }} |
| 78 | + - name: Install dependencies |
| 79 | + run: | |
| 80 | + pip install -e . |
| 81 | + pip install -r requirements-dev.txt |
| 82 | + - name: Run tests |
| 83 | + run: make test |
| 84 | + |
| 85 | + integration-tests: |
| 86 | + runs-on: ubuntu-latest |
| 87 | + strategy: |
| 88 | + fail-fast: false |
| 89 | + matrix: |
| 90 | + include: |
| 91 | + - device: qemu-arm64 |
| 92 | + test: ltp-smoke |
| 93 | + - device: qemu-x86_64 |
| 94 | + test: ltp-smoke |
| 95 | + steps: |
| 96 | + - uses: actions/checkout@v4 |
| 97 | + - uses: actions/setup-python@v5 |
| 98 | + with: |
| 99 | + python-version: '3.12' |
| 100 | + # Workaround: https://tuxrun.org/troubleshooting/#failure-on-ubuntu |
| 101 | + - name: Install system dependencies |
| 102 | + run: | |
| 103 | + sudo apt-get update |
| 104 | + sudo apt-get install -y libguestfs-tools qemu-system |
| 105 | + sudo chmod 644 /boot/vmlinuz* |
| 106 | + - name: Install dependencies |
| 107 | + run: pip install -e . |
| 108 | + - name: Run integration tests |
| 109 | + run: python3 test/integration.py --device ${{ matrix.device }} --tests ${{ matrix.test }} --runtime podman |
| 110 | + |
| 111 | + build-wheel: |
| 112 | + runs-on: ubuntu-latest |
| 113 | + steps: |
| 114 | + - uses: actions/checkout@v4 |
| 115 | + - uses: actions/setup-python@v5 |
| 116 | + with: |
| 117 | + python-version: '3.12' |
| 118 | + - name: Install flit |
| 119 | + run: pip install flit |
| 120 | + - name: Build wheel |
| 121 | + run: flit build |
| 122 | + - uses: actions/upload-artifact@v4 |
| 123 | + with: |
| 124 | + name: wheel |
| 125 | + path: dist/*.whl |
| 126 | + |
| 127 | + docs: |
| 128 | + runs-on: ubuntu-latest |
| 129 | + steps: |
| 130 | + - uses: actions/checkout@v4 |
| 131 | + - uses: actions/setup-python@v5 |
| 132 | + with: |
| 133 | + python-version: '3.12' |
| 134 | + - name: Install dependencies |
| 135 | + run: pip install mkdocs-material tuxpkg |
| 136 | + - name: Build docs |
| 137 | + run: make doc |
| 138 | + - uses: actions/upload-artifact@v4 |
| 139 | + with: |
| 140 | + name: docs |
| 141 | + path: public |
| 142 | + |
| 143 | + pages: |
| 144 | + runs-on: ubuntu-latest |
| 145 | + needs: docs |
| 146 | + if: startsWith(github.ref, 'refs/tags/v') |
| 147 | + permissions: |
| 148 | + pages: write |
| 149 | + id-token: write |
| 150 | + environment: |
| 151 | + name: github-pages |
| 152 | + url: ${{ steps.deployment.outputs.page_url }} |
| 153 | + steps: |
| 154 | + - uses: actions/download-artifact@v4 |
| 155 | + with: |
| 156 | + name: docs |
| 157 | + path: public |
| 158 | + - name: Setup Pages |
| 159 | + uses: actions/configure-pages@v4 |
| 160 | + - name: Upload artifact |
| 161 | + uses: actions/upload-pages-artifact@v3 |
| 162 | + with: |
| 163 | + path: public |
| 164 | + - name: Deploy to GitHub Pages |
| 165 | + id: deployment |
| 166 | + uses: actions/deploy-pages@v4 |
0 commit comments