Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 33 additions & 3 deletions .github/workflows/test_ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
- ".github/workflows/test_ui.yml"

jobs:
test:
checks:
runs-on: artemis-ui-test-runner-4
env:
UI_PATH: ./ui
Expand All @@ -22,6 +22,8 @@
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # actions/[email protected]
with:
node-version-file: "${{ env.UI_PATH }}/.nvmrc"
cache: npm
cache-dependency-path: "${{ env.UI_PATH }}/package-lock.json"

- uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # hashicorp/[email protected]

Expand All @@ -36,10 +38,38 @@
working-directory: ${{ env.UI_PATH }}

- name: Run precommit checks (linting & testing etc)
run: make -C $UI_PATH precommit
run: make -C $UI_PATH lint check audit

tests:
runs-on: artemis-ui-test-runner-4
strategy:
matrix:
shard: [1, 2, 3, 4]
env:
UI_PATH: ./ui
NPM_VERSION: 10
steps:
- name: Checkout the code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # actions/[email protected]

- name: Setup node from node version file
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # actions/[email protected]
with:
node-version-file: "${{ env.UI_PATH }}/.nvmrc"
cache: npm
cache-dependency-path: "${{ env.UI_PATH }}/package-lock.json"

- name: Set up the npm version
run: npm install --global npm@$NPM_VERSION

- name: Install npm packages
run: make -C $UI_PATH install

- name: Run tests
run: make -C $UI_PATH test JESTFLAGS="--shard=${{ matrix.shard }}/${{ strategy.job-total }}"

- name: Save test results
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # actions/[email protected]
with:
name: ui-test
name: ui-test-${{ matrix.shard }}
path: ui/test-report/index.html

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium test

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
4 changes: 3 additions & 1 deletion ui/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ ifeq ($(HADOLINT),)
HADOLINT := ${CURDIR}/hadolint
endif
TERRAFORM = terraform
# Additional Jest options.
JESTFLAGS =

APP := artemis-ui
PORT := 3000
Expand Down Expand Up @@ -212,7 +214,7 @@ audit: package.json package-lock.json ## Audit package dependencies for vulnera
.PHONY: test
test: ## Run tests
@echo "${INFO}Running tests"
CI=true $(NPM) test -- --env=jsdom --coverage --silent
CI=true $(NPM) test -- --env=jsdom --coverage --silent $(JESTFLAGS)
@echo "${OK}"

# run coding standards check
Expand Down