-
-
Notifications
You must be signed in to change notification settings - Fork 455
95 lines (82 loc) · 3.55 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
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# Finally, it triggers the e2e tests workflow.
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: CI
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: Cache Yarn
uses: actions/cache@v2
with:
path: ${{ github.workspace }}/.yarn
key: ci-v1-${{ matrix.node-version }}-${{ hashFiles('yarn.lock') }}
restore-keys: |
ci-v1-${{ matrix.node-version }}-
- name: Setup yarn
run: yarn install --immutable --inline-builds
- name: Run yarn build
env:
NODE_OPTIONS: "--max-old-space-size=4096"
run: yarn build
- name: Upload handler sizes to S3
if: ${{ github.ref == 'refs/heads/master' && matrix.node-version == '14.x' }}
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_AT }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_ST }}
AWS_DEFAULT_REGION: us-east-1
GITHUB_SHA: ${{ github.sha }}
run: yarn handlers:upload-handler-sizes
#
# - run: yarn test
#
# - run: yarn integration
#
# - name: Upload code coverage
# if: ${{ matrix.node-version == '14.x' }}
# env:
# CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
# run: npx codecov
- name: Calculate and post handler sizes
if: (matrix.node-version == '14.x' && github.event_name == 'pull_request')
env:
GITHUB_NEW_SHA: ${{ github.event.pull_request.head.sha }}
GITHUB_BASE_SHA: ${{ github.event.pull_request.base.sha }}
PULL_REQUEST_ID: ${{ github.event.number }}
run: yarn handlers:comment-handler-sizes
start-e2e-tests:
# Note: we only run e2e tests automatically if this is a push on master or if PR is not from a fork or renovate, as forks won't have access to secrets
if: ${{ github.event_name == 'push' || (github.event_name == 'pull_request' && startsWith(github.event.pull_request.head.ref, 'renovate/') == false && github.event.pull_request.head.repo.full_name == github.repository) }}
runs-on: ubuntu-latest
steps:
- name: Mark end-to-end tests as pending
uses: Sibz/github-status-action@v1
with:
authToken: ${{ secrets.GITHUB_TOKEN }}
context: "End-to-end Tests"
description: "Waiting for end-to-end tests to pass"
state: "pending"
sha: ${{ github.event.pull_request.head.sha || github.sha }}
- name: Trigger end-to-end tests workflow
uses: benc-uk/workflow-dispatch@v1
with:
workflow: End-to-end Tests
token: ${{ secrets.BOT_GITHUB_TOKEN }}
ref: ${{ github.event.pull_request.head.ref || github.ref }}
# FIXME: Passing sha doesn't seem to work, created GitHub ticket here: https://github.community/t/workflow-dispatch-cant-set-ref-to-commit-sha/138132
# So for now we pass in SHA as an input
# ref: ${{ github.event.pull_request.head.sha || github.sha }}
inputs: '{"sha": "${{ github.event.pull_request.head.sha || github.sha }}"}'