2023-03-28 21:29:27 +00:00
|
|
|
# Copyright (c) HashiCorp, Inc.
|
|
|
|
# SPDX-License-Identifier: MPL-2.0
|
|
|
|
|
|
|
|
name: frontend
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
2023-10-04 20:15:12 +00:00
|
|
|
paths:
|
2023-03-28 21:29:27 +00:00
|
|
|
- ui/**
|
|
|
|
|
|
|
|
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:
|
2023-07-19 23:56:50 +00:00
|
|
|
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
|
2023-03-28 21:29:27 +00:00
|
|
|
- id: setup-outputs
|
|
|
|
name: Setup outputs
|
|
|
|
run: ./.github/scripts/get_runner_classes.sh
|
|
|
|
|
|
|
|
workspace-tests:
|
|
|
|
needs: setup
|
|
|
|
runs-on: ${{ fromJSON(needs.setup.outputs.compute-small) }}
|
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
working-directory: ui
|
|
|
|
steps:
|
2023-07-19 23:56:50 +00:00
|
|
|
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
|
2023-03-28 21:29:27 +00:00
|
|
|
|
2023-07-19 23:56:50 +00:00
|
|
|
- uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # v3.7.0
|
2023-03-28 21:29:27 +00:00
|
|
|
with:
|
2023-10-23 18:29:04 +00:00
|
|
|
node-version: '18'
|
2023-03-28 21:29:27 +00:00
|
|
|
|
2023-04-05 22:42:36 +00:00
|
|
|
- name: Install Yarn
|
2023-10-23 18:29:04 +00:00
|
|
|
run: corepack enable
|
2023-04-05 22:42:36 +00:00
|
|
|
|
2023-03-28 21:29:27 +00:00
|
|
|
# Install dependencies.
|
|
|
|
- name: install yarn packages
|
|
|
|
working-directory: ui
|
|
|
|
run: make deps
|
|
|
|
|
|
|
|
- run: make test-workspace
|
|
|
|
|
|
|
|
node-tests:
|
|
|
|
needs: setup
|
|
|
|
runs-on: ${{ fromJSON(needs.setup.outputs.compute-small) }}
|
|
|
|
steps:
|
2023-07-19 23:56:50 +00:00
|
|
|
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
|
2023-03-28 21:29:27 +00:00
|
|
|
|
2023-07-19 23:56:50 +00:00
|
|
|
- uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # v3.7.0
|
2023-03-28 21:29:27 +00:00
|
|
|
with:
|
2023-10-23 18:29:04 +00:00
|
|
|
node-version: '18'
|
2023-03-28 21:29:27 +00:00
|
|
|
|
2023-04-05 22:42:36 +00:00
|
|
|
- name: Install Yarn
|
2023-10-23 18:29:04 +00:00
|
|
|
run: corepack enable
|
2023-04-05 22:42:36 +00:00
|
|
|
|
2023-03-28 21:29:27 +00:00
|
|
|
# Install dependencies.
|
|
|
|
- name: install yarn packages
|
|
|
|
working-directory: ui
|
|
|
|
run: make deps
|
|
|
|
|
|
|
|
- run: make test-node
|
|
|
|
working-directory: ui/packages/consul-ui
|
|
|
|
|
|
|
|
ember-build-test:
|
|
|
|
needs: setup
|
2023-12-20 20:47:24 +00:00
|
|
|
if: ${{ !endsWith(github.repository, '-enterprise') }}
|
2023-08-31 14:56:59 +00:00
|
|
|
runs-on: ${{ fromJSON(needs.setup.outputs.compute-large ) }}
|
2023-04-12 04:48:09 +00:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
partition: [1, 2, 3, 4]
|
2023-03-28 21:29:27 +00:00
|
|
|
env:
|
2023-08-22 14:46:03 +00:00
|
|
|
EMBER_TEST_REPORT: test-results/report-ce.xml # outputs test report for CI test summary
|
2023-04-05 22:42:36 +00:00
|
|
|
EMBER_TEST_PARALLEL: true # enables test parallelization with ember-exam
|
2023-12-20 20:47:24 +00:00
|
|
|
CONSUL_NSPACES_ENABLED: 0 # NOTE: this should be 1 in ENT.
|
|
|
|
JOBS: 2 # limit parallelism for broccoli-babel-transpiler
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
|
|
|
|
|
|
|
|
- uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # v3.7.0
|
|
|
|
with:
|
|
|
|
node-version: '18'
|
|
|
|
|
|
|
|
- name: Install Yarn
|
|
|
|
run: corepack enable
|
|
|
|
|
|
|
|
- name: Install Chrome
|
|
|
|
uses: browser-actions/setup-chrome@c485fa3bab6be59dce18dbc18ef6ab7cbc8ff5f1 # v1.2.0
|
|
|
|
|
|
|
|
- name: Install dependencies
|
|
|
|
working-directory: ui
|
|
|
|
run: make deps
|
|
|
|
|
|
|
|
- name: Build CI
|
|
|
|
working-directory: ui/packages/consul-ui
|
|
|
|
run: make build-ci
|
|
|
|
|
|
|
|
- name: Ember exam
|
|
|
|
working-directory: ui/packages/consul-ui
|
|
|
|
run: node_modules/.bin/ember exam --split=4 --partition=${{ matrix.partition }} --path dist --silent -r xunit
|
|
|
|
|
|
|
|
- name: Test Coverage CI
|
|
|
|
working-directory: ui/packages/consul-ui
|
|
|
|
run: make test-coverage-ci
|
|
|
|
|
|
|
|
ember-build-test-ent:
|
|
|
|
needs: setup
|
|
|
|
runs-on: ${{ fromJSON(needs.setup.outputs.compute-large ) }}
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
partition: [1, 2, 3, 4]
|
|
|
|
env:
|
|
|
|
EMBER_TEST_REPORT: test-results/report-ce.xml # outputs test report for CI test summary
|
|
|
|
EMBER_TEST_PARALLEL: true # enables test parallelization with ember-exam
|
|
|
|
CONSUL_NSPACES_ENABLED: 1 # NOTE: this should be 1 in ENT.
|
2023-04-12 04:48:09 +00:00
|
|
|
JOBS: 2 # limit parallelism for broccoli-babel-transpiler
|
2023-03-28 21:29:27 +00:00
|
|
|
steps:
|
2023-07-19 23:56:50 +00:00
|
|
|
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
|
2023-03-28 21:29:27 +00:00
|
|
|
|
2023-07-19 23:56:50 +00:00
|
|
|
- uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # v3.7.0
|
2023-03-28 21:29:27 +00:00
|
|
|
with:
|
2023-10-23 18:29:04 +00:00
|
|
|
node-version: '18'
|
2023-03-28 21:29:27 +00:00
|
|
|
|
2023-04-05 22:42:36 +00:00
|
|
|
- name: Install Yarn
|
2023-10-23 18:29:04 +00:00
|
|
|
run: corepack enable
|
2023-04-05 22:42:36 +00:00
|
|
|
|
|
|
|
- name: Install Chrome
|
2023-06-13 17:00:55 +00:00
|
|
|
uses: browser-actions/setup-chrome@c485fa3bab6be59dce18dbc18ef6ab7cbc8ff5f1 # v1.2.0
|
2023-04-05 22:42:36 +00:00
|
|
|
|
2023-04-12 04:48:09 +00:00
|
|
|
- name: Install dependencies
|
2023-03-28 21:29:27 +00:00
|
|
|
working-directory: ui
|
|
|
|
run: make deps
|
|
|
|
|
2023-04-12 04:48:09 +00:00
|
|
|
- name: Build CI
|
|
|
|
working-directory: ui/packages/consul-ui
|
|
|
|
run: make build-ci
|
2023-03-28 21:29:27 +00:00
|
|
|
|
2023-04-12 04:48:09 +00:00
|
|
|
- name: Ember exam
|
|
|
|
working-directory: ui/packages/consul-ui
|
|
|
|
run: node_modules/.bin/ember exam --split=4 --partition=${{ matrix.partition }} --path dist --silent -r xunit
|
|
|
|
|
|
|
|
- name: Test Coverage CI
|
|
|
|
working-directory: ui/packages/consul-ui
|
2023-03-28 21:29:27 +00:00
|
|
|
run: make test-coverage-ci
|
2023-04-06 22:29:32 +00:00
|
|
|
# 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
|
|
|
|
- node-tests
|
|
|
|
- ember-build-test
|
|
|
|
runs-on: ${{ fromJSON(needs.setup.outputs.compute-small) }}
|
2023-04-25 20:17:48 +00:00
|
|
|
if: ${{ always() }}
|
2023-04-06 22:29:32 +00:00
|
|
|
steps:
|
2023-04-25 20:17:48 +00:00
|
|
|
- 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
|