Skip to content

Commit

Permalink
chore(ci): improve build and test workflow (#125)
Browse files Browse the repository at this point in the history
  • Loading branch information
jamagalhaes authored Oct 14, 2024
1 parent 316af87 commit 5c15020
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 7 deletions.
25 changes: 25 additions & 0 deletions .github/actions/install-canvas/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: "Install Canvas"
description: "Installs Canvas dependencies"


runs:
using: "composite"
steps:
# Cache the project dependencies (everything in pyproject.toml).
- name: Cache project dependencies
id: cache-deps
uses: actions/cache@v4
with:
path: .venv
key: project-dependencies-${{ hashFiles('**/poetry.lock') }}

# Install project dependencies (bypassing the project, because we don't want to cache the Canvas code).
- name: Install Dependencies
run: poetry install --no-interaction --no-root
shell: bash
if: steps.cache-deps.outputs.cache-hit != 'true'

# Install the project to make sure everything works and is synced.
- name: Install Canvas
shell: bash
run: poetry install --no-interaction
4 changes: 2 additions & 2 deletions .github/actions/install-python-and-poetry/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ inputs:
POETRY_VERSION:
description: "Poetry version to install"
required: false
default: "1.7.1"
default: "1.8.3"
PYTHON_VERSION:
description: "Version range or exact version of Python or PyPy to use, using SemVer's version range syntax. Reads from .python-version if unset."
required: false
Expand All @@ -28,7 +28,7 @@ runs:
# This prevents the workflow from installing Poetry every time, which can be slow.
- name: Cache poetry install
id: cache-poetry
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.local
key: poetry-${{inputs.POETRY_VERSION}}
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: ./.github/actions/install-python-and-poetry

- name: Install canvas-plugins
shell: bash
run: poetry install --no-interaction
- uses: ./.github/actions/install-canvas

# Run Pytest unit tests via Poetry.
- name: Run Pytest unit tests
Expand Down

0 comments on commit 5c15020

Please sign in to comment.