-
Notifications
You must be signed in to change notification settings - Fork 80
86 lines (83 loc) · 4.04 KB
/
node-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
name: Node.js CI
on:
workflow_call:
inputs:
e2e:
required: true
type: boolean
jobs:
test-build-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# install python 3.x in order to have mkdocs properly installed
- uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install mkdocs
run: |
pip install Jinja2==3.0.3 mkdocs
mkdocs --version
- name: Use Node.js 14.x
uses: actions/setup-node@v1
with:
node-version: 14.x
- name: Install npm/yarn packages using cache
uses: bahmutov/npm-install@v1
- name: Lint code
run: yarn lint
- name: Lint messages
run: yarn lint-messages
- name: Run flow check
run: yarn flow
- name: Run tests
run: yarn test-client
- name: Build with minification
run: yarn run build -- --minify
- name: Build docs
run: mkdocs build
- name: Whether e2e should run
run: echo Running e2e - {{ inputs.e2e }}
- name: Write .env file for Docker
if: inputs.e2e
run: |
touch __tests__/e2e/.env
echo BUGSNAG_KEY= ${{ secrets.BUGSNAG_KEY }} >> __tests__/e2e/.env
echo AUTH0_API_CLIENT= ${{ secrets.AUTH0_API_CLIENT }} >> __tests__/e2e/.env
echo AUTH0_API_SECRET= ${{ secrets.AUTH0_API_SECRET }} >> __tests__/e2e/.env
echo AUTH0_CLIENT_ID= ${{ secrets.AUTH0_CLIENT_ID }} >> __tests__/e2e/.env
echo AUTH0_PUBLIC_KEY=/datatools/datatools.pem >> __tests__/e2e/.env
echo AUTH0_CONNECTION_NAME= ${{ secrets.AUTH0_CONNECTION_NAME }} >> __tests__/e2e/.env
echo AUTH0_DOMAIN= ${{ secrets.AUTH0_DOMAIN }} >> __tests__/e2e/.env
echo AWS_ACCESS_KEY_ID= ${{ secrets.AWS_ACCESS_KEY_ID }} >> __tests__/e2e/.env
echo AWS_REGION=us-east-1 >> __tests__/e2e/.env
echo AWS_SECRET_ACCESS_KEY= ${{ secrets.AWS_SECRET_ACCESS_KEY }} >> __tests__/e2e/.env
echo GITHUB_REF_SLUG= $GITHUB_REF >> __tests__/e2e/.env
echo GITHUB_SHA= $GITHUB_SHA >> __tests__/e2e/.env
echo E2E_AUTH0_PASSWORD= ${{ secrets.E2E_AUTH0_PASSWORD }} >> __tests__/e2e/.env
echo E2E_AUTH0_USERNAME= ${{ secrets.E2E_AUTH0_USERNAME }} >> __tests__/e2e/.env
echo GRAPH_HOPPER_KEY= ${{ secrets.GRAPH_HOPPER_KEY }} >> __tests__/e2e/.env
echo LOGS_S3_BUCKET= ${{ secrets.LOGS_S3_BUCKET }} >> __tests__/e2e/.env
echo MAPBOX_ACCESS_TOKEN= ${{ secrets.MAPBOX_ACCESS_TOKEN }} >> __tests__/e2e/.env
echo MS_TEAMS_WEBHOOK_URL= ${{ secrets.MS_TEAMS_WEBHOOK_URL }} >> __tests__/e2e/.env
echo OSM_VEX= ${{ secrets.OSM_VEX }} >> __tests__/e2e/.env
echo RUN_E2E= "true" >> __tests__/e2e/.env
echo S3_BUCKET= ${{ secrets.S3_BUCKET }} >> __tests__/e2e/.env
echo SPARKPOST_EMAIL= ${{ secrets.SPARKPOST_EMAIL }} >> __tests__/e2e/.env
echo SPARKPOST_KEY= ${{ secrets.SPARKPOST_KEY }} >> __tests__/e2e/.env
echo TRANSITFEEDS_KEY= ${{ secrets.TRANSITFEEDS_KEY }} >> __tests__/e2e/.env
touch __tests__/e2e/server/datatools.pem
echo ${{ secrets.AUTH0_DATATOOLS_PEM }} | base64 --decode > __tests__/e2e/server/datatools.pem
- name: Run e2e tests
if: inputs.e2e
run: |
(echo "E2E Test Attempt 1" && docker compose --env-file __tests__/e2e/.env -f __tests__/e2e/docker-compose.yml up --abort-on-container-exit) || \
(echo "E2E Test Attempt 2" && docker compose --env-file __tests__/e2e/.env -f __tests__/e2e/docker-compose.yml up --abort-on-container-exit) || \
(echo "E2E Test Attempt 3" && docker compose --env-file __tests__/e2e/.env -f __tests__/e2e/docker-compose.yml up --abort-on-container-exit) || \
(echo "E2E Tests Failed" && exit 1)
# At this point, the build is successful.
- name: Semantic Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: yarn semantic-release