forked from MIT-Emerging-Talent/ET6-practice-code-review
-
Notifications
You must be signed in to change notification settings - Fork 1
76 lines (65 loc) · 2.01 KB
/
ci-checks.yml
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
name: ET CI Checks
on: [push, pull_request, workflow_dispatch]
jobs:
ls_linting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ls-lint/action@v2.2.3
md_formatting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: nosborn/github-action-markdown-cli@v3.3.0
with:
files: .
config_file: .markdownlint.yml
py_formatting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Python - Check Formatting
uses: astral-sh/ruff-action@v1
with:
args: "format --check"
py_linting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# passing ruff linting is required
- name: Python - Check Linting - ruff
uses: astral-sh/ruff-action@v1
# passing pylint is not required - discuss errors in code review
# adapted from https://github.com/davidslusser/actions_python_pylint/tree/main
- name: python version
run: python --version
shell: bash
if: always()
- name: install pylint
run: |
python - m pip install --upgrade pip
pip install pylint
shell: bash
- name: Python - Check Linting - pylint
run: "pylint solutions tests || echo '::warning title=Pylint Error(s)::Discuss solutions and trade-offs in code review.'"
shell: bash
py_tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: python version
run: python --version
shell: bash
- name: Check for test files
id: check_tests
run: |
if find . -type f -name "test_*.py" | grep -q .; then
echo "has_tests=true" >> $GITHUB_OUTPUT
else
echo "has_tests=false" >> $GITHUB_OUTPUT
fi
shell: bash
- name: Python - Run Tests
if: steps.check_tests.outputs.has_tests == 'true'
run: python -m unittest
shell: bash