-
Notifications
You must be signed in to change notification settings - Fork 4
79 lines (75 loc) · 2.5 KB
/
ci.yml
File metadata and controls
79 lines (75 loc) · 2.5 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
name: Lint, Test & Upload Coverage
on:
push:
branches:
- main
paths:
- 'packages/**'
pull_request:
paths:
- 'packages/**'
# This allows a subsequently queued workflow run to interrupt previous runs
concurrency:
group: "${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}"
cancel-in-progress: true
jobs:
setup-node_modules:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v2.4.0
- uses: actions/setup-node@v3
with:
node-version: 20
cache: "pnpm"
- uses: "nick-fields/retry@v2.8.3"
with:
max_attempts: 10
timeout_minutes: 15
retry_on: error
command: pnpm fetch --ignore-scripts
ci-api-gateway:
needs: setup-node_modules
runs-on: ${{ matrix.os }}
timeout-minutes: 15
strategy:
matrix:
node-version: [18, 20]
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v2.4.0
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "pnpm"
- name: Start postgresql containers for testing
run: docker-compose up -d postgresql
# For testing we use this recaptcha key https://developers.google.com/recaptcha/docs/faq#id-like-to-run-automated-tests-with-recaptcha.-what-should-i-do
- name: Create env file
run: |
cd packages/api-gateway && touch .env
echo RECAPTCHA_PRIVATE_KEY="6LeIxAcTAAAAAGG-vFI1TnRWxMZNFuojJ4WifJWe" >> .env
echo EMAIL_FROM="no-reply <email@somesite.com>" >> .env
echo FRONTEND_BASE_URL="http://127.0.0.1:3000" >> .env
echo ENCRYPTION_KEY="change-me-encryption-secret-32-c" >> .env
cat .env
- name: Install dependencies
uses: nick-fields/retry@v2.8.3
with:
max_attempts: 10
timeout_minutes: 15
retry_on: error
command: pnpm install --frozen-lockfile
- name: Run linter
run: cd packages/api-gateway && pnpm lint
- name: Run test suite
run: cd packages/api-gateway && pnpm test:ci
- name: Upload coverage reports to Codecov
if: ${{ matrix.node-version == 20 }}
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./packages/api-gateway/coverage/lcov.info
fail_ci_if_error: true