This repository has been archived by the owner on Aug 30, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 46
181 lines (153 loc) · 5.65 KB
/
lint.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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
---
name: Test & Lint
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
action-linter:
name: Action Linter
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: cschleiden/actions-linter@v1
with:
workflows: '[".github/workflows/*.yml"]'
force-rebase-schema-1-0-0:
name: You must rebase and install to get new schema v1.0.0
runs-on: ubuntu-latest
steps:
- run: echo "If you fail this job, you must rebase on main and then run poetry install --extras lint"
tox:
name: Python Lint & Test
runs-on: ubuntu-latest
steps:
- name: apt-get dependencies
run: |
sudo apt-get update
sudo apt-get install libbz2-dev liblzma-dev libreadline-dev libsqlite3-dev pdftohtml
- uses: actions/[email protected]
with:
repository: CAVaccineInventory/vaccine-feed-ingest
path: ./vaccine-feed-ingest/
submodules: true
- name: get python version
working-directory: vaccine-feed-ingest
run: |
python_version=$(cat .python-version)
echo "python_version=${python_version}" >> $GITHUB_ENV
- uses: actions/[email protected]
with:
python-version: ${{ env.python_version }}
- name: setup from README.md
run: |
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python -
echo "$HOME/.poetry/bin" >> $GITHUB_PATH
- name: load poetry install from cache
id: cached-poetry-dependencies
uses: actions/[email protected]
with:
path: vaccine-feed-ingest/.venv
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
- run: poetry install --extras lint
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
working-directory: vaccine-feed-ingest
- name: load .tox from cache
id: cached-tox-dependencies
uses: actions/[email protected]
with:
path: vaccine-feed-ingest/.tox
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
- run: poetry run tox
working-directory: vaccine-feed-ingest
- name: clean up .tox
working-directory: vaccine-feed-ingest
run: |
rm -f .tox/log/*
rm -f .tox/test/log/*
rm -f .tox/lint/log/*
run-pipeline:
name: Run all-stages for modified runners
runs-on: ubuntu-latest
if: ${{ github.event_name == 'pull_request' }}
steps:
- name: apt-get dependencies
run: |
sudo apt-get update
sudo apt-get install libbz2-dev liblzma-dev libreadline-dev libsqlite3-dev pdftohtml
- uses: actions/[email protected]
with:
repository: CAVaccineInventory/vaccine-feed-ingest
path: ./vaccine-feed-ingest/
submodules: true
fetch-depth: 0
- name: get python version
working-directory: vaccine-feed-ingest
run: |
python_version=$(cat .python-version)
echo "python_version=${python_version}" >> $GITHUB_ENV
- uses: actions/[email protected]
with:
python-version: ${{ env.python_version }}
- name: setup from README.md
run: |
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python -
echo "$HOME/.poetry/bin" >> $GITHUB_PATH
- name: load poetry install from cache
id: cached-poetry-dependencies
uses: actions/[email protected]
with:
path: vaccine-feed-ingest/.venv
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
- run: poetry install --extras lint
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
working-directory: vaccine-feed-ingest
- name: ensure cli starts
working-directory: vaccine-feed-ingest
run: poetry run vaccine-feed-ingest --help
- name: calculate runners to run
working-directory: vaccine-feed-ingest
run: |
git diff --name-only --diff-filter=ACMRT ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | \
grep "vaccine_feed_ingest/runners/[^._]" | \
sed -E "s#vaccine_feed_ingest/runners/([^/]+)/([^/]+)/.*#\1/\2#" | \
grep -v "us/" > ../runners_to_run.txt || true
- name: run selected runners
working-directory: vaccine-feed-ingest
run: |
if [[ -s ../runners_to_run.txt ]]; then
echo "will run the following runners"
cat ../runners_to_run.txt
cat ../runners_to_run.txt | xargs poetry run vaccine-feed-ingest all-stages
else
echo "no runners to run"
fi
repo-linter:
name: SuperLinter
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/[email protected]
with:
# Full git history is needed to get a proper list of changed files within `super-linter`
fetch-depth: 0
- name: Non-Python Lint
uses: github/[email protected]
env:
# Only validate files modified in the PR/commit
VALIDATE_ALL_CODEBASE: false
# The codebase has a lot of copy-pasted code by design
VALIDATE_JSCPD: false
# We lint python in the tox job
VALIDATE_PYTHON: false
VALIDATE_PYTHON_BLACK: false
VALIDATE_PYTHON_FLAKE8: false
VALIDATE_PYTHON_ISORT: false
VALIDATE_PYTHON_MYPY: false
VALIDATE_PYTHON_PYLINT: false
# General config
DEFAULT_BRANCH: main
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}