remove enterprise check; remove monitor step; #4159
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
| # Copyright (c) HashiCorp, Inc. | ||
| # SPDX-License-Identifier: MPL-2.0 | ||
| name: frontend | ||
| on: | ||
| pull_request: | ||
| types: [opened, synchronize, reopened] | ||
| paths: | ||
| - 'ui/**' | ||
| workflow_dispatch: {} | ||
| permissions: | ||
| contents: read | ||
| jobs: | ||
| setup: | ||
| name: Setup | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| compute-small: ${{ steps.setup-outputs.outputs.compute-small }} | ||
| compute-medium: ${{ steps.setup-outputs.outputs.compute-medium }} | ||
| compute-large: ${{ steps.setup-outputs.outputs.compute-large }} | ||
| compute-xl: ${{ steps.setup-outputs.outputs.compute-xl }} | ||
| steps: | ||
| - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 | ||
| - id: setup-outputs | ||
| name: Setup outputs | ||
| run: ./.github/scripts/get_runner_classes.sh | ||
| e2e-tests: | ||
| needs: setup | ||
| runs-on: ${{ fromJSON(needs.setup.outputs.compute-medium) }} | ||
| continue-on-error: true | ||
| env: | ||
| CONSUL_NSPACES_ENABLED: 0 | ||
| steps: | ||
| - uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 | ||
| - name: Install PNPM | ||
| uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0 | ||
| with: | ||
| run_install: false | ||
| package_json_file: ui/package.json | ||
| - name: Setup node and pnpm cache | ||
| uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 | ||
| with: | ||
| node-version-file: "./ui/package.json" | ||
| cache: "pnpm" | ||
| cache-dependency-path: "ui/pnpm-lock.yaml" | ||
| - name: Install dependencies | ||
| working-directory: ui | ||
| run: make deps | ||
| - name: Checkout consul-ui-testing repo | ||
| uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 | ||
| with: | ||
| repository: hashicorp/consul-ui-testing | ||
| path: consul-ui-testing | ||
| token: ${{ secrets.ELEVATED_GITHUB_TOKEN }} | ||
| - name: Install consul-ui-testing dependencies | ||
| working-directory: consul-ui-testing | ||
| run: yarn install | ||
| - name: Install httpie (required by consul-ui-testing) | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y httpie | ||
| - name: Skip HashiCups build (use cached version marker) | ||
| working-directory: consul-ui-testing | ||
| run: echo "hashicorppreview/consul:latest" > .last_consul_version_built | ||
| - name: Start Consul API servers | ||
| working-directory: consul-ui-testing | ||
| run: | | ||
| echo "Starting Consul API servers at $(date '+%Y-%m-%d %H:%M:%S')" | ||
| yarn start hashicorppreview/consul:latest | ||
| - name: Start Consul UI | ||
| working-directory: ui/packages/consul-ui | ||
| run: | | ||
| pnpm run start:consul & | ||
| echo $! > consul-ui.pid | ||
| env: | ||
| CONSUL_HTTP_ADDR: http://localhost:8500 | ||
| - name: Wait for UI to be ready | ||
| run: npx wait-on http://localhost:4200 --timeout 60000 | ||
| - name: Run E2E health check | ||
| working-directory: ui/packages/consul-ui | ||
| run: pnpm run test:e2e:health | ||
| - name: Run basic E2E tests | ||
| working-directory: ui/packages/consul-ui | ||
| run: pnpm run test:e2e:basic | ||
| env: | ||
| CI: true | ||
| CONSUL_UI_TEST_TOKEN: ${{ secrets.CONSUL_UI_TEST_TOKEN }} | ||
| - name: Upload test results | ||
| if: always() | ||
| uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 | ||
| with: | ||
| name: e2e-test-results-ce | ||
| path: ui/packages/consul-ui/e2e-tests/reports/ | ||
| retention-days: 30 | ||
| - name: Upload screenshots on failure | ||
| if: failure() | ||
| uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 | ||
| with: | ||
| name: e2e-screenshots-ce | ||
| path: ui/packages/consul-ui/e2e-tests/reports/test-results/ | ||
| retention-days: 7 | ||
| # This is job is required for branch protection as a required gihub check | ||
| # because GitHub actions show up as checks at the job level and not the | ||
| # workflow level. This is currently a feature request: | ||
| # https://github.com/orgs/community/discussions/12395 | ||
| # | ||
| # This job must: | ||
| # - be placed after the fanout of a workflow so that everything fans back in | ||
| # to this job. | ||
| # - "need" any job that is part of the fan out / fan in | ||
| # - implement the if logic because we have conditional jobs | ||
| # (go-test-enteprise) that this job needs and this would potentially get | ||
| # skipped if a previous job got skipped. So we use the if clause to make | ||
| # sure it does not get skipped. | ||
| frontend-success: | ||
| needs: | ||
| - setup | ||
| - workspace-tests | ||
| - e2e-tests | ||
| runs-on: ${{ fromJSON(needs.setup.outputs.compute-small) }} | ||
| if: ${{ always() }} | ||
| steps: | ||
| - name: evaluate upstream job results | ||
| run: | | ||
| # exit 1 if failure or cancelled result for any upstream job | ||
| if printf '${{ toJSON(needs) }}' | grep -E -i '\"result\": \"(failure|cancelled)\"'; then | ||
| printf "Tests failed or workflow cancelled:\n\n${{ toJSON(needs) }}" | ||
| exit 1 | ||
| fi | ||