generated from UK-Export-Finance/nestjs-template
-
Notifications
You must be signed in to change notification settings - Fork 3
64 lines (54 loc) · 1.5 KB
/
test.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
# MDM-API Git Hub Actions
#####################################
# This GHA is responsible for initiating various test suites
# upon a PR creation. Following test suites are executed:
# 1. Unit tests (Jest)
# 2. API tests (Jest)
name: Quality Assurance - Tests
run-name: Executing test QA on ${{ github.repository }} 🚀
on:
pull_request:
branches: [main]
paths:
- "**"
env:
environment: "qa"
timezone: "Europe/London"
node: ${{ vars.NODE_VERSION }}
jobs:
# 1. Setup test infrastructure
setup:
name: Infrastructure setup 🔧
runs-on: ubuntu-latest
outputs:
environment: ${{ env.environment }}
timezone: ${{ env.timezone }}
steps:
- name: Environment 🧪
run: echo "Environment set to ${{ env.environment }}"
- name: Timezone 🌐
run: echo "Timezone set to ${{ env.timezone }}"
# 2. Unit tests
unit-tests:
name: Unit 👷
needs: setup
environment:
name: ${{ needs.setup.outputs.environment }}
runs-on: ubuntu-latest
steps:
- name: Timezone
uses: szenius/[email protected]
with:
timezoneLinux: ${{ needs.setup.outputs.timezone }}
- name: Repository
uses: actions/checkout@v4
- name: Node
uses: actions/setup-node@v4
with:
node-version: ${{ env.node }}
- name: Dependencies
working-directory: ./
run: npm ci --legacy-peer-deps
- name: Execute
working-directory: ./
run: npm run unit-test