diff --git a/.github/workflows/test-e2e-desktop.yaml b/.github/workflows/test-e2e-desktop.yaml new file mode 100644 index 000000000..14ec3c6d3 --- /dev/null +++ b/.github/workflows/test-e2e-desktop.yaml @@ -0,0 +1,110 @@ +name: Test E2E Desktop Client + +on: + pull_request: + types: [labeled, opened, synchronize, reopened] + workflow_dispatch: + +jobs: + test: + if: ${{ github.repository == 'hashicorp/boundary-ui' && contains(github.event.pull_request.labels.*.name, 'desktop')}} + name: Run Desktop E2E Tests + runs-on: ubuntu-22.04 + env: + ENOS_VAR_boundary_edition: "ent" + ENOS_VAR_e2e_debug_no_run: true + ENOS_VAR_boundary_license_path: "./license.hclic" + SETUP_CLI: true + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + fetch-depth: 0 + + - name: Set up Node + uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0 + with: + node-version: 20 + cache: "yarn" + cache-dependency-path: | + yarn.lock + ui/desktop/electron-app/yarn.lock + + - name: Set up Terraform + uses: hashicorp/setup-terraform@a1502cd9e758c50496cc9ac5308c4843bcd56d36 + + - name: Set up Enos + uses: hashicorp/action-setup-enos@b9fa53484a1e8fdcc7b02a118bcf01d65b9414c9 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + + - name: Install Vault CLI + run: | + wget https://releases.hashicorp.com/vault/1.12.2/vault_1.12.2_linux_amd64.zip -O /tmp/vault.zip + unzip /tmp/vault.zip -d /usr/local/bin + + - name: Checkout boundary-enterprise + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + with: + repository: hashicorp/boundary-enterprise + # ref: ${{ github.event.inputs.boundary-enterprise-branch }} + path: support/src/boundary-enterprise + token: ${{ secrets.ELEVATED_GITHUB_TOKEN }} + + - name: GH fix for localhost resolution + run: | + cat /etc/hosts && echo "-----------" + sudo sed -i 's/::1 *localhost ip6-localhost ip6-loopback/::1 ip6 -localhost ip6-loopback/g' /etc/hosts + cat /etc/hosts + ssh -V + + echo "127.0.0.1 localhost boundary" | sudo tee -a /etc/hosts + echo "127.0.0.1 localhost worker" | sudo tee -a /etc/hosts + echo "127.0.0.1 localhost vault" | sudo tee -a /etc/hosts + + # TODO: Build image ourselves in case we don't want to use latest? + - name: Get Boundary docker image + run: | + docker pull hashicorp/boundary-enterprise:latest + docker save hashicorp/boundary-enterprise:latest | gzip > /tmp/boundary-enterprise.zip + + # TODO: Set up license in a better way? Use directly rather than writing to file and pull from secrets manager + - name: Set up test infra + id: infra + run: | + echo "${{ secrets.BOUNDARY_ENT_LICENSE }}" > ./support/src/boundary-enterprise/enos/license.hclic + ssh-keygen -N '' -t ed25519 -f ~/.ssh/github_enos + mkdir -p ./enos/terraform-plugin-cache + export ENOS_VAR_enos_user=$GITHUB_ACTOR && \ + export ENOS_VAR_aws_ssh_private_key_path=~/.ssh/github_enos && \ + export ENOS_VAR_boundary_docker_image_name=hashicorp/boundary-enterprise:latest && \ + export ENOS_VAR_boundary_docker_image_file=/tmp/boundary-enterprise.zip && \ + enos scenario launch --timeout 60m0s --chdir ./support/src/boundary-enterprise/enos e2e_ui_docker_ent builder:crt + + - name: Install dependencies + run: | + yarn install --immutable + cd e2e-tests + yarn playwright install --with-deps + + # Runner is headless so we need to enable a display to run the client + - name: Run Tests + run: | + source <(bash ./support/src/boundary-enterprise/enos/scripts/test_e2e_env.sh) + cd e2e-tests + export DISPLAY=:99 + sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 & + yarn run desktop + + - name: Upload Playwright report + if: ${{ failure() }} + uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0 + with: + name: playwright-report + path: e2e-tests/playwright-report + + - name: Clean up test infra + if: ${{ always() }} + run: | + export ENOS_VAR_enos_user=$GITHUB_ACTOR && \ + export ENOS_VAR_aws_ssh_private_key_path=~/.ssh/github_enos && \ + enos scenario destroy --timeout 60m0s --chdir ./support/src/boundary-enterprise/enos e2e_ui_docker_ent builder:crt