Skip to content

Commit

Permalink
Merge pull request #1465 from consideRatio/pr/pre-commit-run
Browse files Browse the repository at this point in the history
pre-commit: run all pre-commit autoformatting hooks, add one for ci/check-embedded-chart-code.py script as well and run it
  • Loading branch information
minrk authored Apr 1, 2022
2 parents ef354c0 + a9e2bc8 commit 656204b
Show file tree
Hide file tree
Showing 73 changed files with 2,471 additions and 2,022 deletions.
21 changes: 21 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# This file can be used to disregard certain commits when using `git blame`, and
# GitHub will automatically use it for that by file name convention.
#
# Reference 1: https://git-scm.com/docs/git-blame#Documentation/git-blame.txt---ignore-revs-fileltfilegt
# Reference 2: https://docs.github.com/en/repositories/working-with-files/using-files/viewing-a-file#ignore-commits-in-the-blame-view
#

# pre-commit: run requirements-txt-fixer
da40927c5b187e37755901e675eee092e12ae2eb
# pre-commit: run end-of-file-fixer
b815163691eade7daeeb01549d0fc6bdf4a33186
# pre-commit: run prettier
9fefdc42ec4d1701117f8f2880a80695eeaad5c9
# pre-commit: run update-values-based-on-bindarspawner-mixin
d32e9efa34cf0ca8880939e82ff01d3edc35705b
# pre-commit: run isort
f0fe0257506fd667279e97354f0207168aa1368c
# pre-commit: run black
bb047d8bce89655e197a7fdf2bdec2cb9c79940a
# pre-commit: run pyupgrade
24da4e593461640aaa47dc008b1f657b92189085
1 change: 0 additions & 1 deletion .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,3 @@ If you aren't sure where to go use https://github.com/jupyterhub/binder/issues/n
Thank you for being awesome!
-->

2 changes: 1 addition & 1 deletion .github/workflows/diff.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:

- uses: actions/setup-python@v2
with:
python-version: '3.8'
python-version: "3.8"
- name: Install helm diff plugin, update local chart dependencies
run: |
helm plugin install https://github.com/databus23/helm-diff
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/eslint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install modules
run: npm i
- name: Run ESLint on binderhub JS
run: npm run lint
- uses: actions/checkout@v2
- name: Install modules
run: npm i
- name: Run ESLint on binderhub JS
run: npm run lint
5 changes: 2 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
pull_request:
push:


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

- name: Set up QEMU (for docker buildx)
uses: docker/setup-qemu-action@27d0a4f181a40b142cce983c5393082c365d1480 # dependabot updates to latest release
Expand Down Expand Up @@ -91,7 +90,7 @@ jobs:
fetch-depth: 0
- uses: actions/setup-python@v2
with:
python-version: '3.9'
python-version: "3.9"
- name: Install pypa/build
run: python -mpip install build
- name: Build a sdist, and a binary wheel from the sdist
Expand Down
104 changes: 52 additions & 52 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ jobs:
fail-fast: false
matrix:
k3s-channel:
# Available channels: https://github.com/k3s-io/k3s/blob/HEAD/channel.yaml
- latest
# Available channels: https://github.com/k3s-io/k3s/blob/HEAD/channel.yaml
- latest
test:
- main
- auth
- helm
- main
- auth
- helm
include:
# Chart.yaml contains the chart's oldest supported k8s version, we
# want to test against that. We also test against the oldest known
Expand Down Expand Up @@ -68,16 +68,16 @@ jobs:

- name: Setup OS level dependencies
run: |
sudo apt-get update
sudo apt-get install --yes \
build-essential \
curl \
libcurl4-openssl-dev \
libssl-dev
sudo apt-get update
sudo apt-get install --yes \
build-essential \
curl \
libcurl4-openssl-dev \
libssl-dev
- uses: actions/setup-node@v2-beta
with:
node-version: '14'
node-version: "14"

- name: Cache npm
uses: actions/cache@v2
Expand All @@ -89,12 +89,12 @@ jobs:
- name: Run webpack to build static assets
run: |
npm install
npm run webpack
npm install
npm run webpack
- uses: actions/setup-python@v2
with:
python-version: '3.8'
python-version: "3.8"

