Refactor GitHub Actions workflow to improve dependency caching and jo… #13
Workflow file for this run
This file contains hidden or 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 | |
| on: | |
| push: | |
| paths: | |
| - "src/**" | |
| - "*.py" | |
| - "*.toml" | |
| - "requirements.txt" | |
| - ".github/workflows/**" | |
| pull_request: | |
| paths: | |
| - "src/**" | |
| - "*.py" | |
| - "*.toml" | |
| - "requirements.txt" | |
| - ".github/workflows/**" | |
| jobs: | |
| setup: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check Out Repo | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.9' | |
| cache: 'pip' | |
| - name: Install Poetry | |
| run: pip install poetry | |
| - name: Install Dependencies | |
| run: poetry install --with dev | |
| - name: Cache Poetry dependencies | |
| uses: actions/cache@v3 | |
| with: | |
| path: .venv | |
| key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }} | |
| ruff: | |
| needs: setup | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.9' | |
| - uses: actions/cache@v3 | |
| with: | |
| path: .venv | |
| key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }} | |
| - name: Run ruff | |
| run: poetry run ruff check | |
| test: | |
| needs: ruff | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.9' | |
| - uses: actions/cache@v3 | |
| with: | |
| path: .venv | |
| key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }} | |
| - name: Run Tests | |
| run: poetry run pytest tests |