-
Notifications
You must be signed in to change notification settings - Fork 1
86 lines (85 loc) · 2.47 KB
/
pre-merge-checks.yml
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
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