-
-
Notifications
You must be signed in to change notification settings - Fork 2
156 lines (126 loc) · 4.12 KB
/
quality.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
name: Quality
on:
push:
tags:
- "v*.*.*"
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
flake8:
name: Python linting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install developer dependencies
run: make app-deps app-dev-deps
- name: Lint with flake8
run: make flake8-check
pytest:
name: Python tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install developer dependencies
run: make app-deps app-dev-deps
- name: Run tests and produce .coverage file
run: make test
- name: Coverage comment
id: coverage_comment
uses: py-cov-action/python-coverage-comment-action@v3
with:
GITHUB_TOKEN: ${{ github.token }}
- name: Store Pull Request comment to be posted
uses: actions/upload-artifact@v3
if: steps.coverage_comment.outputs.COMMENT_FILE_WRITTEN == 'true'
with:
# If you use a different name, update COMMENT_ARTIFACT_NAME accordingly
name: python-coverage-comment-action
# If you use a different name, update COMMENT_FILENAME accordingly
path: python-coverage-comment-action.txt
black:
name: Python code formatting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install developer dependencies
run: make app-deps app-dev-deps
- name: Check coding style
run: make black-check
eslint:
name: JS linting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: "18.x"
- name: Setup JS environment
run: cd js && npm install
- name: Lint with eslint
run: make eslint
flake8-badge:
if: github.event_name == 'push'
name: Update flake8 badge
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install developer dependencies
run: make app-deps app-dev-deps
- name: Lint with flake8
run: make flake8
- name: Determine badge message and color
run: make flake8-badge | tail -1 | (IFS="@" read MESSAGE COLOR;
echo "FLAKE8_BADGE_MESSAGE=$MESSAGE" >> $GITHUB_ENV;
echo "FLAKE8_BADGE_COLOR=$COLOR" >> $GITHUB_ENV)
- name: Set up JSON file for badge
uses: schneegans/[email protected]
with:
auth: ${{ secrets.GIST_SECRET }}
gistID: 1cfaee423c85504cd204cf4649e2cf29
filename: flake8-badge.json
label: flake8
message: ${{ env.FLAKE8_BADGE_MESSAGE }}
color: ${{ env.FLAKE8_BADGE_COLOR }}
eslint-badge:
if: github.event_name == 'push'
name: Update eslint badge
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: "18.x"
- name: Setup JS environment
run: cd js && npm install
- name: Determine badge message and color
run: make eslint-badge | tail -1 | (IFS="@" read MESSAGE COLOR;
echo "ESLINT_BADGE_MESSAGE=$MESSAGE" >> $GITHUB_ENV;
echo "ESLINT_BADGE_COLOR=$COLOR" >> $GITHUB_ENV)
- name: Set up JSON file for badge
uses: schneegans/[email protected]
with:
auth: ${{ secrets.GIST_SECRET }}
gistID: 1cfaee423c85504cd204cf4649e2cf29
filename: eslint-badge.json
label: eslint
message: ${{ env.ESLINT_BADGE_MESSAGE }}
color: ${{ env.ESLINT_BADGE_COLOR }}