Skip to content

Commit 33b2e16

Browse files
authored
Move linters from CircleCI to GitHub actions (#289)
* Move linters from CircleCI to GitHub actions * Update README with fresh black links and a GitHub actions badge * Only trigger push workflow on master * Remove CircleCI integration
1 parent 4e2582a commit 33b2e16

File tree

4 files changed

+65
-54
lines changed

4 files changed

+65
-54
lines changed

.circleci/config.yml

Lines changed: 0 additions & 47 deletions
This file was deleted.

.github/workflows/linters.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Check that code is formatted consistently
2+
#
3+
# Available Python versions:
4+
# https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json
5+
6+
name: linters
7+
on:
8+
push:
9+
branches:
10+
- master
11+
pull_request:
12+
13+
jobs:
14+
tests:
15+
name: ${{ matrix.name }}
16+
runs-on: ${{ matrix.os }}
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
include:
21+
- {name: Linux311, python: '3.11.0-rc.1', os: ubuntu-latest}
22+
steps:
23+
- name: Check out repository
24+
uses: actions/checkout@v2
25+
26+
- name: Set up Python
27+
uses: actions/setup-python@v2
28+
with:
29+
python-version: ${{ matrix.python }}
30+
31+
- name: Restore cache
32+
id: cache
33+
uses: actions/cache@v3
34+
with:
35+
path: ./venv
36+
key: ${{ matrix.name }}-pip-${{ hashFiles('requirements.txt') }}
37+
restore-keys: |
38+
${{ matrix.name }}-pip-
39+
40+
- name: Install dependencies
41+
if: steps.cache.outputs.cache-hit != 'true'
42+
run: |
43+
python -m venv venv
44+
. venv/bin/activate
45+
python -m pip install --upgrade pip
46+
python -m pip install -r requirements.txt
47+
48+
- name: Check code style
49+
run: |
50+
. venv/bin/activate
51+
python -m flake8
52+
python -m black --check .
53+
54+
- name: Check directory layout
55+
run: |
56+
. venv/bin/activate
57+
python .github/workflows/dircheck.py

README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,20 @@
22

33
Bonus materials, exercises, and example projects for Real Python's [Python tutorials](https://realpython.com).
44

5-
Build Status: [![CircleCI](https://circleci.com/gh/realpython/materials.svg?style=svg)](https://circleci.com/gh/realpython/materials)
5+
Build Status:
6+
[![GitHub Actions](https://img.shields.io/github/workflow/status/realpython/materials/linters?label=build)](https://github.com/realpython/materials/actions)
67

78
## Got a Question?
89

9-
The best way to get support for Real Python courses & articles and code in this repository is to join one of our [weekly Office Hours calls](https://realpython.com/office-hours/) or to ask your question in the [RP Community Slack](https://realpython.com/community/).
10+
The best way to get support for Real Python courses, articles, and code in this repository is to join one of our [weekly Office Hours calls](https://realpython.com/office-hours/) or to ask your question in the [RP Community Slack](https://realpython.com/community/).
1011

11-
Due to time constraints we cannot provide 1:1 support via GitHub. See you on Slack or on the next Office Hours call 🙂
12+
Due to time constraints, we cannot provide 1:1 support via GitHub. See you on Slack or on the next Office Hours call 🙂
1213

1314
## Adding Source Code & Sample Projects to This Repo (RP Contributors)
1415

1516
### Running Code Style Checks
1617

17-
We use [flake8](http://flake8.pycqa.org/en/latest/) and [black](https://github.com/ambv/black) to ensure a consistent code style for all of our sample code in this repository.
18+
We use [flake8](http://flake8.pycqa.org/en/latest/) and [black](https://black.readthedocs.io/) to ensure a consistent code style for all of our sample code in this repository.
1819

1920
Run the following commands to validate your code against the linters:
2021

@@ -25,11 +26,11 @@ $ black --check .
2526

2627
### Running Python Code Formatter
2728

28-
We're using a tool called [black](https://github.com/ambv/black) on this repo to ensure consistent formatting. On CI it runs in "check" mode to ensure any new files added to the repo are following PEP 8. If you see linter warnings that say something like "would reformat some_file.py" it means black disagrees with your formatting.
29+
We're using a tool called [black](https://black.readthedocs.io/) on this repo to ensure consistent formatting. On CI it runs in "check" mode to ensure any new files added to the repo follow PEP 8. If you see linter warnings that say something like "would reformat some_file.py" it means that black disagrees with your formatting.
2930

30-
**The easiest way to resolve these errors is to just run Black locally on the code and then committing those changes, as explained below.**
31+
**The easiest way to resolve these errors is to run Black locally on the code and then commit those changes, as explained below.**
3132

32-
To automatically re-format your code to be consistent with our code style guidelines, run [black](https://github.com/ambv/black) in the repository root folder:
33+
To automatically re-format your code to be consistent with our code style guidelines, run [black](https://black.readthedocs.io/) in the repository root folder:
3334

3435
```sh
3536
$ black .

0 commit comments

Comments
 (0)