-
Notifications
You must be signed in to change notification settings - Fork 18
55 lines (48 loc) · 1.96 KB
/
Copy pathci.yml
File metadata and controls
55 lines (48 loc) · 1.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# A descriptive name for your CI workflow
name: Python CI
# Controls when the workflow will run
on:
# Triggers the workflow on push events for the "main" branch
push:
branches: [ "main" ]
# Triggers the workflow on pull request events targeting the "main" branch
pull_request:
branches: [ "main" ]
# A workflow run is made up of one or more jobs
jobs:
build:
# The type of virtual machine to run the job on
runs-on: ubuntu-latest
# Define a matrix strategy to test against multiple Python versions
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11"]
# A sequence of tasks that will be executed as part of the job
steps:
# 1. Checks-out your repository so your job can access it
- name: Checkout repository
uses: actions/checkout@v4
# 2. Sets up the specific version of Python from the matrix
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
# 3. Installs dependencies
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 black
# This command installs your package in editable mode along with its dependencies
pip install -e .
# 4. Checks for syntax errors and undefined names with a linter
- name: Lint with Flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
# 5. Checks if the code is correctly formatted with Black
# The '--check' flag fails the job if files need reformatting.
- name: Check formatting with Black
run: |
black --check .