From 94583fecfdb3100756238975e760657640b8dd3e Mon Sep 17 00:00:00 2001 From: Yuvi Panda Date: Sat, 3 Apr 2021 02:06:04 +0530 Subject: [PATCH] Revert "Revert "Switch integration and upgrade tests from CircleCI to GitHub actions"" --- .circleci/config.yml | 149 --------------------- {.circleci => .github}/integration-test.py | 2 +- .github/workflows/integration-test.yaml | 41 ++++++ .github/workflows/upgrade-test.yaml | 41 ++++++ 4 files changed, 83 insertions(+), 150 deletions(-) delete mode 100644 .circleci/config.yml rename {.circleci => .github}/integration-test.py (99%) create mode 100644 .github/workflows/integration-test.yaml create mode 100644 .github/workflows/upgrade-test.yaml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 48eafc8..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,149 +0,0 @@ -version: 2.1 - -commands: - build_systemd_image: - steps: - - run: - name: build systemd image - command: | - .circleci/integration-test.py build-image - - basic_tests: - parameters: - # Whether or not we should run update tests - upgrade: - type: string - default: "" - steps: - - run: - name: Run basic tests - command: | - if [ $CIRCLE_PR_USERNAME ]; then - BOOTSTRAP_PIP_SPEC=git+https://github.com/$CIRCLE_PR_USERNAME/the-littlest-jupyterhub.git@$CIRCLE_SHA1 - else - BOOTSTRAP_PIP_SPEC=git+https://github.com/$CIRCLE_PROJECT_USERNAME/the-littlest-jupyterhub.git@$CIRCLE_SHA1 - fi - - .circleci/integration-test.py run-test \ - --bootstrap-pip-spec "$BOOTSTRAP_PIP_SPEC" \ - basic-tests test_hub.py test_proxy.py \ - test_install.py test_extensions.py \ - << parameters.upgrade >> - - admin_tests: - parameters: - upgrade: - type: string - default: "" - steps: - - run: - name: Run admin tests - command: | - if [ $CIRCLE_PR_USERNAME ]; then - BOOTSTRAP_PIP_SPEC=git+https://github.com/$CIRCLE_PR_USERNAME/the-littlest-jupyterhub.git@$CIRCLE_SHA1 - else - BOOTSTRAP_PIP_SPEC=git+https://github.com/$CIRCLE_PROJECT_USERNAME/the-littlest-jupyterhub.git@$CIRCLE_SHA1 - fi - - .circleci/integration-test.py run-test \ - --installer-args "--admin admin:admin" \ - --bootstrap-pip-spec $BOOTSTRAP_PIP_SPEC \ - basic-tests test_admin_installer.py \ - << parameters.upgrade >> - - plugin_tests: - parameters: - upgrade: - type: string - default: "" - steps: - - run: - name: Run plugin tests - command: | - if [ $CIRCLE_PR_USERNAME ]; then - BOOTSTRAP_PIP_SPEC=git+https://github.com/$CIRCLE_PR_USERNAME/the-littlest-jupyterhub.git@$CIRCLE_SHA1 - else - BOOTSTRAP_PIP_SPEC=git+https://github.com/$CIRCLE_PROJECT_USERNAME/the-littlest-jupyterhub.git@$CIRCLE_SHA1 - fi - - .circleci/integration-test.py run-test \ - --bootstrap-pip-spec $BOOTSTRAP_PIP_SPEC \ - --installer-args "--plugin /srv/src/integration-tests/plugins/simplest" \ - plugins test_simplest_plugin.py \ - << parameters.upgrade >> - - bootstrap_checks: - parameters: - steps: - - run: - name: Run bootstrap checks - command: | - py.test integration-tests/test_bootstrap.py -s - - -jobs: - integration-test: - docker: - - image: docker:18.05.0-ce-git - - steps: - - run: - name: setup python3 - command: | - apk add --no-cache python3 pytest - - - checkout - - - setup_remote_docker - - - build_systemd_image - - - bootstrap_checks - - - basic_tests - - - admin_tests - - - plugin_tests - - upgrade-test: - docker: - - image: docker:18.05.0-ce-git - - steps: - - run: - name: Check upgrade testing - command: | - if [ "$CIRCLE_BRANCH" == "master" ]; then - echo "On master, no upgrade to test..." - circleci-agent step halt - else - echo "PR detected, testing upgrade..." - fi - - - run: - name: setup python3 - command: | - apk add --no-cache python3 pytest - - - checkout - - - setup_remote_docker - - - build_systemd_image - - - basic_tests: - upgrade: "--upgrade" - - - admin_tests: - upgrade: "--upgrade" - - - plugin_tests: - upgrade: "--upgrade" - -workflows: - version: 2 - all-tests: - jobs: - - integration-test - - upgrade-test diff --git a/.circleci/integration-test.py b/.github/integration-test.py similarity index 99% rename from .circleci/integration-test.py rename to .github/integration-test.py index 8ed8330..3fdf06f 100755 --- a/.circleci/integration-test.py +++ b/.github/integration-test.py @@ -66,7 +66,7 @@ def run_container_command(container_name, cmd): """ proc = subprocess.run([ 'docker', 'exec', - '-it', container_name, + '-t', container_name, '/bin/bash', '-c', cmd ], check=True) diff --git a/.github/workflows/integration-test.yaml b/.github/workflows/integration-test.yaml new file mode 100644 index 0000000..0261967 --- /dev/null +++ b/.github/workflows/integration-test.yaml @@ -0,0 +1,41 @@ +on: + pull_request: + push: + workflow_dispatch: + +jobs: + integration-test: + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + with: + python-version: 3.6 + - name: Set BOOTSTRAP_PIP_SPEC value + run: | + echo "BOOTSTRAP_PIP_SPEC=git+https://github.com/$GITHUB_ACTOR/the-littlest-jupyterhub.git@$GITHUB_SHA" >> $GITHUB_ENV + - name: Build systemd image + run: | + .github/integration-test.py build-image + - name: Run bootstrap checks + run: | + python3 -m pip install pytest + pytest integration-tests/test_bootstrap.py -s + - name: Run basic tests + run: | + .github/integration-test.py run-test \ + --bootstrap-pip-spec "$BOOTSTRAP_PIP_SPEC" \ + basic-tests test_hub.py test_proxy.py \ + test_install.py test_extensions.py + - name: Run admin tests + run: | + .github/integration-test.py run-test \ + --installer-args "--admin admin:admin" \ + --bootstrap-pip-spec "$BOOTSTRAP_PIP_SPEC" \ + basic-tests test_admin_installer.py \ + - name: Run plugin tests + run: | + .github/integration-test.py run-test \ + --bootstrap-pip-spec "$BOOTSTRAP_PIP_SPEC" \ + --installer-args "--plugin /srv/src/integration-tests/plugins/simplest" \ + plugins test_simplest_plugin.py \ diff --git a/.github/workflows/upgrade-test.yaml b/.github/workflows/upgrade-test.yaml new file mode 100644 index 0000000..dba6ef5 --- /dev/null +++ b/.github/workflows/upgrade-test.yaml @@ -0,0 +1,41 @@ +on: + pull_request: + push: + workflow_dispatch: + +jobs: + upgrade-test: + if: ${{ github.ref != 'refs/heads/master' }} + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + with: + python-version: 3.6 + - name: Set BOOTSTRAP_PIP_SPEC value + run: | + echo "BOOTSTRAP_PIP_SPEC=git+https://github.com/$GITHUB_ACTOR/the-littlest-jupyterhub.git@$GITHUB_SHA" >> $GITHUB_ENV + - name: Build systemd image + run: | + .github/integration-test.py build-image + - name: Run basic tests + run: | + .github/integration-test.py run-test \ + --bootstrap-pip-spec "$BOOTSTRAP_PIP_SPEC" \ + basic-tests test_hub.py test_proxy.py \ + test_install.py test_extensions.py \ + --upgrade + - name: Run admin tests + run: | + .github/integration-test.py run-test \ + --installer-args "--admin admin:admin" \ + --bootstrap-pip-spec "$BOOTSTRAP_PIP_SPEC" \ + basic-tests test_admin_installer.py \ + --upgrade + - name: Run plugin tests + run: | + .github/integration-test.py run-test \ + --bootstrap-pip-spec "$BOOTSTRAP_PIP_SPEC" \ + --installer-args "--plugin /srv/src/integration-tests/plugins/simplest" \ + plugins test_simplest_plugin.py \ + --upgrade