-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
147 lines (130 loc) · 5.72 KB
/
acceptance.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
# TODO(billy): this workflow has not been re-named from `acceptance` because
# Visual Snapshots compares against artifacts from the same workflow name (on main branch)
# We should rename this when we have a more finalized naming scheme.
#
# Also note that this name *MUST* match the filename because GHA
# only provides the workflow name (https://docs.github.com/en/free-pro-team@latest/actions/reference/environment-variables#default-environment-variables)
# and GH APIs only support querying by workflow *FILENAME* (https://developer.github.com/v3/actions/workflows/#get-a-workflow)
name: acceptance
on:
push:
branches:
- master
- releases/**
pull_request:
# Cancel in progress workflows on pull_requests.
# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
# hack for https://github.com/actions/cache/issues/810#issuecomment-1222550359
env:
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 3
jobs:
files-changed:
name: detect what files changed
runs-on: ubuntu-20.04
timeout-minutes: 3
# Map a step output to a job output
outputs:
acceptance: ${{ steps.changes.outputs.acceptance }}
backend_all: ${{ steps.changes.outputs.backend_all }}
steps:
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
- name: Check for backend file changes
uses: getsentry/paths-filter@4512585405083f25c027a35db413c2b3b9006d50 # v2.11.1
id: changes
with:
token: ${{ github.token }}
filters: .github/file-filters.yml
acceptance:
if: needs.files-changed.outputs.acceptance == 'true'
needs: files-changed
name: acceptance
runs-on: ubuntu-20.04
timeout-minutes: 30
strategy:
# This helps not having to run multiple jobs because one fails, thus, reducing resource usage
# and reducing the risk that one of many runs would turn red again (read: intermittent tests)
fail-fast: false
matrix:
# XXX: When updating this, make sure you also update MATRIX_INSTANCE_TOTAL.
instance: [0, 1, 2, 3, 4]
pg-version: ['14']
env:
# XXX: MATRIX_INSTANCE_TOTAL must be hardcoded to the length of strategy.matrix.instance.
MATRIX_INSTANCE_TOTAL: 5
VISUAL_SNAPSHOT_ENABLE: 1
TEST_GROUP_STRATEGY: roundrobin
steps:
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
name: Checkout sentry
- uses: getsentry/action-setup-volta@54775a59c41065f54ecc76d1dd5f2cdc7a1550cb # v1.1.0
- name: Step configurations
id: config
run: echo "webpack-path=.webpack_cache" >> "$GITHUB_OUTPUT"
- name: webpack cache
uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 # v3.0.11
with:
path: ${{ steps.config.outputs.webpack-path }}
key: ${{ runner.os }}-v2-webpack-cache-${{ hashFiles('webpack.config.ts') }}
- name: node_modules cache
uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 # v3.0.11
id: nodemodulescache
with:
path: node_modules
key: ${{ runner.os }}-node-modules-${{ hashFiles('yarn.lock', 'api-docs/yarn.lock') }}
- name: Install Javascript Dependencies
if: steps.nodemodulescache.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile
- name: webpack
env:
WEBPACK_CACHE_PATH: ${{ steps.config.outputs.webpack-path }}
SENTRY_INSTRUMENTATION: 1
# this is fine to not have for forks, it shouldn't fail
SENTRY_WEBPACK_WEBHOOK_SECRET: ${{ secrets.SENTRY_WEBPACK_WEBHOOK_SECRET }}
run: |
yarn build-acceptance
- name: Build chartcuterie configuration module
run: |
make build-chartcuterie-config
- name: Setup sentry env
uses: ./.github/actions/setup-sentry
id: setup
with:
snuba: true
chartcuterie: true
pg-version: ${{ matrix.pg-version }}
- name: Run acceptance tests (#${{ steps.setup.outputs.matrix-instance-number }} of ${{ steps.setup.outputs.matrix-instance-total }})
run: |
mkdir -p ${{ steps.setup.outputs.acceptance-dir }}
mkdir -p ${{ steps.setup.outputs.acceptance-dir }}-mobile
mkdir -p ${{ steps.setup.outputs.acceptance-dir }}-tooltips
make run-acceptance
env:
PYTEST_SNAPSHOTS_DIR: ${{ steps.setup.outputs.acceptance-dir }}
# This job runs when FE or BE changes happen, however, we only upload coverage data for
# BE changes since it conflicts with codecov's carry forward functionality
# Upload coverage data even if running the tests step fails since
# it reduces large coverage fluctuations
- name: Handle artifacts
uses: ./.github/actions/artifacts
if: ${{ always() && needs.files-changed.outputs.backend_all == 'true' }}
with:
token: ${{ secrets.CODECOV_TOKEN }}
acceptance-required-checks:
# this is a required check so we need this job to always run and report a status.
if: always()
name: Acceptance
needs: [acceptance, files-changed]
runs-on: ubuntu-20.04
timeout-minutes: 3
steps:
# If any jobs we depend on fail, we will fail since this check calls the
# visual snapshot service which creates the "Visual Snapshot" status,
# which is a required check.
# NOTE: A timeout is considered a failure
- name: Check for failures
if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
run: |
echo "One of the dependent jobs have failed. You may need to re-run it." && exit 1