Skip to content

ci: install poetry with pipx in workflow tests #7

ci: install poetry with pipx in workflow tests

ci: install poetry with pipx in workflow tests #7

Workflow file for this run

#schema: https://github.com/softprops/github-actions-schemas/blob/master/workflow.json
name: "Code checks"
on:
push:
branches: [main, dev]
pull_request:
branches: [main, dev]
workflow_dispatch:
permissions:
id-token: write
actions: write
contents: read
packages: write
env:
ANNOY_COMPILER_ARGS: "-DANNOYLIB_MULTITHREADED_BUILD,-mno-avx512f"
jobs:
pre_job:
continue-on-error: true
runs-on: ubuntu-latest
# Map a step output to a job output
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
paths_result: ${{ steps.skip_check.outputs.paths_result }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@v5
if: ${{ !github.event.act }}
with:
concurrent_skipping: "same_content_newer"
skip_after_successful_duplicate: "true"
do_not_skip: '["workflow_dispatch"]'
paths_filter: |
python:
paths:
- 'pyproject.toml'
- 'poetry.lock'
- 'src/pixelator/**'
- 'tests/**'
paths_ignore:
- 'tests/**/*.md'
lint:
name: "Lint"
runs-on: ubuntu-latest
needs: [pre_job]
if: needs.pre_job.outputs.paths_result == '{}' || !fromJSON(needs.pre_job.outputs.paths_result).python.should_skip
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python environment
uses: ./.github/actions/setup-python
with:
python-version: "3.10"
- name: flake8 linter
uses: py-actions/flake8@v2
- name: ruff linter
uses: chartboost/ruff-action@v1
format-check:
name: "Check formatting"
needs: pre_job
if: needs.pre_job.outputs.should_skip != 'true' || !fromJSON(needs.pre_job.outputs.paths_result).python.should_skip
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Check code lints with Black
uses: psf/black@stable
# If the above check failed, post a comment on the PR explaining the failure
- name: Post PR comment
if: failure()
uses: mshick/add-pr-comment@v1
with:
message: |
## Python linting (`black`) is failing
To keep the code consistent with lots of contributors, we run automated code consistency checks.
To fix this CI test, please run:
* Install [`black`](https://black.readthedocs.io/en/stable/): `pip install black`
* Fix formatting errors in your pipeline: `black .`
Once you push these changes the test should pass, and you can hide this comment :+1:
We highly recommend setting up Black in your code editor so that this formatting is done automatically on save. Ask about it on Slack for help!
Thanks again for your contribution!
repo-token: ${{ secrets.GITHUB_TOKEN }}
allow-repeats: false
typecheck:
name: "Typecheck"
needs: [pre_job]
runs-on: ubuntu-latest
if: needs.pre_job.outputs.should_skip != 'true' || !fromJSON(needs.pre_job.outputs.paths_result).python.should_skip
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python environment
uses: ./.github/actions/setup-python
with:
python-version: "3.10"
- name: Install dependencies
run: |
pip install poetry
poetry export --output requirements.txt --without-hashes --no-interaction --no-ansi --with dev
pip install -r requirements.txt
- name: Run mypy
run: |
mypy --ignore-missing-imports --install-types --non-interactive src/pixelator