ci(check.yml): fix poetry cache path #21
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI/CD Checks | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
matrix: | |
python-version: ['3.9', '3.10', '3.11'] | |
steps: | |
# Environment Setup | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
# Tool Installation | |
- name: Load cached tool installations | |
id: cached-tools | |
uses: actions/cache@v3 | |
with: | |
path: ~/.local/bin # the path depends on the OS | |
key: tools-${{ runner.os }}-${{ matrix.python-version }}-1 # Increment cache key to clear cache | |
- name: Install Task | |
if: steps.cached-tools.outputs.cache-hit != 'true' | |
run: | | |
sudo sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b ~/.local/bin | |
- name: Install Poetry | |
if: steps.cached-tools.outputs.cache-hit != 'true' | |
uses: snok/install-poetry@v1 | |
with: | |
virtualenvs-create: true | |
# Dependency Installation | |
- name: Load cached venv | |
id: cached-poetry-dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pypoetry/virtualenvs | |
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} | |
- name: Install dependencies | |
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | |
run: poetry install --no-interaction --no-root | |
- name: Install library | |
run: poetry install --no-interaction | |
# CI/CD Checks | |
- name: Run CI-CD-checks | |
run: poetry run task ci-cd-checks | |
- name: Upload coverage reports to Codecov | |
if: matrix.python-version == '3.11' | |
uses: codecov/codecov-action@v3 | |
env: | |
fail_ci_if_error: true |