mirror of
https://github.com/jupyterhub/the-littlest-jupyterhub.git
synced 2025-12-18 21:54:05 +08:00
sync with main
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# dependabot.yml reference: https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
|
||||
# dependabot.yaml reference: https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
|
||||
#
|
||||
# Notes:
|
||||
# - Status and logs from dependabot are provided at
|
||||
@@ -9,8 +9,9 @@ version: 2
|
||||
updates:
|
||||
# Maintain dependencies in our GitHub Workflows
|
||||
- package-ecosystem: github-actions
|
||||
directory: "/" # This should be / rather than .github/workflows
|
||||
directory: /
|
||||
labels: [ci]
|
||||
schedule:
|
||||
interval: weekly
|
||||
interval: monthly
|
||||
time: "05:00"
|
||||
timezone: "Etc/UTC"
|
||||
timezone: Etc/UTC
|
||||
42
.github/integration-test.py
vendored
42
.github/integration-test.py
vendored
@@ -122,10 +122,16 @@ def copy_to_container(container_name, src_path, dest_path):
|
||||
|
||||
|
||||
def run_test(
|
||||
image_name, test_name, bootstrap_pip_spec, test_files, upgrade, installer_args
|
||||
image_name,
|
||||
test_name,
|
||||
bootstrap_pip_spec,
|
||||
test_files,
|
||||
upgrade_from,
|
||||
installer_args,
|
||||
):
|
||||
"""
|
||||
Wrapper that sets up tljh with installer_args & runs test_name
|
||||
Starts a new container based on image_name, runs the bootstrap script to
|
||||
setup tljh with installer_args, and runs test_name.
|
||||
"""
|
||||
stop_container(test_name)
|
||||
run_systemd_image(image_name, test_name, bootstrap_pip_spec)
|
||||
@@ -144,12 +150,26 @@ def run_test(
|
||||
print(container_check_output(["logs", test_name]).decode())
|
||||
print(f"--- End of logs from the container: {test_name}")
|
||||
|
||||
# Install TLJH from the default branch first to test upgrades
|
||||
if upgrade:
|
||||
# To test upgrades, we run a bootstrap.py script two times instead of one,
|
||||
# where the initial run first installs some older version.
|
||||
#
|
||||
# We want to support testing a PR by upgrading from "main", "latest" (latest
|
||||
# released version), and from a previous major-like version.
|
||||
#
|
||||
# FIXME: We currently always rely on the main branch's bootstrap.py script.
|
||||
# Realistically, we should run previous versions of the bootstrap
|
||||
# script which also installs previous versions of TLJH.
|
||||
#
|
||||
# 2023-04-15 Erik observed that https://tljh.jupyter.org/bootstrap.py
|
||||
# is referencing to the master (now main) branch which didn't seem
|
||||
# obvious, thinking it could have been the latest released version
|
||||
# also.
|
||||
#
|
||||
if upgrade_from:
|
||||
run_container_command(
|
||||
test_name, "curl -L https://tljh.jupyter.org/bootstrap.py | python3 -"
|
||||
test_name,
|
||||
f"curl -L https://tljh.jupyter.org/bootstrap.py | python3 - --version={upgrade_from}",
|
||||
)
|
||||
|
||||
run_container_command(test_name, f"python3 /srv/src/bootstrap.py {installer_args}")
|
||||
|
||||
# Install pkgs from requirements in hub's pip, where
|
||||
@@ -192,9 +212,11 @@ def main():
|
||||
dest="build_args",
|
||||
)
|
||||
|
||||
subparsers.add_parser("stop-container").add_argument("container_name")
|
||||
stop_container_parser = subparsers.add_parser("stop-container")
|
||||
stop_container_parser.add_argument("container_name")
|
||||
|
||||
subparsers.add_parser("start-container").add_argument("container_name")
|
||||
start_container_parser = subparsers.add_parser("start-container")
|
||||
start_container_parser.add_argument("container_name")
|
||||
|
||||
run_parser = subparsers.add_parser("run")
|
||||
run_parser.add_argument("container_name")
|
||||
@@ -207,7 +229,7 @@ def main():
|
||||
|
||||
run_test_parser = subparsers.add_parser("run-test")
|
||||
run_test_parser.add_argument("--installer-args", default="")
|
||||
run_test_parser.add_argument("--upgrade", action="store_true")
|
||||
run_test_parser.add_argument("--upgrade-from", default="")
|
||||
run_test_parser.add_argument(
|
||||
"--bootstrap-pip-spec", nargs="?", default="", type=str
|
||||
)
|
||||
@@ -227,7 +249,7 @@ def main():
|
||||
args.test_name,
|
||||
args.bootstrap_pip_spec,
|
||||
args.test_files,
|
||||
args.upgrade,
|
||||
args.upgrade_from,
|
||||
args.installer_args,
|
||||
)
|
||||
elif args.action == "show-logs":
|
||||
|
||||
77
.github/workflows/integration-test.yaml
vendored
77
.github/workflows/integration-test.yaml
vendored
@@ -8,14 +8,12 @@ on:
|
||||
paths-ignore:
|
||||
- "docs/**"
|
||||
- "**.md"
|
||||
- "**.rst"
|
||||
- ".github/workflows/*"
|
||||
- "!.github/workflows/integration-test.yaml"
|
||||
push:
|
||||
paths-ignore:
|
||||
- "docs/**"
|
||||
- "**.md"
|
||||
- "**.rst"
|
||||
- ".github/workflows/*"
|
||||
- "!.github/workflows/integration-test.yaml"
|
||||
branches-ignore:
|
||||
@@ -24,58 +22,7 @@ on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
# This job is used as a workaround to a limitation when using a matrix of
|
||||
# variations that a job should be executed against. The limitation is that a
|
||||
# matrix once defined can't include any conditions.
|
||||
#
|
||||
# What this job does before our real test job with a matrix of variations run,
|
||||
# is to decide on that matrix of variations a conditional logic of our choice.
|
||||
#
|
||||
# For more details, see this excellent stack overflow answer:
|
||||
# https://stackoverflow.com/a/65434401/2220152
|
||||
#
|
||||
decide-on-test-jobs-to-run:
|
||||
name: Decide on test jobs to run
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
outputs:
|
||||
matrix: ${{ steps.set-matrix.outputs.matrix }}
|
||||
|
||||
steps:
|
||||
# Currently, this logic filters out a matrix entry equaling a specific git
|
||||
# reference identified by "dont_run_on_ref".
|
||||
- name: Decide on test jobs to run
|
||||
id: set-matrix
|
||||
run: |
|
||||
matrix_post_filter=$(
|
||||
echo "$matrix_include_pre_filter" \
|
||||
| yq e --output-format=json '.' - \
|
||||
| jq -c '{"include": map( . | select(.dont_run_on_ref != "${{ github.ref }}" ))}'
|
||||
)
|
||||
echo "matrix=$matrix_post_filter" >> $GITHUB_OUTPUT
|
||||
|
||||
echo "The subsequent job's matrix are:"
|
||||
echo $matrix_post_filter | jq -C '.'
|
||||
env:
|
||||
matrix_include_pre_filter: |
|
||||
- name: "Int. tests: Debian 11, Py 3.9"
|
||||
distro_image: "debian:11"
|
||||
runs_on: "ubuntu-22.04"
|
||||
extra_flags: ""
|
||||
- name: "Int. tests: Ubuntu 20.04, Py 3.8"
|
||||
distro_image: "ubuntu:20.04"
|
||||
extra_flags: ""
|
||||
- name: "Int. tests: Ubuntu 22.04 Py 3.10"
|
||||
distro_image: "ubuntu:22.04"
|
||||
extra_flags: ""
|
||||
- name: "Int. tests: Ubuntu 22.04, Py 3.10, --upgrade"
|
||||
distro_image: "ubuntu:22.04"
|
||||
extra_flags: --upgrade
|
||||
dont_run_on_ref: refs/heads/master
|
||||
|
||||
integration-tests:
|
||||
needs: decide-on-test-jobs-to-run
|
||||
|
||||
# integration tests run in a container,
|
||||
# not in the worker, so this version is not relevant to the tests
|
||||
# and can be the same for all tested versions
|
||||
@@ -84,7 +31,27 @@ jobs:
|
||||
name: ${{ matrix.name }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix: ${{ fromJson(needs.decide-on-test-jobs-to-run.outputs.matrix) }}
|
||||
matrix:
|
||||
include:
|
||||
- name: "Debian 11, Py 3.9"
|
||||
distro_image: "debian:11"
|
||||
runs_on: "ubuntu-22.04"
|
||||
extra_flags: ""
|
||||
- name: "Ubuntu 20.04, Py 3.8"
|
||||
distro_image: "ubuntu:20.04"
|
||||
extra_flags: ""
|
||||
- name: "Ubuntu 22.04 Py 3.10"
|
||||
distro_image: "ubuntu:22.04"
|
||||
extra_flags: ""
|
||||
- name: "Ubuntu 22.04, Py 3.10, from main"
|
||||
distro_image: "ubuntu:22.04"
|
||||
extra_flags: --upgrade-from=main
|
||||
- name: "Ubuntu 22.04, Py 3.10, from latest"
|
||||
distro_image: "ubuntu:22.04"
|
||||
extra_flags: --upgrade-from=latest
|
||||
- name: "Ubuntu 22.04, Py 3.10, from 0.2.0"
|
||||
distro_image: "ubuntu:22.04"
|
||||
extra_flags: --upgrade-from=0.2.0
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
@@ -107,7 +74,7 @@ jobs:
|
||||
# integration-tests/test_bootstrap.py will build and start containers
|
||||
# based on this environment variable. This is similar to how
|
||||
# .github/integration-test.py build-image can take a --build-arg
|
||||
# setting the base image.
|
||||
# setting the base image via a Dockerfile ARG.
|
||||
BASE_IMAGE: ${{ matrix.distro_image }}
|
||||
|
||||
# We build a docker image from wherein we will work
|
||||
|
||||
9
.github/workflows/unit-test.yaml
vendored
9
.github/workflows/unit-test.yaml
vendored
@@ -8,14 +8,12 @@ on:
|
||||
paths-ignore:
|
||||
- "docs/**"
|
||||
- "**.md"
|
||||
- "**.rst"
|
||||
- ".github/workflows/*"
|
||||
- "!.github/workflows/unit-test.yaml"
|
||||
push:
|
||||
paths-ignore:
|
||||
- "docs/**"
|
||||
- "**.md"
|
||||
- "**.rst"
|
||||
- ".github/workflows/*"
|
||||
- "!.github/workflows/unit-test.yaml"
|
||||
branches-ignore:
|
||||
@@ -42,10 +40,10 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- name: "Unit tests: Ubuntu 20.04, Py 3.9"
|
||||
- name: "Ubuntu 20.04, Py 3.9"
|
||||
ubuntu_version: "20.04"
|
||||
python_version: "3.9"
|
||||
- name: "Unit tests: Ubuntu 22.04, Py 3.10"
|
||||
- name: "Ubuntu 22.04, Py 3.10"
|
||||
ubuntu_version: "22.04"
|
||||
python_version: "3.10"
|
||||
|
||||
@@ -98,5 +96,4 @@ jobs:
|
||||
run: pytest --verbose --maxfail=2 --color=yes --durations=10 --cov=tljh tests/
|
||||
timeout-minutes: 15
|
||||
|
||||
- name: Upload code coverage stats
|
||||
run: codecov
|
||||
- uses: codecov/codecov-action@v3
|
||||
|
||||
Reference in New Issue
Block a user