-
Notifications
You must be signed in to change notification settings - Fork 21
117 lines (112 loc) · 4.29 KB
/
ci.yaml
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
name: Continuous Integration
on:
pull_request: {}
push:
branches:
- main
paths-ignore:
- "docs/**"
jobs:
test-e2e-integration:
name: "Cypress Integration Tests"
runs-on: ubuntu-latest
services:
postgres:
image: "postgres:13"
env:
POSTGRES_DB: usdr_grants_test
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
ports:
- 5432:5432
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v2
- name: Install Node.js
uses: actions/setup-node@v2
with:
node-version: 16.14.0
cache: yarn
- name: Install dependencies
run: yarn setup
- name: Run migrations
env:
POSTGRES_TEST_URL: "postgresql://postgres:password@localhost:${{ job.services.postgres.ports[5432] }}/usdr_grants_test"
# This is intentional to set POSTGRES_URL=POSTGRES_TEST_URL; ARPA Reporter test runner gates
# dev vs. CI differences based on whether these are the same.
POSTGRES_URL: "postgresql://postgres:password@localhost:${{ job.services.postgres.ports[5432] }}/usdr_grants_test"
run: yarn db:migrate
- name: Start Applications
env:
POSTGRES_TEST_URL: "postgresql://postgres:password@localhost:${{ job.services.postgres.ports[5432] }}/usdr_grants_test"
# This is intentional to set POSTGRES_URL=POSTGRES_TEST_URL; ARPA Reporter test runner gates
# dev vs. CI differences based on whether these are the same.
POSTGRES_URL: "postgresql://postgres:password@localhost:${{ job.services.postgres.ports[5432] }}/usdr_grants_test"
AWS_ACCESS_KEY_ID: "Fake AWS Key"
AWS_SECRET_ACCESS_KEY: "Fake AWS Secret"
NOTIFICATIONS_EMAIL: [email protected]
DATA_DIR: './data'
run: yarn serve &
- name: Run e2e tests
uses: cypress-io/github-action@v5
env:
CYPRESS_BASE_URL: 'http://localhost:8080'
with:
publish-summary: true
working-directory: packages/e2e
test-server-client:
name: "Server and Client Unit Tests"
runs-on: ubuntu-latest
services:
postgres:
image: "postgres:13"
env:
POSTGRES_DB: usdr_grants_test
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
ports:
- 5432:5432
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v2
- name: Install Node.js
uses: actions/setup-node@v2
with:
node-version: 16.14.0
cache: yarn
- name: Install dependencies
run: yarn setup
- name: Run Linter
run: yarn lint
- name: Run unit tests
env:
POSTGRES_TEST_URL: "postgresql://postgres:password@localhost:${{ job.services.postgres.ports[5432] }}/usdr_grants_test"
# This is intentional to set POSTGRES_URL=POSTGRES_TEST_URL; ARPA Reporter test runner gates
# dev vs. CI differences based on whether these are the same.
POSTGRES_URL: "postgresql://postgres:password@localhost:${{ job.services.postgres.ports[5432] }}/usdr_grants_test"
AWS_ACCESS_KEY_ID: "Fake AWS Key"
AWS_SECRET_ACCESS_KEY: "Fake AWS Secret"
NOTIFICATIONS_EMAIL: [email protected]
run: |
# The .env file needs to be present; the example file is good enough.
cp packages/server/.env.example packages/server/.env
cp packages/client/.env.example packages/client/.env
cp packages/e2e/.env.example packages/e2e/.env
export CI=true; yarn coverage
- name: Publish coverage report to CodeClimate
uses: paambaati/[email protected]
env:
CC_TEST_REPORTER_ID: c0ab87c312e9ca57ec34d55ebec07ed396f96f039b3c725221918a75be71a0eb
with:
coverageLocations: |
${{github.workspace}}/coverage/lcov.info:lcov