π· ci(build): always post build gate on pull requests (#406) #905
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: π§ͺ toml-fmt-common | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: ["main"] | |
| tags-ignore: ["**"] | |
| pull_request: | |
| schedule: | |
| - cron: "0 8 * * *" | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| jobs: | |
| changes: | |
| name: π changes | |
| runs-on: ubuntu-latest | |
| outputs: | |
| run: ${{ github.event_name != 'pull_request' || steps.filter.outputs.run == 'true' }} | |
| steps: | |
| - name: π₯ Checkout | |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| persist-credentials: false | |
| - name: π Check for changes | |
| uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1 | |
| id: filter | |
| with: | |
| filters: | | |
| run: | |
| - 'toml-fmt-common/**' | |
| - '.github/workflows/toml_fmt_common_test.yaml' | |
| test: | |
| name: π ${{ matrix.env }} | |
| needs: changes | |
| if: needs.changes.outputs.run == 'true' | |
| runs-on: ubuntu-latest | |
| environment: test | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| env: ["3.14", "3.13", "3.12", "3.11", "3.10", type, pkg_meta] | |
| defaults: | |
| run: | |
| working-directory: toml-fmt-common | |
| steps: | |
| - name: π₯ Checkout | |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| fetch-depth: 0 | |
| persist-credentials: false | |
| - name: π¦ Setup uv | |
| uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0 | |
| with: | |
| enable-cache: false | |
| cache-dependency-glob: "pyproject.toml" | |
| - name: π§ Install tox | |
| run: uv tool install --python-preference only-managed --python 3.14 tox --with tox-uv | |
| - name: π Install Python | |
| if: startsWith(matrix.env, '3.') && matrix.env != '3.14' | |
| run: uv python install --python-preference only-managed ${{ matrix.env }} | |
| - name: π§ Setup test suite | |
| run: tox run -vv --notest --skip-missing-interpreters false -e ${{ matrix.env }} | |
| - name: β Run test suite | |
| run: tox run --skip-pkg-install -e ${{ matrix.env }} | |
| env: | |
| PYTEST_ADDOPTS: "-vv --durations=20" | |
| - name: π€ Upload coverage | |
| if: startsWith(matrix.env, '3.') | |
| uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| directory: toml-fmt-common/.tox/${{ matrix.env }} | |
| flags: python-${{ matrix.env }} | |
| all-pass: | |
| name: β toml-fmt-common | |
| if: always() | |
| needs: [changes, test] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Decide whether all jobs passed or were skipped | |
| run: | | |
| if [[ "${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}" == "true" ]]; then | |
| echo "Some jobs failed or were canceled" | |
| exit 1 | |
| fi | |
| echo "All jobs passed or were skipped" |