diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..3a4f224 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,166 @@ +name: CI + +on: + push: + branches: [main, master] + tags: ['v*'] + pull_request: + branches: [main, master] + +jobs: + stylecheck: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: '3.12' + - name: Install dependencies + run: pip install black flake8 tuxpkg + - name: Run stylecheck + run: make stylecheck + + typecheck: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: '3.12' + - name: Install dependencies + run: | + pip install -e . + pip install -r requirements-dev.txt + - name: Run typecheck + run: make typecheck + + spellcheck: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: '3.12' + - name: Install dependencies + run: pip install codespell tuxpkg + - name: Run spellcheck + run: make spellcheck + + unit-tests: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: ['3.9', '3.10', '3.11', '3.12', '3.13'] + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + pip install -e . + pip install -r requirements-dev.txt + - name: Run tests + run: make test + + unit-tests-arm64: + runs-on: ubuntu-24.04-arm + strategy: + fail-fast: false + matrix: + python-version: ['3.9', '3.10', '3.11', '3.12', '3.13'] + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + pip install -e . + pip install -r requirements-dev.txt + - name: Run tests + run: make test + + integration-tests: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + - device: qemu-arm64 + test: ltp-smoke + - device: qemu-x86_64 + test: ltp-smoke + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: '3.12' + # Workaround: https://tuxrun.org/troubleshooting/#failure-on-ubuntu + - name: Install system dependencies + run: | + sudo apt-get update + sudo apt-get install -y libguestfs-tools qemu-system + sudo chmod 644 /boot/vmlinuz* + - name: Install dependencies + run: pip install -e . + - name: Run integration tests + run: python3 test/integration.py --device ${{ matrix.device }} --tests ${{ matrix.test }} --runtime podman + + build-wheel: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: '3.12' + - name: Install flit + run: pip install flit + - name: Build wheel + run: flit build + - uses: actions/upload-artifact@v4 + with: + name: wheel + path: dist/*.whl + + docs: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: '3.12' + - name: Install dependencies + run: pip install mkdocs-material tuxpkg + - name: Build docs + run: make doc + - uses: actions/upload-artifact@v4 + with: + name: docs + path: public + + pages: + runs-on: ubuntu-latest + needs: docs + if: startsWith(github.ref, 'refs/tags/v') + permissions: + pages: write + id-token: write + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + steps: + - uses: actions/download-artifact@v4 + with: + name: docs + path: public + - name: Setup Pages + uses: actions/configure-pages@v4 + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + path: public + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4