Run e2e and deployment tests against aws #143
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: AWS Deployment | |
| env: | |
| TEST_USERNAME: "test-user" | |
| TEST_PASSWORD: "P@sswo3d" | |
| NEBARI_IMAGE_TAG: "main" | |
| AWS_DEFAULT_REGION: "us-west-2" | |
| on: | |
| pull_request: | |
| paths: | |
| - ".github/workflows/test_aws_integration.yaml" | |
| - "tests/**" | |
| - "scripts/**" | |
| - "src/**" | |
| - "pyproject.toml" | |
| - "pytest.ini" | |
| - ".cirun.yml" | |
| push: | |
| branches: | |
| - main | |
| - release/\d{4}.\d{1,2}.\d{1,2} | |
| paths: | |
| - ".github/workflows/test_aws_integration.yaml" | |
| - "tests/**" | |
| - "scripts/**" | |
| - "src/**" | |
| - "pyproject.toml" | |
| - "pytest.ini" | |
| - ".cirun.yml" | |
| schedule: | |
| - cron: "0 0 * * MON" | |
| workflow_dispatch: | |
| jobs: | |
| test-aws-integration: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| id-token: write | |
| contents: read | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Python | |
| uses: conda-incubator/setup-miniconda@v3 | |
| env: | |
| CONDA: /home/runnerx/miniconda3 | |
| with: | |
| auto-update-conda: true | |
| python-version: "3.11" | |
| miniconda-version: "latest" | |
| - name: Install kubectl | |
| uses: azure/setup-kubectl@v4 | |
| with: | |
| version: v1.19.16 | |
| - name: Install Nebari | |
| run: | | |
| pip install .[dev] | |
| playwright install | |
| - name: Authenticate to AWS | |
| uses: aws-actions/configure-aws-credentials@v1 | |
| with: | |
| role-to-assume: ${{ secrets.AWS_ROLE_ARN }} | |
| role-session-name: github-action | |
| aws-region: ${{ env.AWS_DEFAULT_REGION }} | |
| - name: Initialize Nebari config for aws deployment | |
| id: init | |
| uses: ./.github/actions/init-cloud | |
| with: | |
| cloud: aws | |
| - name: Deploy Nebari | |
| working-directory: ${{ steps.init.outputs.directory }} | |
| run: nebari deploy --config ${{ steps.init.outputs.config }} --disable-prompt | |
| env: | |
| CLOUDFLARE_TOKEN: ${{ secrets.CLOUDFLARE_TOKEN }} | |
| - name: Update kube config | |
| run: aws eks update-kubeconfig --name gha-cloud-test-dev --region ${{ env.AWS_DEFAULT_REGION }} | |
| - name: Health check | |
| uses: ./.github/actions/health-check | |
| with: | |
| domain: ${{ steps.init.outputs.domain }} | |
| - name: Create example-user | |
| working-directory: ${{ steps.init.outputs.directory }} | |
| run: | | |
| nebari keycloak adduser --user "${TEST_USERNAME}" "${TEST_PASSWORD}" --config ${{ steps.init.outputs.config }} | |
| nebari keycloak listusers --config ${{ steps.init.outputs.config }} | |
| - name: Await Workloads | |
| uses: jupyterhub/action-k8s-await-workloads@v3 | |
| with: | |
| workloads: "" # all | |
| namespace: "dev" | |
| timeout: 300 | |
| max-restarts: 3 | |
| ### DEPLOYMENT TESTS | |
| - name: Deployment Pytests | |
| env: | |
| NEBARI_CONFIG_PATH: ${{ steps.init.outputs.config }} | |
| KEYCLOAK_USERNAME: ${{ env.TEST_USERNAME }} | |
| KEYCLOAK_PASSWORD: ${{ env.TEST_PASSWORD }} | |
| NEBARI_HOSTNAME: ${{ steps.init.outputs.domain }} | |
| run: | | |
| pytest tests/tests_deployment/ -v -W ignore::DeprecationWarning -m "not requires_kubeconfig" | |
| ### USER-JOURNEY TESTS | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - name: Playwright Tests | |
| env: | |
| KEYCLOAK_USERNAME: ${{ env.TEST_USERNAME }} | |
| KEYCLOAK_PASSWORD: ${{ env.TEST_PASSWORD }} | |
| NEBARI_FULL_URL: "https://${{ steps.init.outputs.domain }}/" | |
| working-directory: tests/tests_e2e/playwright | |
| run: | | |
| # create environment file | |
| envsubst < .env.tpl > .env | |
| # run playwright pytest tests in headed mode with the chromium browser | |
| xvfb-run pytest --browser chromium --slowmo 300 --headed | |
| - name: Save Playwright recording artifacts | |
| if: always() | |
| uses: actions/upload-artifact@v4.3.1 | |
| with: | |
| name: e2e-playwright | |
| path: | | |
| ./tests/tests_e2e/playwright/videos/ | |
| ### CLEANUP AFTER TESTS | |
| - name: Cleanup nebari deployment | |
| if: always() | |
| run: | | |
| ls | |
| ls scripts | |
| python scripts/aws-force-destroy.py --config ${{ steps.init.outputs.config }} |