Skip to content

Commit

Permalink
Merge pull request #2 from alexwlchan/upgrade-github-actions
Browse files Browse the repository at this point in the history
Upgrade my GitHub Actions setup
  • Loading branch information
alexwlchan committed May 7, 2024
2 parents cda9737 + 6302187 commit 73ccfe6
Show file tree
Hide file tree
Showing 8 changed files with 75 additions and 56 deletions.
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "pip-compile"
directory: "/"
schedule:
interval: "daily"
35 changes: 25 additions & 10 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,44 @@
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
cache: pip
cache-dependency-path: dev_requirements.txt

- 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
3 changes: 3 additions & 0 deletions dev_requirements.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
black
flake8
pytest-cov
38 changes: 38 additions & 0 deletions dev_requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#
# This file is autogenerated by pip-compile with Python 3.11
# by the following command:
#
# pip-compile dev_requirements.in
#
black==24.4.2
# via -r dev_requirements.in
click==8.1.7
# via black
coverage[toml]==7.5.1
# via pytest-cov
flake8==7.0.0
# via -r dev_requirements.in
iniconfig==2.0.0
# via pytest
mccabe==0.7.0
# via flake8
mypy-extensions==1.0.0
# via black
packaging==24.0
# via
# black
# pytest
pathspec==0.12.1
# via black
platformdirs==4.2.1
# via black
pluggy==1.5.0
# via pytest
pycodestyle==2.11.1
# via flake8
pyflakes==3.2.0
# via flake8
pytest==8.2.0
# via pytest-cov
pytest-cov==5.0.0
# via -r dev_requirements.in
2 changes: 1 addition & 1 deletion examples/downloading.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ def save_http_cat(status_code):
if __name__ == "__main__":
codes = [200, 201, 202, 301, 302, 400, 405, 410, 418, 420, 451, 500]

for (input, output) in concurrently(save_http_cat, inputs=codes):
for input, output in concurrently(save_http_cat, inputs=codes):
print(input, output)
2 changes: 1 addition & 1 deletion examples/sleepy_multiply.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ def sleepy_multiply(x, y):
(6, 1),
]

for ((x, y), output) in concurrently(lambda x: sleepy_multiply(*x), inputs=inputs):
for (x, y), output in concurrently(lambda x: sleepy_multiply(*x), inputs=inputs):
print(x, "*", y, "=", output)
1 change: 1 addition & 0 deletions requirements_test.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
black
flake8
pytest-cov
44 changes: 0 additions & 44 deletions requirements_test.txt

This file was deleted.

0 comments on commit 73ccfe6

Please sign in to comment.