-
Notifications
You must be signed in to change notification settings - Fork 62.4k
94 lines (77 loc) · 2.55 KB
/
Copy pathcode-quality.yml
File metadata and controls
94 lines (77 loc) · 2.55 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
name: Code Quality
on:
push:
branches:
- main
paths:
- '**.py'
- '**.ts'
- '**.js'
- 'pyproject.toml'
- '.eslintrc.json'
- '.github/workflows/code-quality.yml'
pull_request:
branches:
- main
paths:
- '**.py'
- '**.ts'
- '**.js'
- 'pyproject.toml'
- '.eslintrc.json'
- '.github/workflows/code-quality.yml'
permissions:
contents: read
jobs:
python-quality:
name: Python Lint & Format
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up Python
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
with:
python-version: '3.11'
- name: Install linters
run: python -m pip install --upgrade ruff black
# Enforced: the maintained shared utilities module must stay clean.
- name: Ruff lint (shared utilities)
run: ruff check shared/
- name: Black format check (shared utilities)
run: black --check shared/
# Advisory: surface issues across the rest of the curriculum without
# failing the build (lesson samples are intentionally kept simple).
- name: Ruff lint (full repository, advisory)
continue-on-error: true
run: ruff check .
python-tests:
name: Python Tests
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up Python
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
with:
python-version: '3.11'
- name: Install test dependencies
run: python -m pip install pytest openai requests python-dotenv
- name: Run pytest (shared utilities)
run: pytest tests/
js-quality:
name: JavaScript/TypeScript Lint (advisory)
runs-on: ubuntu-latest
# Advisory only: educational samples are not held to strict lint rules.
continue-on-error: true
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: '20'
- name: Install ESLint
run: npm install --no-save eslint@8 @typescript-eslint/parser @typescript-eslint/eslint-plugin
- name: Run ESLint
run: npx eslint . --ext .js,.ts