This repository has been archived by the owner on Jul 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
95 lines (95 loc) · 3.69 KB
/
PullRequest.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
name: Pull Request
on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
lint:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '16'
- name: install dependencies
run: npm install
- name: lint
run: npm run lint
unit-tests:
name: unit tests
runs-on: ubuntu-latest
env:
CI: true
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '16'
- name: install dependencies
run: npm install
- name: unit test with coverage
run: npm run cover
visual-tests:
name: visual regression tests
runs-on: ubuntu-latest
env:
CI: true
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-node@v2
with:
node-version: '16'
- name: install dependencies
run: npm install
- uses: chromaui/action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
projectToken: ${{ secrets.CHROMATIC_APP_CODE }}
deploy:
name: deploy test documentation site
runs-on: ubuntu-latest
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '16'
- name: install dependencies
run: npm install
- name: build documentation site
run: npm run styleguide:build
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.AWS_SECRET }}
aws-region: us-west-2
- name: deploy js files
run: aws s3 cp --recursive styleguide s3://${{ secrets.AWS_BUCKET_NAME }}/${{ github.event.number }}/ --cache-control max-age=2592000 --exclude service-worker.js --exclude index.html
- name: deploy service-worker.js
run: aws s3 cp styleguide/service-worker.js s3://${{ secrets.AWS_BUCKET_NAME }}/${{ github.event.number }}/service-worker.js --metadata-directive REPLACE --cache-control max-age=0,must-revalidate --content-type application/javascript
- name: deploy index.html
run: aws s3 cp styleguide/index.html s3://${{ secrets.AWS_BUCKET_NAME }}/${{ github.event.number }}/index.html --metadata-directive REPLACE --cache-control max-age=0,must-revalidate --content-type text/html
- name: Add link to Pull Request
uses: actions/github-script@v3
if: github.event_name == 'pull_request' && github.event.action == 'opened'
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '### :eyes: [Test Deployment](https://pebble.istreamplanet.net/${{ github.event.number }}/index.html) :eyes:'
})
- name: Notify Slack
uses: pullreminders/slack-action@master
if: github.event_name == 'pull_request' && github.event.action == 'opened'
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
with:
args: '{\"channel\":\"CQ9AG10AC\",\"text\":\":rocket: Pebble Pull Request - <https://github.com/iStreamPlanet/pebble/pull/${{ github.event.number }}|${{ github.event.pull_request.title }}> has been opened.\nA <https://pebble.istreamplanet.net/${{ github.event.number }}/index.html|test deployment> has been created.\"}'