Skip to content

Commit 656204b

Browse files
authored
Merge pull request #1465 from consideRatio/pr/pre-commit-run
pre-commit: run all pre-commit autoformatting hooks, add one for ci/check-embedded-chart-code.py script as well and run it
2 parents ef354c0 + a9e2bc8 commit 656204b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+2471
-2022
lines changed

.git-blame-ignore-revs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# This file can be used to disregard certain commits when using `git blame`, and
2+
# GitHub will automatically use it for that by file name convention.
3+
#
4+
# Reference 1: https://git-scm.com/docs/git-blame#Documentation/git-blame.txt---ignore-revs-fileltfilegt
5+
# Reference 2: https://docs.github.com/en/repositories/working-with-files/using-files/viewing-a-file#ignore-commits-in-the-blame-view
6+
#
7+
8+
# pre-commit: run requirements-txt-fixer
9+
da40927c5b187e37755901e675eee092e12ae2eb
10+
# pre-commit: run end-of-file-fixer
11+
b815163691eade7daeeb01549d0fc6bdf4a33186
12+
# pre-commit: run prettier
13+
9fefdc42ec4d1701117f8f2880a80695eeaad5c9
14+
# pre-commit: run update-values-based-on-bindarspawner-mixin
15+
d32e9efa34cf0ca8880939e82ff01d3edc35705b
16+
# pre-commit: run isort
17+
f0fe0257506fd667279e97354f0207168aa1368c
18+
# pre-commit: run black
19+
bb047d8bce89655e197a7fdf2bdec2cb9c79940a
20+
# pre-commit: run pyupgrade
21+
24da4e593461640aaa47dc008b1f657b92189085

.github/ISSUE_TEMPLATE.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,3 @@ If you aren't sure where to go use https://github.com/jupyterhub/binder/issues/n
1111
1212
Thank you for being awesome!
1313
-->
14-

.github/workflows/diff.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525

2626
- uses: actions/setup-python@v2
2727
with:
28-
python-version: '3.8'
28+
python-version: "3.8"
2929
- name: Install helm diff plugin, update local chart dependencies
3030
run: |
3131
helm plugin install https://github.com/databus23/helm-diff

.github/workflows/eslint.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ jobs:
1111
build:
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: actions/checkout@v2
15-
- name: Install modules
16-
run: npm i
17-
- name: Run ESLint on binderhub JS
18-
run: npm run lint
14+
- uses: actions/checkout@v2
15+
- name: Install modules
16+
run: npm i
17+
- name: Run ESLint on binderhub JS
18+
run: npm run lint

.github/workflows/publish.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ on:
44
pull_request:
55
push:
66

7-
87
jobs:
98
# Builds and pushes docker images to DockerHub, packages the Helm chart and
109
# pushes it to jupyterhub/helm-chart@gh-pages where index.yaml represents the
@@ -23,7 +22,7 @@ jobs:
2322
fetch-depth: 0
2423
- uses: actions/setup-python@v2
2524
with:
26-
python-version: '3.8'
25+
python-version: "3.8"
2726

2827
- name: Set up QEMU (for docker buildx)
2928
uses: docker/setup-qemu-action@27d0a4f181a40b142cce983c5393082c365d1480 # dependabot updates to latest release
@@ -91,7 +90,7 @@ jobs:
9190
fetch-depth: 0
9291
- uses: actions/setup-python@v2
9392
with:
94-
python-version: '3.9'
93+
python-version: "3.9"
9594
- name: Install pypa/build
9695
run: python -mpip install build
9796
- name: Build a sdist, and a binary wheel from the sdist

.github/workflows/test.yml

Lines changed: 52 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ jobs:
3030
fail-fast: false
3131
matrix:
3232
k3s-channel:
33-
# Available channels: https://github.com/k3s-io/k3s/blob/HEAD/channel.yaml
34-
- latest
33+
# Available channels: https://github.com/k3s-io/k3s/blob/HEAD/channel.yaml
34+
- latest
3535
test:
36-
- main
37-
- auth
38-
- helm
36+
- main
37+
- auth
38+
- helm
3939
include:
4040
# Chart.yaml contains the chart's oldest supported k8s version, we
4141
# want to test against that. We also test against the oldest known
@@ -68,16 +68,16 @@ jobs:
6868

