-
Notifications
You must be signed in to change notification settings - Fork 31
103 lines (102 loc) · 3.92 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
96
97
98
99
100
101
102
103
name: CI
on:
workflow_dispatch:
pull_request:
branches:
- master
- develop
- "release/**"
jobs:
ci:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2
- name: setup node
uses: actions/setup-node@v2
with:
node-version: v16.17.1
cache: yarn
- name: node_modules cache
uses: actions/cache@v2
with:
path: "**/node_modules"
key: ${{ runner.os }}-node-modules-cache-${{ hashFiles('**/yarn.lock') }}
restore-keys: ${{ runner.os }}-node-modules-cache-
- name: install dependencies
run: yarn install --immutable
- name: lint
run: yarn lint
- name: type check
run: yarn typecheck
- name: unit test
run: yarn test
- name: output change conditionals
uses: dorny/paths-filter@v2
id: changes
with:
filters: |
deploy:
- './packages/odyssey-react/**'
- './packages/odyssey-react-mui/**'
- './packages/odyssey-storybook/**'
vrt:
- './packages/odyssey-react/src/**'
- './packages/odyssey-react-mui/src/**'
- './packages/odyssey-storybook/**'
- name: setup AWS
if: steps.changes.outputs.deploy == 'true'
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}
- name: set $SHA7
if: steps.changes.outputs.deploy == 'true'
run: echo "SHA7=$(git rev-parse --short ${{ github.event.pull_request.head.sha || github.sha }})" >> $GITHUB_ENV
- name: set $URL_STORYBOOK
if: steps.changes.outputs.deploy == 'true'
run: echo "URL_STORYBOOK="https://${SHA7}.ods.dev"" >> $GITHUB_ENV
- name: set $COMMIT_MSG
if: steps.changes.outputs.deploy == 'true'
run: echo "COMMIT_MSG=${{ github.event.head_commit.message || github.event.pull_request.title }}" >> $GITHUB_ENV
- name: build storybook
if: steps.changes.outputs.deploy == 'true'
run: cd ./packages/odyssey-storybook && rm -rf ./node_modules/.cache && yarn build
- name: create deployment
if: steps.changes.outputs.deploy == 'true'
uses: bobheadxi/deployments@v0.4.3
id: deployment
with:
step: start
token: ${{ secrets.GITHUB_TOKEN }}
env: preview
- name: deploy
if: steps.changes.outputs.deploy == 'true'
run: aws s3 sync ./packages/odyssey-storybook/dist/ s3://ods.dev/$SHA7 --delete
- name: "inform slack of deployment (#odyssey-deployments)"
if: steps.changes.outputs.deploy == 'true'
run: bash ./scripts/notify-slack.sh
env:
INCOMING_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
AUTHOR_NAME: ${{github.actor}}
BRANCH_NAME: ${{github.head_ref}}
PULL_REQUEST_ID: ${{github.event.pull_request.number}}
- name: update deployment status
if: steps.changes.outputs.deploy == 'true'
uses: bobheadxi/deployments@v0.4.3
with:
step: finish
token: ${{ secrets.GITHUB_TOKEN }}
status: ${{ job.status }}
deployment_id: ${{ steps.deployment.outputs.deployment_id }}
env_url: ${{ env.URL_STORYBOOK }}
- name: a11y test
if: steps.changes.outputs.deploy == 'true'
run: yarn workspace @okta/odyssey-storybook test:storybook --url ${{ env.URL_STORYBOOK }}
- name: visual regression test
if: steps.changes.outputs.vrt == 'true'
env:
APPLITOOLS_API_KEY: ${{ secrets.OKTA_474937 }}
APPLITOOLS_BATCH_ID: ${{ github.event.pull_request.head.sha }}
run: yarn workspace @okta/odyssey-storybook eyes-storybook -u ${{ env.URL_STORYBOOK }}