-
Notifications
You must be signed in to change notification settings - Fork 4.6k
150 lines (128 loc) · 4.92 KB
/
frontend.yml
File metadata and controls
150 lines (128 loc) · 4.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# 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