ops: don't fail on linter problems for now #6
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 | |
on: # yamllint disable-line rule:truthy | |
push: | |
branches: | |
- main | |
- develop | |
pull_request: | |
branches: | |
- main | |
- develop | |
workflow_dispatch: | |
env: | |
POETRY_VERSION: 1.8.3 | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: | |
- '3.9' | |
- '3.10' | |
- '3.11' | |
- '3.12' | |
steps: | |
- name: Checkout the repository | |
uses: actions/[email protected] | |
- name: Setup Python | |
uses: actions/[email protected] | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Get the precise Python version | |
run: echo "PYTHON_ID=$( python -VV | sha256sum | awk '{ print $1 }' )" >> "$GITHUB_ENV" | |
- name: Load the cached Poetry installation | |
id: cached-poetry | |
uses: actions/[email protected] | |
with: | |
path: ~/.local | |
key: poetry-${{ env.POETRY_VERSION }}-py_${{ env.PYTHON_ID}}-0 | |
- name: Install Poetry | |
if: steps.cached-poetry.outputs.cache-hit != 'true' | |
uses: snok/[email protected] | |
with: | |
version: ${{ env.POETRY_VERSION }} | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
- name: Load the cached dependencies | |
id: cached-deps | |
uses: actions/[email protected] | |
with: | |
path: .venv | |
key: py${{ matrix.python-version }}-deps-${{ hashFiles('**/poetry.lock') }} | |
- name: Install dependencies | |
if: steps.cached-deps.outputs.cache-hit != 'true' | |
run: poetry install --no-interaction | |
- name: Run pre-commit | |
run: >- | |
if [[ $GITHUB_REF == refs/heads/main ]]; then | |
SKIP=no-commit-to-branch poetry run pre-commit run --all-files | |
else | |
poetry run pre-commit run --all-files | |
fi | |
- name: Run tests | |
env: | |
COVERAGE_FILE: .coverage.${{ matrix.python-version }} | |
run: poetry run pytest --cov | |
- name: Store the coverage report | |
uses: actions/[email protected] | |
with: | |
name: coverage-${{ matrix.python-version }} | |
path: .coverage.${{ matrix.python-version }} | |
coverage: | |
runs-on: ubuntu-latest | |
needs: test | |
permissions: | |
pull-requests: write | |
contents: write | |
steps: | |
- name: Checkout the repository | |
uses: actions/[email protected] | |
- name: Retrieve the coverage reports | |
id: download | |
uses: actions/[email protected] | |
with: | |
pattern: coverage-* | |
merge-multiple: true | |
- name: Process the coverage reports | |
id: coverage_processing | |
uses: py-cov-action/[email protected] | |
with: | |
COVERAGE_DATA_BRANCH: 'COVERAGE-REPORT' | |
GITHUB_TOKEN: ${{ github.token }} | |
MERGE_COVERAGE_FILES: true | |
- name: Store the pull request coverage comment for later posting | |
if: steps.coverage_processing.outputs.COMMENT_FILE_WRITTEN == 'true' | |
uses: actions/[email protected] | |
with: | |
name: python-coverage-comment-action | |
path: python-coverage-comment-action.txt |