Improve the GitHub Actions setup
- ID
f96b1c5- date
2024-05-07 08:39:17+00:00- author
Alex Chan <alex@alexwlchan.net>- parent
a7836fa- message
Improve the GitHub Actions setup * Run on pushes and pull requests * Bump to the latest version of `actions/checkout` (https://github.com/alexwlchan/.github/issues/3) * Bump to the latest version of `actions/setup-python` (https://github.com/alexwlchan/.github/issues/2) * Run on the newest version of Python * Add flake8 linting and enforce 100% coverage- changed files
1 file, 23 additions, 10 deletions
Changed files
.github/workflows/main.yml (601) → .github/workflows/main.yml (1076)
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index ff94e59..c196831 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -1,29 +1,42 @@
-on: push
+name: Run tests
+
+on:
+ push:
+ branches:
+ - main
+
+ pull_request:
+ branches:
+ - main
jobs:
test:
runs-on: ubuntu-latest
- timeout-minutes: 10
steps:
- name: Check out repository code
- uses: actions/checkout@v3
+ uses: actions/checkout@v4
- name: Setup Python
- uses: actions/setup-python@v2
+ uses: actions/setup-python@v5
with:
- python-version: "3.10"
+ python-version: "3.12"
- name: Install dependencies
- run: |
- pip3 install --user -r requirements_test.txt
+ run: python3 -m pip install -r dev_requirements.txt
- name: Check formatting
run: |
- black .
- git diff --exit-code
+ black --check .
+
+ # E501 = line too long; anything up to 100-ish is fine in my book
+ # (the "ish" is intentional; see https://www.youtube.com/watch?v=wf-BqAjZb8M)
+ #
+ # E203/W503/W504 = this is where black and flake8 conflict,
+ # see https://black.readthedocs.io/en/stable/faq.html#why-are-flake8-s-e203-and-w503-violated
+ flake8 --ignore=E501,E203,W503 --extend-select=W504
- name: Run test suite
run: |
coverage run -m pytest test_concurrently.py
- coverage report
+ coverage report --skip-covered --fail-under=100