mirror of
https://github.com/jupyterhub/the-littlest-jupyterhub.git
synced 2025-12-18 21:54:05 +08:00
ci: let ubuntu version be configurable
This commit is contained in:
21
.github/integration-test.py
vendored
21
.github/integration-test.py
vendored
@@ -4,15 +4,16 @@ import subprocess
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
|
|
||||||
def build_systemd_image(image_name, source_path):
|
def build_systemd_image(image_name, source_path, build_args=None):
|
||||||
"""
|
"""
|
||||||
Build docker image with systemd at source_path.
|
Build docker image with systemd at source_path.
|
||||||
|
|
||||||
Built image is tagged with image_name
|
Built image is tagged with image_name
|
||||||
"""
|
"""
|
||||||
subprocess.check_call([
|
cmd = ['docker', 'build', '-t', image_name, source_path]
|
||||||
'docker', 'build', '-t', image_name, source_path
|
if build_args:
|
||||||
])
|
cmd.extend([f"--build-arg={ba}" for ba in build_args])
|
||||||
|
subprocess.check_call(cmd)
|
||||||
|
|
||||||
|
|
||||||
def run_systemd_image(image_name, container_name, bootstrap_pip_spec):
|
def run_systemd_image(image_name, container_name, bootstrap_pip_spec):
|
||||||
@@ -138,13 +139,21 @@ def main():
|
|||||||
argparser = argparse.ArgumentParser()
|
argparser = argparse.ArgumentParser()
|
||||||
subparsers = argparser.add_subparsers(dest='action')
|
subparsers = argparser.add_subparsers(dest='action')
|
||||||
|
|
||||||
subparsers.add_parser('build-image')
|
build_image_parser = subparsers.add_parser('build-image')
|
||||||
|
build_image_parser.add_argument(
|
||||||
|
"--build-arg",
|
||||||
|
action="append",
|
||||||
|
dest="build_args",
|
||||||
|
)
|
||||||
|
|
||||||
subparsers.add_parser('stop-container').add_argument(
|
subparsers.add_parser('stop-container').add_argument(
|
||||||
'container_name'
|
'container_name'
|
||||||
)
|
)
|
||||||
|
|
||||||
subparsers.add_parser('start-container').add_argument(
|
subparsers.add_parser('start-container').add_argument(
|
||||||
'container_name'
|
'container_name'
|
||||||
)
|
)
|
||||||
|
|
||||||
run_parser = subparsers.add_parser('run')
|
run_parser = subparsers.add_parser('run')
|
||||||
run_parser.add_argument('container_name')
|
run_parser.add_argument('container_name')
|
||||||
run_parser.add_argument('command')
|
run_parser.add_argument('command')
|
||||||
@@ -181,7 +190,7 @@ def main():
|
|||||||
elif args.action == 'stop-container':
|
elif args.action == 'stop-container':
|
||||||
stop_container(args.container_name)
|
stop_container(args.container_name)
|
||||||
elif args.action == 'build-image':
|
elif args.action == 'build-image':
|
||||||
build_systemd_image(image_name, 'integration-tests')
|
build_systemd_image(image_name, 'integration-tests', args.build_args)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
10
.github/workflows/integration-test.yaml
vendored
10
.github/workflows/integration-test.yaml
vendored
@@ -60,22 +60,22 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
matrix_include_pre_filter: |
|
matrix_include_pre_filter: |
|
||||||
- name: "Int. tests: Ubuntu 18.04, Py 3.6"
|
- name: "Int. tests: Ubuntu 18.04, Py 3.6"
|
||||||
runs_on: ubuntu-18.04
|
ubuntu_version: 18.04
|
||||||
python_version: 3.6
|
python_version: 3.6
|
||||||
extra_flags: ""
|
extra_flags: ""
|
||||||
- name: "Int. tests: Ubuntu 20.04, Py 3.9"
|
- name: "Int. tests: Ubuntu 20.04, Py 3.9"
|
||||||
runs_on: ubuntu-20.04
|
ubuntu_version: 20.04
|
||||||
python_version: 3.9
|
python_version: 3.9
|
||||||
extra_flags: ""
|
extra_flags: ""
|
||||||
- name: "Int. tests: Ubuntu 20.04, Py 3.9, --upgrade"
|
- name: "Int. tests: Ubuntu 20.04, Py 3.9, --upgrade"
|
||||||
runs_on: ubuntu-20.04
|
ubuntu_version: 20.04
|
||||||
python_version: 3.9
|
python_version: 3.9
|
||||||
extra_flags: --upgrade
|
extra_flags: --upgrade
|
||||||
dont_run_on_ref: refs/heads/master
|
dont_run_on_ref: refs/heads/master
|
||||||
|
|
||||||
integration-tests:
|
integration-tests:
|
||||||
needs: decide-on-test-jobs-to-run
|
needs: decide-on-test-jobs-to-run
|
||||||
runs-on: ${{ matrix.runs_on }}
|
runs-on: ubuntu-${{ matrix.ubuntu_version }}
|
||||||
|
|
||||||
name: ${{ matrix.name }}
|
name: ${{ matrix.name }}
|
||||||
strategy:
|
strategy:
|
||||||
@@ -95,7 +95,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Build systemd image
|
- name: Build systemd image
|
||||||
run: |
|
run: |
|
||||||
.github/integration-test.py build-image
|
.github/integration-test.py build-image --build-arg ubuntu_version=${{ matrix.ubuntu_version }}
|
||||||
|
|
||||||
- name: Run bootstrap checks
|
- name: Run bootstrap checks
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
# Systemd inside a Docker container, for CI only
|
# Systemd inside a Docker container, for CI only
|
||||||
FROM ubuntu:18.04
|
ARG ubuntu_version=20.04
|
||||||
|
FROM ubuntu:${ubuntu_version}
|
||||||
|
|
||||||
RUN apt-get update --yes
|
RUN apt-get update --yes
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user