Skip to content

Format code (#285) #548

Format code (#285)

Format code (#285) #548

Workflow file for this run

name: build
on:
pull_request:
types: [opened, synchronize]
merge_group:
types: [checks_requested]
push:
# Always run on push to main. The build cache can only be reused
# if it was saved by a run from the repository's default branch.
# The run result will be identical to that from the merge queue
# because the commit is identical, yet we need to perform it to
# seed the build cache.
branches:
- main
jobs:
ci:
strategy:
fail-fast: false
matrix:
pyVersion: [ '3.10', '3.11', '3.12' ]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4.1.7
- name: Install Python
uses: actions/setup-python@v5
with:
cache: 'pip'
cache-dependency-path: '**/pyproject.toml'
python-version: ${{ matrix.pyVersion }}
- name: Run unit tests
run: |
pip install hatch==1.9.4
make test
- name: Publish test coverage
uses: codecov/codecov-action@v4
fmt:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4.1.7
- name: Format all files
run: |
pip install hatch==1.9.4
make dev fmt
- name: Fail on differences
run: git diff --exit-code
no-lint-disabled:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4.1.7
with:
fetch-depth: 0
- name: Verify no lint disabled in the new code
run: |
NEW_CODE=$(git diff origin/main..$(git branch --show-current) | grep -e '^+')
CHEAT=$(echo "${NEW_CODE}" | grep '# pylint: disable' | grep -v "CHEAT" | wc -c)
if [ "${CHEAT}" -ne 0 ]; then
echo "Do not cheat the linter: ${CHEAT}"
exit 1
fi