-
Notifications
You must be signed in to change notification settings - Fork 4
132 lines (112 loc) · 4.15 KB
/
tests.yaml
File metadata and controls
132 lines (112 loc) · 4.15 KB
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
name: tests
on:
workflow_dispatch: # allows manual triggering with branch picker
push:
branches:
- main
pull_request_target:
types:
- opened
- reopened
- synchronize
- ready_for_review
jobs:
check-actor-permissions:
permissions:
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: Check User Permission
id: check-user-permission
uses: actions-cool/check-user-permission@v2
with:
require: write
username: ${{ github.triggering_actor }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Notify on Lack of Permission
if: steps.check-user-permission.outputs.require-result == 'false'
id: slack-user-permission
uses: slackapi/slack-github-action@v1.27.0
with:
payload: |
{
"MESSAGE": "${{github.actor}} opened a PR from a fork. Please carefully review the code and retry failed jobs.",
"GHA_LINK": "${{github.server_url}}/${{github.repository}}/actions/runs/${{github.run_id}}"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_PERMISSION_CHECK_WEBHOOK_URL }}
- name: Notify on Bot Commiting
if: steps.check-user-permission.outputs.check-result == 'false'
id: slack-bot-user
uses: slackapi/slack-github-action@v1.27.0
with:
payload: |
{
"MESSAGE": "${{github.actor}} modified a branch but can't run CI. Please carefully review the code and retry failed jobs.",
"GHA_LINK": "${{github.server_url}}/${{github.repository}}/actions/runs/${{github.run_id}}"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_PERMISSION_CHECK_WEBHOOK_URL }}
- name: Add comment to add helpful context for contributors
if: steps.check-user-permission.outputs.require-result == 'false' && steps.check-user-permission.outputs.check-result == 'false'
uses: thollander/actions-comment-pull-request@v2.5.0
with:
comment_tag: execution
message: |
Thanks for the PR @${{github.actor}} :wave:
Our GitHub actions pipelines require a user with write permissions to retry the failed jobs. We've sent a message to a maintainer to review your PR. Please be patient and we'll get back to you as soon as possible.
- name: Fail if No Write Permission
if: steps.check-user-permission.outputs.require-result == 'false'
run: exit 1
cache-and-install-deps-and-run-tests:
needs: [check-actor-permissions]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
- uses: pnpm/action-setup@v4
name: Install pnpm
with:
run_install: false
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Dry-run of build
shell: bash
run: pnpm pack
- name: Run lint
run: pnpm lint
- name: Check types
run: pnpm tsc
- name: Run format
run: pnpm format:check
- name: Run tests with coverage
run: pnpm test:cov
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5.4.2
with:
files: coverage/cobertura-coverage.xml
token: ${{ secrets.CODECOV_TOKEN }}
slug: great-expectations/jsonforms-antd-renderers
- name: Upload test results to Codecov
if: ${{ !cancelled() }}
uses: codecov/test-results-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}