-
Notifications
You must be signed in to change notification settings - Fork 3
155 lines (141 loc) Β· 4.85 KB
/
test.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
148
149
150
151
152
153
154
155
name: Test
on:
pull_request:
branches: [main]
jobs:
test-lint:
name: ESlint check
runs-on: ubuntu-latest
outputs:
check-ok: ${{ steps.output-ok.outputs.STATUS }}
check-err: ${{ steps.output-err.outputs.STATUS }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: install
run: yarn
- name: Lint
run: yarn lint
- id: output-ok
run: echo "::set-output name=STATUS::ok"
- id: output-err
if: failure()
run: echo "::set-output name=STATUS::err"
test-unit:
name: Unit test
runs-on: ubuntu-latest
outputs:
check-ok: ${{ steps.output-ok.outputs.STATUS }}
check-err: ${{ steps.output-err.outputs.STATUS }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: install
run: yarn
- name: test apps
run: yarn test:apps:unit
- name: test shared
run: yarn test:shared
- id: output-ok
run: echo "::set-output name=STATUS::ok"
- id: output-err
if: failure()
run: echo "::set-output name=STATUS::err"
test-bundle:
name: Bundle test
runs-on: ubuntu-latest
strategy:
matrix:
package:
- apps
- apps:test
outputs:
check-ok: ${{ steps.output-ok.outputs.STATUS }}
check-err: ${{ steps.output-err.outputs.STATUS }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: install
run: yarn
- name: build
run: yarn build:${{matrix.package}}
- id: output-ok
run: echo "::set-output name=STATUS::ok"
- id: output-err
if: failure()
run: echo "::set-output name=STATUS::err"
completed-test:
name: Completed test
runs-on: ubuntu-latest
needs: [test-unit, test-bundle, test-lint]
if: always()
steps:
- uses: actions/checkout@v2
- name: Test status
id: test-status
run: |
UNIT_OK='${{ needs.test-unit.outputs.check-ok }}'
UNIT_ERR='${{ needs.test-unit.outputs.check-err }}'
BUNDLE_OK='${{ needs.test-bundle.outputs.check-ok }}'
BUNDLE_ERR='${{ needs.test-bundle.outputs.check-err }}'
LINT_OK='${{ needs.test-lint.outputs.check-ok }}'
LINT_ERR='${{ needs.test-lint.outputs.check-err }}'
UNIT_STATUS=
BUNDLE_STATUS=
LINT_STATUS=
if [ "${UNIT_OK}" == "ok" ]; then
UNIT_STATUS="π ${UNIT_OK}"
else
UNIT_STATUS="π ${UNIT_ERR}"
fi
if [ "${BUNDLE_OK}" == "ok" ]; then
BUNDLE_STATUS="π ${BUNDLE_OK}"
else
BUNDLE_STATUS="π ${BUNDLE_ERR}"
fi
if [ "${LINT_OK}" == "ok" ]; then
LINT_STATUS="π ${LINT_OK}"
else
LINT_STATUS="π ${LINT_ERR}"
fi
SHA='${{github.event.pull_request.head.sha}}'
SHA=${SHA::7}
COMMIT="[${SHA}](${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/commit/${SHA})"
ARTIFACTS_MD=
ARTIFACTS_LINK=
if [[ "${UNIT_ERR}" == "err" ]]; then
ARTIFACTS_LINK="https://github.com/darwinia-network/wormhole-ui/actions/runs/${{ github.run_id }}"
ARTIFACTS_MD="[${{ github.run_id }}](${ARTIFACTS_LINK})"
echo "::set-output name=ARTIFACTS_MD::${ARTIFACTS_MD}"
echo "::set-output name=ARTIFACTS_LINK::${ARTIFACTS_LINK}"
fi
echo "::set-output name=E2E_STATUS::${E2E_STATUS}"
echo "::set-output name=UNIT_STATUS::${UNIT_STATUS}"
echo "::set-output name=BUNDLE_STATUS::${BUNDLE_STATUS}"
echo "::set-output name=LINT_STATUS::${LINT_STATUS}"
echo "::set-output name=COMMIT::${COMMIT}"
- uses: marocchino/sticky-pull-request-comment@v2
with:
append: true
message: |
\---
Type: π§ͺ
Commit: ${{ steps.test-status.outputs.COMMIT }}
Unit: ${{ steps.test-status.outputs.UNIT_STATUS }}
Bundle: ${{ steps.test-status.outputs.BUNDLE_STATUS }}
Lint: ${{ steps.test-status.outputs.LINT_STATUS }}
Artifacts: ${{ steps.test-status.outputs.ARTIFACTS_MD }}
- name: Slack Notification
uses: rtCamp/action-slack-notify@v2
env:
SLACK_CHANNEL: helix-ui
SLACK_COLOR: ${{ job.status }}
SLACK_ICON: https://avatars.githubusercontent.com/u/14985020?s=48&v=4
SLACK_MESSAGE: |
Unit: ${{ steps.test-status.outputs.UNIT_STATUS }}
Bundle: ${{ steps.test-status.outputs.BUNDLE_STATUS }}
Lint: ${{ steps.test-status.outputs.LINT_STATUS }}
Artifacts: ${{ steps.test-status.outputs.ARTIFACTS_LINK }}
SLACK_TITLE: Cypress
SLACK_USERNAME: Vercel
SLACK_WEBHOOK: ${{ secrets.SLACK_INCOMING_WEBHOOK_URL }}