-
-
Notifications
You must be signed in to change notification settings - Fork 20
149 lines (129 loc) · 4.49 KB
/
ci.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
name: CI
on:
push:
branches:
- main
pull_request:
env:
CONTENTFUL_HOST: cdn.contentful.com
CONTENTFUL_SPACE: wuv9tl5d77ll
CONTENTFUL_TOKEN: ${{ secrets.CONTENTFUL_TOKEN }}
NX_CLOUD_DISTRIBUTED_EXECUTION: false
NX_AMPLITUDE_KEY: ${{ secrets.NX_AMPLITUDE_KEY }}
NX_AUTH_AUDIENCE: http://getjetstream.app/app_metadata
NX_ROLLBAR_KEY: ${{ secrets.NX_ROLLBAR_KEY }}
jobs:
# Build application
build:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v3
name: Checkout [master]
with:
fetch-depth: 0
- name: Setup branch tracking
if: success() && github.ref != 'refs/heads/main'
run: git branch --track main origin/main
- name: Derive appropriate SHAs for base and head for `nx affected` commands
uses: nrwl/nx-set-shas@v3
- uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'yarn'
- name: install dependencies
run: yarn install --frozen-lockfile
- name: Build application
env:
NODE_OPTIONS: '--max_old_space_size=4096'
run: npx nx run-many --target=build --parallel=3 --projects=jetstream,api,download-zip-sw,landing --configuration=production
- name: Uploading artifacts
uses: actions/upload-artifact@v3
with:
name: dist-artifacts
path: dist
# e2e tests only runs if build passes, since it uses production build to run tests
e2e:
needs: build
runs-on: ubuntu-latest
env:
AUTH0_CLIENT_ID: 'shxza1G0595Ut2htmAd3NfbMMsqelrE5'
AUTH0_CLIENT_SECRET: 'NOT-NEEDED'
AUTH0_DOMAIN: 'getjetstream-dev.us.auth0.com'
E2E_LOGIN_PASSWORD: ${{ secrets.E2E_LOGIN_PASSWORD }}
E2E_LOGIN_URL: 'https://jetstream-e2e-dev-ed.develop.my.salesforce.com'
E2E_LOGIN_USERNAME: '[email protected]'
EXAMPLE_USER_OVERRIDE: true
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }}
GOOGLE_APP_ID: ${{ secrets.GOOGLE_APP_ID }}
GOOGLE_CLIENT_ID: ${{ secrets.GOOGLE_CLIENT_ID }}
GOOGLE_CLIENT_SECRET: ${{ secrets.GOOGLE_CLIENT_SECRET }}
JETSTREAM_POSTGRES_DBURI: postgres://postgres:postgres@localhost:5432/postgres
JETSTREAM_SESSION_SECRET: ${{ secrets.JETSTREAM_SESSION_SECRET }}
JETSTREAM_CLIENT_URL: http://localhost:3333/app
JETSTREAM_SERVER_DOMAIN: localhost:3333
JETSTREAM_SERVER_URL: http://localhost:3333
NX_AMPLITUDE_KEY: ${{ secrets.NX_AMPLITUDE_KEY }}
NX_AUTH_AUDIENCE: http://getjetstream.app/app_metadata
NX_CLOUD_DISTRIBUTED_EXECUTION: false
NX_ROLLBAR_KEY: ${{ secrets.NX_ROLLBAR_KEY }}
SFDC_CALLBACK_URL: http://localhost:3333/oauth/sfdc/callback
SFDC_CONSUMER_KEY: ${{ secrets.SFDC_CONSUMER_KEY }}
SFDC_CONSUMER_SECRET: ${{ secrets.SFDC_CONSUMER_SECRET }}
SFDC_ENC_KEY: ${{ secrets.SFDC_ENC_KEY }}
SFDC_API_VERSION: '58.0'
services:
postgres:
image: postgres
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- uses: actions/checkout@v3
name: Checkout [master]
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'yarn'
- name: install dependencies
run: yarn install --frozen-lockfile
- name: Download artifacts from build
uses: actions/download-artifact@v3
with:
name: dist-artifacts
path: dist
- name: Install Playwright dependencies
run: npx playwright install --with-deps
- name: Generate database
run: yarn db:generate
- name: Run database migration
run: yarn db:migrate
- name: Seed DB
run: yarn db:seed
env:
POSTGRES_HOST: localhost
PGHOST: localhost
PGPORT: 5432
PGUSER: postgres
PGPASSWORD: postgres
PGDATABASE: postgres
- name: Run E2E tests
run: yarn playwright:test:with-server
- name: Upload test results
if: always() # This ensures step will always run even if prior steps fail
uses: actions/upload-artifact@v3
with:
name: playwright-report
path: |
apps/jetstream-e2e/playwright-report
test-results