Merge pull request #194 from PixelgenTechnologies/chore/update-fsspec #813
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
#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@v4 | |
- name: Set up Python environment | |
uses: ./.github/actions/setup-python | |
with: | |
python-version: "3.11" | |
- 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@v4 | |
- name: ruff formatter | |
uses: chartboost/ruff-action@v1 | |
with: | |
args: "format --check" | |
# 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 (`ruff format`) is failing | |
To keep the code consistent with lots of contributors, we run automated code consistency checks. | |
To fix this CI test, please run: | |
* `task format` | |
Once you push these changes the test should pass, and you can hide this comment :+1: | |
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@v4 | |
- name: Set up Python environment | |
uses: ./.github/actions/setup-python | |
with: | |
python-version: "3.11" | |
- 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 |