diff --git a/.github/codecov.yml b/.github/codecov.yml new file mode 100644 index 00000000..e1f43427 --- /dev/null +++ b/.github/codecov.yml @@ -0,0 +1,3 @@ +codecov: + notify: + after_n_builds: 4 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..b9ceec53 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,30 @@ +name: CI + +on: + workflow_dispatch: + pull_request: + branches: [ main ] + push: + branches: [ main ] + +permissions: + contents: read + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + pre-commit: + uses: ./.github/workflows/step_pre-commit.yml + tests: + needs: [ pre-commit ] + uses: ./.github/workflows/step_test.yml + pass: + if: always() + needs: [ pre-commit, tests ] + runs-on: ubuntu-latest + steps: + - uses: re-actors/alls-green@release/v1 + with: + jobs: ${{ toJSON(needs) }} diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml deleted file mode 100644 index 9981cdf0..00000000 --- a/.github/workflows/pre-commit.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: pre-commit - -on: - pull_request: - push: - branches: [master] - -jobs: - pre-commit: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 - - uses: pre-commit/action@v2.0.2 diff --git a/.github/workflows/step_pre-commit.yml b/.github/workflows/step_pre-commit.yml new file mode 100644 index 00000000..85c97eb7 --- /dev/null +++ b/.github/workflows/step_pre-commit.yml @@ -0,0 +1,16 @@ +on: + workflow_call: + +permissions: + contents: read + +jobs: + pre-commit: + name: Run pre-commit + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v4 + with: + python-version: 3.x + - uses: pre-commit/action@v3.0.0 diff --git a/.github/workflows/step_test.yml b/.github/workflows/step_test.yml new file mode 100644 index 00000000..d8dcc02b --- /dev/null +++ b/.github/workflows/step_test.yml @@ -0,0 +1,27 @@ +on: + workflow_call: + +permissions: + contents: read + +jobs: + checks: + name: Check 🐍 ${{ matrix.python-version }} + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: ["3.9", "3.10", "3.11", "3.12"] + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Install hatch + run: pip install hatch + - name: Test package + run: hatch run cov:xml + - name: Upload coverage report + uses: codecov/codecov-action@v3 + with: + name: python-${{ matrix.python-version }}