6969
- name: Setup OS level dependencies
7070
run: |
71-
sudo apt-get update
72-
sudo apt-get install --yes \
73-
build-essential \
74-
curl \
75-
libcurl4-openssl-dev \
76-
libssl-dev
71+
sudo apt-get update
72+
sudo apt-get install --yes \
73+
build-essential \
74+
curl \
75+
libcurl4-openssl-dev \
76+
libssl-dev
7777
7878
- uses: actions/setup-node@v2-beta
7979
with:
80-
node-version: '14'
80+
node-version: "14"
8181

8282
- name: Cache npm
8383
uses: actions/cache@v2
@@ -89,12 +89,12 @@ jobs:
8989
9090
- name: Run webpack to build static assets
9191
run: |
92-
npm install
93-
npm run webpack
92+
npm install
93+
npm run webpack
9494
9595
- uses: actions/setup-python@v2
9696
with:
97-
python-version: '3.8'
97+
python-version: "3.8"
9898

9999
- name: Cache pip
100100
uses: actions/cache@v2
@@ -107,8 +107,8 @@ jobs:
107107
108108
- name: Update pip
109109
run: |
110-
pip install --upgrade pip
111-
pip install --upgrade setuptools wheel
110+
pip install --upgrade pip
111+
pip install --upgrade setuptools wheel
112112
113113
- name: Setup Python package dependencies
114114
run: |
@@ -118,20 +118,20 @@ jobs:
118118
- name: Install JupyterHub chart for main tests
119119
if: matrix.test == 'main'
120120
run: |
121-
./testing/local-binder-k8s-hub/install-jupyterhub-chart
121+
./testing/local-binder-k8s-hub/install-jupyterhub-chart
122122
123123
- name: Install JupyterHub chart for auth tests
124124
if: matrix.test == 'auth'
125125
run: |
126-
./testing/local-binder-k8s-hub/install-jupyterhub-chart --auth
126+
./testing/local-binder-k8s-hub/install-jupyterhub-chart --auth
127127
128128
- name: Use chartpress to create the helm chart
129129
if: matrix.test == 'helm'
130130
run: |
131-
# Use chartpress to create the helm chart and build its images
132-
helm dependency update ./helm-chart/binderhub
133-
(cd helm-chart && chartpress)
134-
git --no-pager diff --color=always
131+
# Use chartpress to create the helm chart and build its images
132+
helm dependency update ./helm-chart/binderhub
133+
(cd helm-chart && chartpress)
134+
git --no-pager diff --color=always
135135
136136
- name: Generate values.schema.json from schema.yaml
137137
if: matrix.test == 'helm'
@@ -147,10 +147,10 @@ jobs:
147147
- name: Validate the chart against the k8s API
148148
if: matrix.test == 'helm'
149149
run: |
150-
helm template --validate binderhub-test helm-chart/binderhub \
151-
--values testing/k8s-binder-k8s-hub/binderhub-chart-config.yaml \
152-
--set config.BinderHub.hub_url=http://localhost:30902 \
153-
--set config.GitHubRepoProvider.access_token=$GITHUB_ACCESS_TOKEN
150+
helm template --validate binderhub-test helm-chart/binderhub \
151+
--values testing/k8s-binder-k8s-hub/binderhub-chart-config.yaml \
152+
--set config.BinderHub.hub_url=http://localhost:30902 \
153+
--set config.GitHubRepoProvider.access_token=$GITHUB_ACCESS_TOKEN
154154
155155
- name: "(Upgrade) Install ${{ matrix.upgrade-from }} chart"
156156
if: matrix.test-variation == 'upgrade'
@@ -210,20 +210,20 @@ jobs:
210210
211211
- name: Await and curl JupyterHub
212212
run: |
213-
. ci/common
214-
await_jupyterhub
213+
. ci/common
214+
await_jupyterhub
215215
216-
echo curl http://localhost:30902/hub/api/ should print the JupyterHub version
217-
curl http://localhost:30902/hub/api/ --max-time 5 --retry 5 --retry-delay 1 --retry-connrefused
216+
echo curl http://localhost:30902/hub/api/ should print the JupyterHub version
217+
curl http://localhost:30902/hub/api/ --max-time 5 --retry 5 --retry-delay 1 --retry-connrefused
218218
219219
- name: Await and curl BinderHub
220220
if: matrix.test == 'helm'
221221
run: |
222-
. ci/common
223-
await_binderhub binderhub-test
222+
. ci/common
223+
await_binderhub binderhub-test
224224
225-
echo curl http://localhost:30901/health to check BinderHub\'s health
226-
curl http://localhost:30901/health --max-time 5 --retry 5 --retry-delay 1 --retry-connrefused
225+
echo curl http://localhost:30901/health to check BinderHub\'s health
226+
curl http://localhost:30901/health --max-time 5 --retry 5 --retry-delay 1 --retry-connrefused
227227
228228
- name: Run main tests
229229
if: matrix.test == 'main'
@@ -238,8 +238,8 @@ jobs:
238238
- name: Run helm tests
239239
if: matrix.test == 'helm'
240240
run: |
241-
export BINDER_URL=http://localhost:30901
242-
pytest -m "remote" -v --maxfail=10 --cov binderhub --durations=10 --color=yes
241+
export BINDER_URL=http://localhost:30901
242+
pytest -m "remote" -v --maxfail=10 --cov binderhub --durations=10 --color=yes
243243
244244
# GitHub Action reference: https://github.com/jupyterhub/action-k8s-namespace-report
245245
- name: Kubernetes namespace report
@@ -260,16 +260,16 @@ jobs:
260260

