-
-
Notifications
You must be signed in to change notification settings - Fork 291
95 lines (77 loc) · 2.57 KB
/
Copy pathworkflow.yml
File metadata and controls
95 lines (77 loc) · 2.57 KB
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
87
88
89
90
91
92
93
# This is a basic workflow that is manually triggered
name: ci
# Controls when the action will run. Workflow runs when manually triggered using the UI
# or API.
on:
push:
branches: [main, development, 'refactor/unit_tests**', 'epic/**']
pull_request:
branches: [main, development, 'refactor/unit_tests**', 'epic/**']
types: [ready_for_review, opened, synchronize, reopened]
jobs:
run_gateway:
name: Check if gateway files changed
outputs:
is_set: ${{ steps.check_files.outputs.is_set }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.1
- uses: technote-space/get-diff-action@v6
with:
PATTERNS: |
**/*.+(ts|js|yml)
!Dockerfile
!*.sh
- name: Check if gateway files are modified
id: check_files
if: env.GIT_DIFF
run: |
echo ${{ env.GIT_DIFF }}
echo "is_set=true" >> $GITHUB_OUTPUT
build_gateway:
name: Gateway build + unit tests
needs: run_gateway
if: github.event.pull_request.draft == false && needs.run_gateway.outputs.is_set == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout commit
uses: actions/checkout@v4.1.1
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 10
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install Dependencies
run: pnpm install --no-frozen-lockfile
- name: Build project
run: pnpm build
- name: Setup configuration for CI
run: |
mkdir -p conf/
# Copy template configurations
cp -rf src/templates/* conf/
- name: Run unit test coverage
if: github.event_name == 'pull_request'
shell: bash
run: |
GATEWAY_TEST_MODE=dev NODE_OPTIONS=--trace-warnings pnpm test || {
echo "Tests failed with exit code $?"
cat $(find ./.jest-coverage -name "*.log" 2>/dev/null) 2>/dev/null || true
exit 1
}
# Docker build and push is handled by the separate docker_buildx_workflow.yml