diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5a372e1..bb22c92 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,13 +1,11 @@ -# A very basic Github Workflow. - -# This workflow will install Python dependencies, run tests and lint with a -# single version of Python. +# This workflow will install Python dependencies, run tests across multiple +# Python versions, and lints things with a single version of Python. # For more information see: # https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions +--- +name: CI -name: Test - -on: +on: # yamllint disable-line rule:truthy push: branches: - "*" @@ -16,30 +14,29 @@ on: - "*" jobs: - build: + tests: runs-on: ubuntu-22.04 strategy: - fail-fast: False + fail-fast: false matrix: python-version: ["3.8", "3.9", "3.10", "3.11"] - allowed-to-fail: [False] + allowed-to-fail: [false] include: - python-version: "3.12" - allowed-to-fail: True + allowed-to-fail: true name: "Build and Test: Python ${{ matrix.python-version }}" steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: "Set up Python ${{ matrix.python-version }}" - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: "${{ matrix.python-version }}" - name: Install dependencies continue-on-error: ${{ matrix.allowed-to-fail }} run: | - pip install --upgrade pip setuptools wheel pip install -e .[dev] - name: Run tests @@ -47,6 +44,27 @@ jobs: run: | pytest + lint: + # TODO: DRY this with tests job + name: "Lint" + runs-on: ubuntu-22.04 + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: "Set up Python 3.8" + uses: actions/setup-python@v4 + with: + python-version: "3.8" + + - name: Install dependencies + run: | + pip install -e .[dev] + + - name: Run lint + run: | + pre-commit run --all-files + # A summary of all jobs and their result. # This is the only job that's required to pass (as set by branch protection # rules in repo settings) so that we don't have to update those rules when @@ -54,7 +72,8 @@ jobs: check-all-jobs: if: always() needs: - - build + - tests + - lint runs-on: ubuntu-latest steps: - name: Check status of all jobs. diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 2f3a550..2b2ec6c 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,6 +1,7 @@ +--- name: Publish to PyPI -on: +on: # yamllint disable-line rule:truthy push: tags: - 'v[0-9]+.[0-9]+.[0-9]+' @@ -8,13 +9,13 @@ on: jobs: build-and-deploy: name: "Build and deploy to PyPI" - runs-on: "ubuntu-20.04" + runs-on: "ubuntu-22.04" steps: - name: "Checkout" - uses: "actions/checkout@v2" + uses: "actions/checkout@v4" - name: "Set up Python 3.8" - uses: "actions/setup-python@v2" + uses: "actions/setup-python@v4" with: python-version: "3.8" diff --git a/CHANGELOG.md b/CHANGELOG.md index 0665e0f..3a7e5cb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ + CI now runs tests against multiple Python versions. (#2) + Updated dependencies to work with py3.10 and py3.11. (#3) + Switched to `ruff` for linting. (#5) ++ Updated CI to also run all pre-commit checks and use more recent actions. (#6) ## v1.0.0 (2023-01-14)