Skip to content

Commit

Permalink
chore: targeting python 3.12 in CI (#281)
Browse files Browse the repository at this point in the history
  • Loading branch information
jamagalhaes authored Dec 27, 2024
1 parent b83ea34 commit c2ec60c
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/actions/install-canvas/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ runs:
uses: actions/cache@v4
with:
path: .venv
key: project-dependencies-${{ hashFiles('**/poetry.lock') }}
key: ${{runner.os}}-py${{env.PYTHON_VERSION}}-venv-${{ hashFiles('**/poetry.lock') }}

# Install project dependencies (bypassing the project, because we don't want to cache the Canvas code).
- name: Install Dependencies
Expand Down
10 changes: 8 additions & 2 deletions .github/actions/install-python-and-poetry/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,26 @@ runs:
using: "composite"
steps:
- name: Set up Python
uses: actions/setup-python@v4
id: python-setup
uses: actions/setup-python@v5
with:
python-version: ${{inputs.PYTHON_VERSION}}
python-version-file: ".python-version"
check-latest: ${{inputs.CHECK_LATEST}}

- name: Set Python version in the environment
run: |
echo "PYTHON_VERSION=${{ steps.python-setup.outputs.python-version }}" >> $GITHUB_ENV
shell: bash

# Cache the installation of Poetry itself.
# This prevents the workflow from installing Poetry every time, which can be slow.
- name: Cache poetry install
id: cache-poetry
uses: actions/cache@v4
with:
path: ~/.local
key: poetry-${{inputs.POETRY_VERSION}}
key: ${{runner.os}}-py${{steps.python-setup.outputs.python-version}}-poetry-${{inputs.POETRY_VERSION}}

# Install Poetry, make sure the .venv is in the project, so it's easily cached.
- name: Install poetry
Expand Down
18 changes: 18 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,14 @@ on:
jobs:
build-and-test:
runs-on: ubuntu-latest
strategy:
matrix:
version: [ 3.11, 3.12 ]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/install-python-and-poetry
with:
PYTHON_VERSION: ${{ matrix.version }}
- uses: ./.github/actions/install-canvas

# Run Pytest unit tests via Poetry.
Expand All @@ -24,8 +29,21 @@ jobs:

# Run Pytest integration tests via Poetry.
- name: Run Pytest integration tests
if: matrix.version == '3.12'
env:
INTEGRATION_TEST_URL: "https://plugin-testing.canvasmedical.com"
INTEGRATION_TEST_CLIENT_ID: ${{ secrets.INTEGRATION_TEST_CLIENT_ID }}
INTEGRATION_TEST_CLIENT_SECRET: ${{ secrets.INTEGRATION_TEST_CLIENT_SECRET }}
run: poetry run pytest -m "integtest" --ff --verbosity 2

- name: Install pipx
run: pip install pipx
shell: bash

- name: Test the distribution
run: |
poetry build
pipx install dist/*.whl
canvas --version
rm -rf dist/
shell: bash
12 changes: 0 additions & 12 deletions .github/workflows/publish-and-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,6 @@ jobs:
- uses: ./.github/actions/install-python-and-poetry
- uses: ./.github/actions/install-canvas

- name: Install pipx
run: pip install pipx
shell: bash

- name: Test the distribution
run: |
poetry build
pipx install dist/*.whl
canvas --version
rm -rf dist/
shell: bash

- name: Python Semantic Release
id: release
env:
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
default_language_version:
python: python3.11
python: python3.12
exclude: |
(?x)(
CHANGELOG.md|
Expand Down Expand Up @@ -34,7 +34,7 @@ repos:
)$
- repo: https://github.com/python-poetry/poetry
rev: 1.8.0
rev: 1.8.5
hooks:
- id: poetry-check
files: ^(.*/)?(poetry\.lock|pyproject\.toml)$
Expand Down
12 changes: 6 additions & 6 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c2ec60c

Please sign in to comment.