- name: Cache pip
uses: actions/cache@v2
Expand All @@ -107,8 +107,8 @@ jobs:
- name: Update pip
run: |
pip install --upgrade pip
pip install --upgrade setuptools wheel
pip install --upgrade pip
pip install --upgrade setuptools wheel
- name: Setup Python package dependencies
run: |
Expand All @@ -118,20 +118,20 @@ jobs:
- name: Install JupyterHub chart for main tests
if: matrix.test == 'main'
run: |
./testing/local-binder-k8s-hub/install-jupyterhub-chart
./testing/local-binder-k8s-hub/install-jupyterhub-chart
- name: Install JupyterHub chart for auth tests
if: matrix.test == 'auth'
run: |
./testing/local-binder-k8s-hub/install-jupyterhub-chart --auth
./testing/local-binder-k8s-hub/install-jupyterhub-chart --auth
- name: Use chartpress to create the helm chart
if: matrix.test == 'helm'
run: |
# Use chartpress to create the helm chart and build its images
helm dependency update ./helm-chart/binderhub
(cd helm-chart && chartpress)
git --no-pager diff --color=always
# Use chartpress to create the helm chart and build its images
helm dependency update ./helm-chart/binderhub
(cd helm-chart && chartpress)
git --no-pager diff --color=always
- name: Generate values.schema.json from schema.yaml
if: matrix.test == 'helm'
Expand All @@ -147,10 +147,10 @@ jobs:
- name: Validate the chart against the k8s API
if: matrix.test == 'helm'
run: |
helm template --validate binderhub-test helm-chart/binderhub \
--values testing/k8s-binder-k8s-hub/binderhub-chart-config.yaml \
--set config.BinderHub.hub_url=http://localhost:30902 \
--set config.GitHubRepoProvider.access_token=$GITHUB_ACCESS_TOKEN
helm template --validate binderhub-test helm-chart/binderhub \
--values testing/k8s-binder-k8s-hub/binderhub-chart-config.yaml \
--set config.BinderHub.hub_url=http://localhost:30902 \
--set config.GitHubRepoProvider.access_token=$GITHUB_ACCESS_TOKEN
- name: "(Upgrade) Install ${{ matrix.upgrade-from }} chart"
if: matrix.test-variation == 'upgrade'
Expand Down Expand Up @@ -210,20 +210,20 @@ jobs:
- name: Await and curl JupyterHub
run: |
. ci/common
await_jupyterhub
. ci/common
await_jupyterhub
echo curl http://localhost:30902/hub/api/ should print the JupyterHub version
curl http://localhost:30902/hub/api/ --max-time 5 --retry 5 --retry-delay 1 --retry-connrefused
echo curl http://localhost:30902/hub/api/ should print the JupyterHub version
curl http://localhost:30902/hub/api/ --max-time 5 --retry 5 --retry-delay 1 --retry-connrefused
- name: Await and curl BinderHub
if: matrix.test == 'helm'
run: |
. ci/common
await_binderhub binderhub-test
. ci/common
await_binderhub binderhub-test
echo curl http://localhost:30901/health to check BinderHub\'s health
curl http://localhost:30901/health --max-time 5 --retry 5 --retry-delay 1 --retry-connrefused
echo curl http://localhost:30901/health to check BinderHub\'s health
curl http://localhost:30901/health --max-time 5 --retry 5 --retry-delay 1 --retry-connrefused
- name: Run main tests
if: matrix.test == 'main'
Expand All @@ -238,8 +238,8 @@ jobs:
- name: Run helm tests
if: matrix.test == 'helm'
run: |
export BINDER_URL=http://localhost:30901
pytest -m "remote" -v --maxfail=10 --cov binderhub --durations=10 --color=yes
export BINDER_URL=http://localhost:30901
pytest -m "remote" -v --maxfail=10 --cov binderhub --durations=10 --color=yes
# GitHub Action reference: https://github.com/jupyterhub/action-k8s-namespace-report
- name: Kubernetes namespace report
Expand All @@ -260,16 +260,16 @@ jobs:

- name: Setup OS level dependencies
run: |
sudo apt-get update
sudo apt-get install --yes \
build-essential \
curl \
libcurl4-openssl-dev \
libssl-dev
sudo apt-get update
sudo apt-get install --yes \
build-essential \
curl \
libcurl4-openssl-dev \
libssl-dev
- uses: actions/setup-node@v2-beta
with:
node-version: '14'
node-version: "14"

- name: Cache npm
uses: actions/cache@v2
Expand All @@ -281,7 +281,7 @@ jobs:
- uses: actions/setup-python@v2
with:
python-version: '3.8'
python-version: "3.8"

- name: Cache pip
uses: actions/cache@v2
Expand All @@ -294,8 +294,8 @@ jobs:
- name: Update pip
run: |
pip install --upgrade pip
pip install --upgrade setuptools wheel
pip install --upgrade pip
pip install --upgrade setuptools wheel
- name: Setup Python package dependencies
run: |
Expand All @@ -307,12 +307,12 @@ jobs:

- name: Await and curl JupyterHub
run: |
cd testing/local-binder-local-hub
jupyterhub --config=jupyterhub_config.py > jupyterhub.log 2>&1 &
sleep 5
cd testing/local-binder-local-hub
jupyterhub --config=jupyterhub_config.py > jupyterhub.log 2>&1 &
sleep 5
echo curl http://localhost:8000/hub/api/ should print the JupyterHub version
curl http://localhost:8000/hub/api/ --max-time 5 --retry 5 --retry-delay 1 --retry-connrefused
echo curl http://localhost:8000/hub/api/ should print the JupyterHub version
curl http://localhost:8000/hub/api/ --max-time 5 --retry 5 --retry-delay 1 --retry-connrefused
- name: Run remote tests
run: |
Expand Down
24 changes: 20 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,29 @@ repos:
rev: 22.1.0
hooks:
- id: black
args: [--target-version=py37]
# args are not passed, but see the config in pyproject.toml

# Autoformat: Python code
- repo: https://github.com/asottile/reorder_python_imports
rev: v3.0.1
- repo: https://github.com/pycqa/isort
rev: 5.10.1
hooks:
- id: reorder-python-imports
- id: isort
# args are not passed, but see the config in pyproject.toml

# Generated code:
# An entry in helm-chart/binderhub/values.yaml should be generated based on
# binderhub/binderspawner_mixin.py. See ci/check_embedded_chart_code.py for
# more details.
- repo: local
hooks:
- id: update-values-based-on-bindarspawner-mixin
name: Update helm-chart/binderhub/values.yaml based on binderhub/binderspawner_mixin.py
language: system
entry: python ci/check_embedded_chart_code.py
args:
- --update
files: binderhub/binderspawner_mixin.py|helm-chart/binderhub/values.yaml
pass_filenames: false

# Autoformat: js, html, markdown, yaml, json
- repo: https://github.com/pre-commit/mirrors-prettier
Expand Down
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
helm-chart/binderhub/templates/
http-record.doi.org.json
http-record.doi.org.json
Loading

0 comments on commit 656204b

Please sign in to comment.