-
Notifications
You must be signed in to change notification settings - Fork 2.5k
113 lines (98 loc) · 4.28 KB
/
validate-pull-request.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
name: Validate Pull Request
on: [pull_request]
concurrency:
group: ${{ github.ref }}-validate-pr-group
cancel-in-progress: true
jobs:
# Builds affected apps and runs unit tests
build_test:
name: Build and Test
runs-on: ubuntu-latest
environment: Testing
services:
redis:
image: redis:6-alpine
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6379:6379
postgres:
image: timescale/timescaledb:latest-pg14
env:
POSTGRES_USER: maybe
POSTGRES_PASSWORD: maybe
POSTGRES_DB: maybe_local
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set NX commit SHAs for affected commands
uses: nrwl/nx-set-shas@v2 # derive appropriate SHAs for base and head for `nx affected` commands
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: '18'
cache: 'yarn'
- name: Install node_modules
run: yarn install --frozen-lockfile
- name: Run unit tests
run: yarn nx affected --target=test --parallel=5 --testPathPattern='^(?!.*integration).*$'
- name: Build affected apps
run: yarn nx affected --target=build --parallel=5
- name: Setup env
run: |
cat << EOF > .env
NX_DATABASE_URL=${{ secrets.NX_DATABASE_URL }}
NX_DATABASE_SECRET=${{ secrets.NX_DATABASE_SECRET }}
NX_SESSION_SECRET=${{ secrets.NX_SESSION_SECRET }}
NEXTAUTH_SECRET=${{ secrets.NEXTAUTH_SECRET }}
NEXTAUTH_URL=http://localhost:4200
NX_NEXTAUTH_URL=http://localhost:4200
NX_PLAID_CLIENT_ID=${{ secrets.NX_PLAID_CLIENT_ID }}
NX_PLAID_SECRET=${{ secrets.NX_PLAID_SECRET }}
NX_PLAID_ENV=sandbox
NX_TELLER_SIGNING_SECRET=${{ secrets.NX_TELLER_SIGNING_SECRET }}
NEXT_PUBLIC_TELLER_APP_ID=${{ secrets.NEXT_PUBLIC_TELLER_APP_ID }}
NEXT_PUBLIC_TELLER_ENV=sandbox
NX_TELLER_ENV=sandbox
NX_EMAIL_PROVIDER=postmark
NX_EMAIL_PROVIDER_API_TOKEN=
NX_POLYGON_API_KEY=${{ secrets.NX_POLYGON_API_KEY }}
NX_POLYGON_TIER=${{ secrets.NX_POLYGON_TIER }}
NX_CORS_ORIGINS=http://localhost:4200
NX_API_URL=http://localhost:3333
NEXT_PUBLIC_API_URL=http://localhost:3333
NX_CLIENT_URL=http://localhost:4200
NX_REDIS_URL=redis://localhost:6379
EOF
- name: Run local DB migration for testing
run: yarn prisma:migrate:deploy
- name: Run integration tests
run: sudo yarn dev:ci:test --testPathPattern='^.*\.integration\.spec\.ts$'
- name: Start apps
run: yarn nx run-many --parallel --target=serve --projects=client,server,workers &
- name: Run end-to-end tests
if: "!contains(github.event.head_commit.message, 'skip-e2e')"
run: |
sudo yarn cypress install
yarn wait-on -t 120000 http://localhost:4200
sudo yarn dev:ci:e2e --configuration=ci --env.WEBHOOK_TYPE 'mock'
- name: Upload test artifacts
if: failure()
uses: actions/upload-artifact@v2
with:
name: cypress-artifacts
path: dist/cypress/apps/e2e