|
| 1 | +# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json |
| 2 | + |
| 3 | +name: ci |
| 4 | + |
| 5 | +on: |
| 6 | + push: |
| 7 | + branches: |
| 8 | + - main |
| 9 | + pull_request: |
| 10 | + |
| 11 | +permissions: |
| 12 | + contents: read |
| 13 | + id-token: write |
| 14 | + pull-requests: write |
| 15 | + |
| 16 | +jobs: |
| 17 | + ci: |
| 18 | + name: ${{ matrix.name }} |
| 19 | + runs-on: ubuntu-24.04 |
| 20 | + concurrency: |
| 21 | + group: ${{ github.workflow }}-${{ matrix.name }}-${{ github.event.pull_request.number }} |
| 22 | + cancel-in-progress: true |
| 23 | + strategy: |
| 24 | + fail-fast: false |
| 25 | + matrix: |
| 26 | + include: |
| 27 | + - name: test |
| 28 | + task: test |
| 29 | + install: true |
| 30 | + run_on_push: true |
| 31 | + annotations_pytest: true |
| 32 | + - name: pre-commit |
| 33 | + task: install |
| 34 | + install: true |
| 35 | + pre_commit: true |
| 36 | + - name: template - build |
| 37 | + task: build |
| 38 | + template: true |
| 39 | + buildx: true |
| 40 | + - name: template - check - format |
| 41 | + task: check:format |
| 42 | + template: true |
| 43 | + install: true |
| 44 | + annotations_ruff: true |
| 45 | + - name: template - check - lint |
| 46 | + task: check:lint |
| 47 | + template: true |
| 48 | + install: true |
| 49 | + annotations_ruff: true |
| 50 | + - name: template - check - types |
| 51 | + task: check:types |
| 52 | + template: true |
| 53 | + install: true |
| 54 | + annotations_mypy: true |
| 55 | + - name: template - test - 3.10 |
| 56 | + task: test |
| 57 | + template: true |
| 58 | + install: true |
| 59 | + run_on_push: true |
| 60 | + python: "3.10" |
| 61 | + - name: template - test - 3.11 |
| 62 | + task: test |
| 63 | + template: true |
| 64 | + install: true |
| 65 | + run_on_push: true |
| 66 | + python: "3.11" |
| 67 | + - name: template - test - 3.12 |
| 68 | + task: test |
| 69 | + template: true |
| 70 | + install: true |
| 71 | + run_on_push: true |
| 72 | + python: "3.12" |
| 73 | + - name: template - test - 3.13 |
| 74 | + task: test |
| 75 | + template: true |
| 76 | + install: true |
| 77 | + run_on_push: true |
| 78 | + python: "3.13" |
| 79 | + - name: template - test - 3.14 |
| 80 | + task: test |
| 81 | + template: true |
| 82 | + install: true |
| 83 | + run_on_push: true |
| 84 | + python: "3.14" |
| 85 | + annotations_pytest: true |
| 86 | + pytest_coverage: true |
| 87 | + pytest_coverage_xml: tests/example-project/coverage.xml |
| 88 | + pytest_coverage_junit: tests/example-project/pytest.xml |
| 89 | + - name: template - pre-commit |
| 90 | + task: install |
| 91 | + template: true |
| 92 | + install: true |
| 93 | + pre_commit: true |
| 94 | + steps: |
| 95 | + - name: lock template project |
| 96 | + if: (matrix.template || false) && (github.event_name == 'pull_request' || matrix.run_on_push) |
| 97 | + uses: juftin/actions/taskfile@v1 |
| 98 | + with: |
| 99 | + task: lock |
| 100 | + task-args: --taskfile tests/example-project/Taskfile.yaml |
| 101 | + checkout: true |
| 102 | + fetch-depth: ${{ matrix.pre_commit && '0' || '1' }} |
| 103 | + setup-uv: true |
| 104 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 105 | + - name: install template project |
| 106 | + if: matrix.template && matrix.install && (github.event_name == 'pull_request' || matrix.run_on_push) |
| 107 | + uses: juftin/actions/taskfile@v1 |
| 108 | + with: |
| 109 | + task: install |
| 110 | + task-args: --taskfile tests/example-project/Taskfile.yaml |
| 111 | + setup-task: false |
| 112 | + setup-uv: false |
| 113 | + - name: ${{ matrix.name }} |
| 114 | + if: github.event_name == 'pull_request' || matrix.run_on_push |
| 115 | + uses: juftin/actions/taskfile@v1 |
| 116 | + with: |
| 117 | + task: ${{ matrix.task }} |
| 118 | + task-args: ${{ matrix.template && '--taskfile tests/example-project/Taskfile.yaml' || '' }} |
| 119 | + checkout: ${{ !matrix.template }} |
| 120 | + install: ${{ matrix.install || false }} |
| 121 | + fetch-depth: ${{ matrix.pre_commit && '0' || '1' }} |
| 122 | + setup-task: ${{ !matrix.template }} |
| 123 | + setup-uv: ${{ !matrix.template }} |
| 124 | + buildx: ${{ matrix.buildx || false }} |
| 125 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 126 | + annotations-ruff: ${{ matrix.annotations_ruff || false }} |
| 127 | + annotations-mypy: ${{ matrix.annotations_mypy || false }} |
| 128 | + annotations-pytest: ${{ matrix.annotations_pytest || false }} |
| 129 | + pytest-coverage: ${{ matrix.pytest_coverage && github.event_name == 'pull_request' && !github.event.pull_request.head.repo.fork || false }} |
| 130 | + pytest-coverage-xml: ${{ matrix.pytest_coverage_xml || 'coverage.xml' }} |
| 131 | + pytest-coverage-junit: ${{ matrix.pytest_coverage_junit || 'pytest.xml' }} |
| 132 | + env: |
| 133 | + UV_PYTHON: ${{ matrix.python || '' }} |
| 134 | + - name: pre-commit |
| 135 | + if: matrix.pre_commit && github.event_name == 'pull_request' |
| 136 | + run: | |
| 137 | + uv tool run --isolated \ |
| 138 | + --with pre-commit-uv \ |
| 139 | + pre-commit run \ |
| 140 | + --color always \ |
| 141 | + --from-ref ${{ github.event.pull_request.base.sha }} \ |
| 142 | + --to-ref ${{ github.event.pull_request.head.sha }} |
0 commit comments