|
| 1 | +name: Build and test the project |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + paths-ignore: |
| 8 | + - ".devcontainer/Dockerfile" |
| 9 | + pull_request: |
| 10 | + branches: |
| 11 | + - main |
| 12 | + paths-ignore: |
| 13 | + - ".devcontainer/Dockerfile" |
| 14 | + workflow_dispatch: |
| 15 | + |
| 16 | +# IMPORTANT: make sure to use the 'runner user'when running jobs in a container! |
| 17 | +# Otherwise there will be 'dubious ownership' issues reported by Git. |
| 18 | +# Therefore, make sure to use the '--user 1001' option for the container. |
| 19 | +jobs: |
| 20 | + build-doc: |
| 21 | + runs-on: ubuntu-latest |
| 22 | + container: |
| 23 | + image: ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:latest |
| 24 | + options: --user 1001 |
| 25 | + steps: |
| 26 | + - name: Checkout code |
| 27 | + uses: actions/checkout@v4 |
| 28 | + - name: Build documentation |
| 29 | + run: ./tools/build-docs.sh |
| 30 | + - name: Upload documentation |
| 31 | + uses: actions/upload-artifact@v4 |
| 32 | + with: |
| 33 | + name: documentation |
| 34 | + path: "build/html" |
| 35 | + retention-days: 1 |
| 36 | + |
| 37 | + build-package: |
| 38 | + runs-on: ubuntu-latest |
| 39 | + container: |
| 40 | + image: ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:latest |
| 41 | + options: --user 1001 |
| 42 | + steps: |
| 43 | + - name: Checkout code |
| 44 | + uses: actions/checkout@v4 |
| 45 | + - name: Build Python package |
| 46 | + run: ./tools/build-package.sh |
| 47 | + - name: Upload Python package |
| 48 | + uses: actions/upload-artifact@v4 |
| 49 | + with: |
| 50 | + name: python-package |
| 51 | + path: "dist/*.whl" |
| 52 | + retention-days: 1 |
| 53 | + |
| 54 | + lint-package: |
| 55 | + runs-on: ubuntu-latest |
| 56 | + container: |
| 57 | + image: ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:latest |
| 58 | + options: --user 1001 |
| 59 | + steps: |
| 60 | + - name: Checkout code |
| 61 | + uses: actions/checkout@v4 |
| 62 | + - name: Run linters |
| 63 | + run: tools/lint-package.sh |
| 64 | + continue-on-error: true |
| 65 | + - name: Upload lint results |
| 66 | + uses: actions/upload-artifact@v4 |
| 67 | + with: |
| 68 | + name: lint-results |
| 69 | + path: "build/*.txt" |
| 70 | + retention-days: 1 |
| 71 | + |
| 72 | + test-package: |
| 73 | + runs-on: ubuntu-latest |
| 74 | + container: |
| 75 | + image: ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:latest |
| 76 | + options: --user 1001 |
| 77 | + steps: |
| 78 | + - name: Checkout code |
| 79 | + uses: actions/checkout@v4 |
| 80 | + - name: Run tests |
| 81 | + run: ./tools/test-package.sh |
| 82 | + - name: Upload test results |
| 83 | + uses: actions/upload-artifact@v4 |
| 84 | + with: |
| 85 | + name: test-results |
| 86 | + path: "build/*.xml" |
| 87 | + retention-days: 1 |
0 commit comments