-
Notifications
You must be signed in to change notification settings - Fork 12
151 lines (151 loc) · 5.41 KB
/
main.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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
name: Main
on:
push:
branches: [main, feature/*]
pull_request:
branches: [main, feature/*]
merge_group:
branches: [main]
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20]
services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Fetch other branches
if: ${{ github.event_name == 'pull_request' }}
run: git fetch --no-tags --prune --depth=5 origin $GITHUB_BASE_REF
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Cache Node Modules
id: cache-node-modules
uses: actions/cache@v4
with:
path: node_modules
key: node-modules-${{ matrix.node-version }}-${{ hashFiles('package-lock.json') }}
restore-keys: node-modules-${{ matrix.node-version }}-
- name: NPM Install
run: npm install --silent
- name: generate prisma imports
uses: mansagroup/nrwl-nx-action@v3
with:
targets: prisma-generate
all: true
parallel: 1
env:
DISABLE_ERD: true
- name: Install Doppler
run: |
sudo apt-get update && sudo apt-get install -y apt-transport-https ca-certificates curl gnupg
curl -sLf --retry 3 --tlsv1.2 --proto "=https" 'https://packages.doppler.com/public/cli/gpg.DE2A7741A397C129.key' | sudo apt-key add -
echo "deb https://packages.doppler.com/public/cli/deb/debian any-version main" | sudo tee /etc/apt/sources.list.d/doppler-cli.list
sudo apt-get update && sudo apt-get -y install doppler
- name: fetch-secrets and build
uses: mansagroup/nrwl-nx-action@v3
env:
DOPPLER_API_ANALYTICS_TOKEN: ${{ secrets.DOPPLER_API_ANALYTICS_TOKEN }}
DOPPLER_API_GATEWAY_TOKEN: ${{ secrets.DOPPLER_API_GATEWAY_TOKEN }}
DOPPLER_API_JOURNEYS_TOKEN: ${{ secrets.DOPPLER_API_JOURNEYS_TOKEN }}
DOPPLER_API_LANGUAGES_TOKEN: ${{ secrets.DOPPLER_API_LANGUAGES_TOKEN }}
DOPPLER_API_USERS_TOKEN: ${{ secrets.DOPPLER_API_USERS_TOKEN }}
DOPPLER_API_MEDIA_TOKEN: ${{ secrets.DOPPLER_API_MEDIA_TOKEN }}
DOPPLER_ARCLIGHT_TOKEN: ${{ secrets.DOPPLER_ARCLIGHT_TOKEN }}
DOPPLER_DOCS_TOKEN: ${{ secrets.DOPPLER_DOCS_TOKEN }}
DOPPLER_JOURNEYS_TOKEN: ${{ secrets.DOPPLER_JOURNEYS_TOKEN }}
DOPPLER_JOURNEYS_ADMIN_TOKEN: ${{ secrets.DOPPLER_JOURNEYS_ADMIN_TOKEN }}
DOPPLER_SHORT_LINKS_TOKEN: ${{ secrets.DOPPLER_SHORT_LINKS_TOKEN }}
DOPPLER_WATCH_TOKEN: ${{ secrets.DOPPLER_WATCH_TOKEN }}
DOPPLER_WATCH_ADMIN_TOKEN: ${{ secrets.DOPPLER_WATCH_ADMIN_TOKEN }}
DOPPLER_VIDEOS_ADMIN_TOKEN: ${{ secrets.DOPPLER_VIDEOS_ADMIN_TOKEN }}
DOPPLER_GITHUB_SERVICE_TOKEN: ${{ secrets.DOPPLER_GITHUB_SERVICE_TOKEN }}
DOPPLER_CONFIG: stg
with:
targets: fetch-secrets,build
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version: [20]
# https://jestjs.io/docs/cli#--shard
shard: ['1/3', '2/3', '3/3']
services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Fetch other branches
if: ${{ github.event_name == 'pull_request' }}
run: git fetch --no-tags --prune --depth=5 origin $GITHUB_BASE_REF
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Cache Node Modules
id: cache-node-modules
uses: actions/cache@v4
with:
path: node_modules
key: node-modules-${{ matrix.node-version }}-${{ hashFiles('package-lock.json') }}
restore-keys: node-modules-${{ matrix.node-version }}-
- name: NPM Install
run: npm install --silent
- name: generate prisma imports
uses: mansagroup/nrwl-nx-action@v3
with:
targets: prisma-generate
all: true
parallel: 1
env:
DISABLE_ERD: true
- name: Get number of CPU cores
id: cpu-cores
uses: SimenB/github-actions-cpu-cores@v2
- name: run tests
uses: mansagroup/nrwl-nx-action@v3
with:
targets: test
args: --ci --silent --max-workers ${{ steps.cpu-cores.outputs.count }} --shard=${{ matrix.shard }}
parallel: 1
- name: download codecov
run: |
curl -o /usr/local/bin/codecov https://uploader.codecov.io/latest/linux/codecov
chmod +x /usr/local/bin/codecov
- name: upload coverage to codecov
uses: mansagroup/nrwl-nx-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
targets: codecov