Skip to content

πŸ‘· ci(build): always post build gate on pull requests #904

πŸ‘· ci(build): always post build gate on pull requests

πŸ‘· ci(build): always post build gate on pull requests #904

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"