-
Notifications
You must be signed in to change notification settings - Fork 15
170 lines (142 loc) · 5.2 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
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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
name: CI
on:
workflow_dispatch:
pull_request:
branches:
- master # triggers the flow for every PR to master
- 'feature/**' # triggers the flow for a PR to a branch like feature/v9
types:
- synchronize # PR was updated
- opened # PR was open
- reopened # PR was closed and is now open again
- ready_for_review # PR was converted from draft to open
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
TOPTAL_DEVBOT_TOKEN: ${{ secrets.TOPTAL_DEVBOT_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
HTTP_PROXY: http://${{ secrets.HTTP_PROXY }}
HAPPO_API_KEY: ${{ secrets.HAPPO_API_KEY }}
HAPPO_API_SECRET: ${{ secrets.HAPPO_API_SECRET }}
JENKINS_USER: ${{ secrets.TOPTAL_TRIGGERBOT_USERNAME }}
JENKINS_BUILD_TOKEN: ${{ secrets.TOPTAL_TRIGGERBOT_BUILD_TOKEN }}
PROXY: http://${{ secrets.HTTP_PROXY }}
jobs:
build-docker-image:
if: ${{ github.event.pull_request.head.ref != 'changeset-release/master' }}
name: Build Picasso docker image
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: toptal/davinci-github-actions/[email protected]
env:
GITHUB_TOKEN: ${{ env.TOPTAL_DEVBOT_TOKEN }}
GCR_ACCOUNT_KEY: ${{ secrets.GCR_ACCOUNT_KEY }}
with:
sha: ${{ github.event.pull_request.head.sha }}
image-name: picasso
environment: temploy
docker-file: ./Dockerfile
static-checks:
if: ${{ github.event.pull_request.head.ref != 'changeset-release/master' }}
name: Static checks
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup node 16
uses: actions/setup-node@v3
with:
node-version: '16'
- name: Check missing changeset
uses: toptal/davinci-github-actions/[email protected]
with:
github-token: ${{ env.TOPTAL_DEVBOT_TOKEN }}
# This Action will scan dependency manifest files that change as part of a Pull Request,
# surfacing known-vulnerable versions of the packages declared or updated in the PR.
# Once installed, if the workflow run is marked as required, PRs introducing known-vulnerable
# packages will be blocked from merging.
- name: Dependency Review
uses: actions/dependency-review-action@v3
- name: Install Dependencies
uses: toptal/davinci-github-actions/[email protected]
- name: Update PR Body
run: node ./.github/actions/update-body.js
env:
token: ${{ env.TOPTAL_DEVBOT_TOKEN }}
- name: Syncpack check
run: yarn syncpack:list
- name: Circularity Check
run: yarn circularity
- name: Lint
run: yarn lint
- name: Type Check
run: yarn typecheck
- name: Jest Tests
run: yarn test:unit:ci
storybook-visual-tests:
if: ${{ github.event.pull_request.head.ref != 'changeset-release/master' }}
name: Storybook Visual Tests
runs-on: ubuntu-latest
needs: [static-checks]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup node 16
uses: actions/setup-node@v3
with:
node-version: '16'
- name: Install dependencies from cache
uses: toptal/davinci-github-actions/[email protected]
- name: Visual Tests
run: yarn happo:storybook
env:
HAPPO_PROJECT: Picasso/Storybook
HAPPO_API_KEY: ${{ env.HAPPO_API_KEY }}
HAPPO_API_SECRET: ${{ env.HAPPO_API_SECRET }}
integration-tests:
name: Integration Tests
uses: ./.github/workflows/davinci-integration-tests.yml
secrets:
TOPTAL_DEVBOT_TOKEN: ${{ secrets.TOPTAL_DEVBOT_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
HAPPO_API_KEY: ${{ secrets.HAPPO_API_KEY }}
HAPPO_API_SECRET: ${{ secrets.HAPPO_API_SECRET }}
deploy-docs:
if: ${{ github.event.pull_request.head.ref != 'changeset-release/master' }}
name: Deploy Picasso docs
runs-on: ubuntu-latest
needs: [build-docker-image]
steps:
- name: Trigger doc deployment job
uses: toptal/[email protected]
env:
BRANCH: ${{ github.event.pull_request.head.ref }}
PR_ID: ${{ github.event.pull_request.number }}
with:
jenkins_url: https://jenkins-build.toptal.net/
jenkins_user: ${{ secrets.TOPTAL_TRIGGERBOT_USERNAME }}
jenkins_token: ${{ secrets.TOPTAL_TRIGGERBOT_BUILD_TOKEN }}
proxy: ${{ env.HTTP_PROXY }}
job_name: picasso-docs
job_params: |
{
"BRANCH": "${{ env.BRANCH }}",
"PR_ID": "${{ env.PR_ID }}"
}
job_timeout: '3600'
- name: Create Jira Deployment
uses: toptal/davinci-github-actions/[email protected]
if: ${{ always() }}
with:
token: ${{ env.TOPTAL_DEVBOT_TOKEN }}
environment: staging
environment-url: ${{ steps.temploy.outputs.temployURL }}
transient-environment: false
auto-inactive: false