PYIC-7329: Refactor core-front tests #3946
Workflow file for this run
This file contains 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
name: Pre-merge checks | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
types: | |
- opened | |
- reopened | |
- ready_for_review | |
- synchronize | |
jobs: | |
pre-commit: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11.2' | |
- uses: pre-commit/[email protected] | |
with: | |
extra_args: "detect-secrets --all-files" | |
run-tests: | |
runs-on: ubuntu-latest | |
permissions: | |
packages: read | |
timeout-minutes: 15 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js 20.x | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20.11.1 | |
- name: Setup .npmrc | |
run: | | |
cp .npmrc.template .npmrc && \ | |
sed -i s/TOKEN_WITH_READ_PACKAGE_PERMISSION/${{ secrets.GITHUB_TOKEN }}/ .npmrc | |
- name: Login to GDS Dev Dynatrace Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: khw46367.live.dynatrace.com | |
username: khw46367 | |
password: ${{ secrets.DYNATRACE_PAAS_TOKEN }} | |
- name: Install dependencies | |
run: npm install | |
- name: Run lint | |
run: npm run lint | |
- name: Run test and write coverage | |
run: npm run test:coverage | |
- name: Run sonarcloud scan | |
if: ${{ github.actor != 'dependabot[bot]' }} | |
uses: sonarsource/sonarcloud-github-action@master | |
env: | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} # obtained from https://sonarcloud.io | |
- name: Build docker image | |
run: | | |
cd ${GITHUB_WORKSPACE} || exit 1 | |
docker build -t "core-front-build:test" . | |
browser-tests: | |
name: Run browser tests | |
runs-on: ubuntu-latest | |
permissions: | |
packages: read | |
defaults: | |
run: | |
shell: bash | |
working-directory: browser-tests | |
steps: | |
- name: Pull repository | |
uses: actions/checkout@v4 | |
- name: Setup .npmrc | |
run: | | |
cp ../.npmrc.template ../.npmrc && \ | |
sed -i s/TOKEN_WITH_READ_PACKAGE_PERMISSION/${{ secrets.GITHUB_TOKEN }}/ ../.npmrc | |
- name: Run browser tests | |
run: docker compose up --exit-code-from browser-tests-tests | |
- name: Upload test artifacts | |
if: ${{ failure() }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: browser-test-results | |
path: ./browser-tests/test-results/ | |
- name: Stop Docker | |
if: ${{ always() }} | |
run: docker compose down |