Python package template #5
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: | |
| branches: | |
| - main | |
| - develop | |
| pull_request: | |
| branches: | |
| - main | |
| - develop | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 | |
| - name: Set up Python | |
| uses: actions/setup-python@cfd55ca82492758d853442341ad4d8010466803a | |
| with: | |
| python-version: "3.12" | |
| - name: Configure git for pre-commit | |
| run: git config --global url."https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/".insteadOf "https://github.com/" | |
| - name: Cache pre-commit environments | |
| uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 | |
| with: | |
| path: ~/.cache/pre-commit | |
| key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }} | |
| - name: Install dependencies | |
| run: pip install pre-commit | |
| - name: Run pre-commit | |
| run: pre-commit run --all-files | |
| lint-docker: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 | |
| - name: Lint Dockerfile | |
| uses: hadolint/hadolint-action@54c9adbab1582136bcea3692aa25b7a70191834f | |
| with: | |
| dockerfile: Dockerfile | |
| test: | |
| needs: [lint, lint-docker] | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ["3.10", "3.11", "3.12"] | |
| steps: | |
| - uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@cfd55ca82492758d853442341ad4d8010466803a | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: 'poetry' | |
| - name: Install Poetry | |
| run: pipx install poetry | |
| - name: Install dependencies | |
| run: poetry install | |
| - name: Run tests | |
| run: poetry run pytest |