261261
- name: Setup OS level dependencies
262262
run: |
263-
sudo apt-get update
264-
sudo apt-get install --yes \
265-
build-essential \
266-
curl \
267-
libcurl4-openssl-dev \
268-
libssl-dev
263+
sudo apt-get update
264+
sudo apt-get install --yes \
265+
build-essential \
266+
curl \
267+
libcurl4-openssl-dev \
268+
libssl-dev
269269
270270
- uses: actions/setup-node@v2-beta
271271
with:
272-
node-version: '14'
272+
node-version: "14"
273273

274274
- name: Cache npm
275275
uses: actions/cache@v2
@@ -281,7 +281,7 @@ jobs:
281281
282282
- uses: actions/setup-python@v2
283283
with:
284-
python-version: '3.8'
284+
python-version: "3.8"
285285

286286
- name: Cache pip
287287
uses: actions/cache@v2
@@ -294,8 +294,8 @@ jobs:
294294
295295
- name: Update pip
296296
run: |
297-
pip install --upgrade pip
298-
pip install --upgrade setuptools wheel
297+
pip install --upgrade pip
298+
pip install --upgrade setuptools wheel
299299
300300
- name: Setup Python package dependencies
301301
run: |
@@ -307,12 +307,12 @@ jobs:
307307

308308
- name: Await and curl JupyterHub
309309
run: |
310-
cd testing/local-binder-local-hub
311-
jupyterhub --config=jupyterhub_config.py > jupyterhub.log 2>&1 &
312-
sleep 5
310+
cd testing/local-binder-local-hub
311+
jupyterhub --config=jupyterhub_config.py > jupyterhub.log 2>&1 &
312+
sleep 5
313313
314-
echo curl http://localhost:8000/hub/api/ should print the JupyterHub version
315-
curl http://localhost:8000/hub/api/ --max-time 5 --retry 5 --retry-delay 1 --retry-connrefused
314+
echo curl http://localhost:8000/hub/api/ should print the JupyterHub version
315+
curl http://localhost:8000/hub/api/ --max-time 5 --retry 5 --retry-delay 1 --retry-connrefused
316316
317317
- name: Run remote tests
318318
run: |

.pre-commit-config.yaml

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,29 @@ repos:
2222
rev: 22.1.0
2323
hooks:
2424
- id: black
25-
args: [--target-version=py37]
25+
# args are not passed, but see the config in pyproject.toml
2626

2727
# Autoformat: Python code
28-
- repo: https://github.com/asottile/reorder_python_imports
29-
rev: v3.0.1
28+
- repo: https://github.com/pycqa/isort
29+
rev: 5.10.1
3030
hooks:
31-
- id: reorder-python-imports
31+
- id: isort
32+
# args are not passed, but see the config in pyproject.toml
33+
34+
# Generated code:
35+
# An entry in helm-chart/binderhub/values.yaml should be generated based on
36+
# binderhub/binderspawner_mixin.py. See ci/check_embedded_chart_code.py for
37+
# more details.
38+
- repo: local
39+
hooks:
40+
- id: update-values-based-on-bindarspawner-mixin
41+
name: Update helm-chart/binderhub/values.yaml based on binderhub/binderspawner_mixin.py
42+
language: system
43+
entry: python ci/check_embedded_chart_code.py
44+
args:
45+
- --update
46+
files: binderhub/binderspawner_mixin.py|helm-chart/binderhub/values.yaml
47+
pass_filenames: false
3248

3349
# Autoformat: js, html, markdown, yaml, json
3450
- repo: https://github.com/pre-commit/mirrors-prettier

.prettierignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
helm-chart/binderhub/templates/
2-
http-record.doi.org.json
2+
http-record.doi.org.json

0 commit comments

Comments
 (0)