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..6f79a615 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,32 @@ +name: CI + +on: + workflow_dispatch: + inputs: + upload-wheel: + type: boolean + required: false + default: false + description: Upload wheel as an artifact + pull_request: + push: + branches: [ main ] + +permissions: + contents: read + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + tests: + uses: ./.github/workflows/step_test.yaml + secrets: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + + build-wheel: + uses: ./.github/workflows/step_build-wheel.yaml + needs: [ tests ] + with: + upload: ${{ inputs.upload-wheel || false }} diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml deleted file mode 100644 index 4e35dd67..00000000 --- a/.github/workflows/pre-commit.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: pre-commit - -on: - pull_request: - push: - branches: [main] - -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_build-wheel.yaml b/.github/workflows/step_build-wheel.yaml new file mode 100644 index 00000000..4f80a0f1 --- /dev/null +++ b/.github/workflows/step_build-wheel.yaml @@ -0,0 +1,23 @@ +on: + workflow_call: + inputs: + upload: + required: false + type: boolean + default: true + description: Upload wheel as artifact + +permissions: + contents: read + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Build package + run: pipx run build + - uses: actions/upload-artifact@v3 + with: + path: dist/* + if: ${{ inputs.upload }} diff --git a/.github/workflows/step_test.yml b/.github/workflows/step_test.yml new file mode 100644 index 00000000..0805ad31 --- /dev/null +++ b/.github/workflows/step_test.yml @@ -0,0 +1,42 @@ +on: + workflow_call: + secrets: + CODECOV_TOKEN: + required: false + description: Codecov token + +permissions: + contents: read + +jobs: + pre-commit: + name: Run pre-commit + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + - uses: pre-commit/action@v3.0.0 + + 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 }} + allow-prereleases: true + + - name: Install package + run: pip install -e.[tests-cov] + - name: Test package + run: pytest --cov --cov-report=xml + - name: Upload coverage report + uses: codecov/codecov-action@v3 + with: + name: python-${{ matrix.python-version }} diff --git a/pyproject.toml b/pyproject.toml index 46a88f2e..a98552ba 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -16,11 +16,11 @@ license = 'GPL-2.0-or-later' license-files = { paths = ['LICENSE'] } requires-python = '>=3.9' classifiers = [ - 'License :: OSI Approved :: GNU General Public License v2 (GPLv2)', 'Natural Language :: English', - 'Programming Language :: Python :: 2.7', - 'Programming Language :: Python :: 3.6', - 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.9', + 'Programming Language :: Python :: 3.10', + 'Programming Language :: Python :: 3.11', + 'Programming Language :: Python :: 3.12', 'Topic :: Utilities', ] keywords = [ @@ -41,6 +41,10 @@ Homepage = 'https://github.com/psss/fmf' tests = [ 'pytest', ] +tests-cov = [ + 'fmf[tests]', + 'pytest-cov', +] dev = [ 'fmf[tests]', 'pre-commit',