forked from Ignition-World/ignition-pay
-
Notifications
You must be signed in to change notification settings - Fork 0
124 lines (118 loc) · 3.59 KB
/
Copy pathci-pr.yml
File metadata and controls
124 lines (118 loc) · 3.59 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
name: ci-pr
on:
pull_request:
branches: [main]
paths:
- "packages/core-ts/**"
- "packages/core-dart/**"
- "packages/core-go/**"
- "spec/**"
- "ignition-api/**"
- "ignition-mobile/**"
- "ignition-pay-frontend/**"
- ".github/workflows/ci-pr.yml"
- "package.json"
- "pnpm-lock.yaml"
permissions:
contents: read
pull-requests: write
jobs:
core-ts:
name: TypeScript tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 9
- uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Run TypeScript tests
run: pnpm --dir packages/core-ts test -- --coverage --ci
- name: Upload TypeScript coverage
if: always()
uses: actions/upload-artifact@v4
with:
name: core-ts-coverage
path: packages/core-ts/coverage/
if-no-files-found: warn
- name: Upload coverage to Codecov
if: ${{ !cancelled() }}
uses: codecov/codecov-action@v4
with:
files: packages/core-ts/coverage/lcov.info
flags: core-ts
fail_ci_if_error: false
core-go:
name: Go tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.21"
- name: Run Go tests
run: cd packages/core-go && go test ./...
core-dart:
name: Dart tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dart-lang/setup-dart@v1
with:
sdk: stable
- name: Install Dart dependencies
run: cd packages/core-dart && dart pub get
- name: Run Dart tests
run: cd packages/core-dart && dart test --coverage=coverage
- name: Generate coverage report
run: |
cd packages/core-dart
dart pub global activate coverage
dart run coverage:format_coverage --lcov --in=coverage --out=coverage.lcov --packages=.dart_tool/package_config.json --report-on=lib
- name: Upload Dart coverage
if: always()
uses: actions/upload-artifact@v4
with:
name: core-dart-coverage
path: packages/core-dart/coverage.lcov
if-no-files-found: warn
- name: Upload coverage to Codecov
if: ${{ !cancelled() }}
uses: codecov/codecov-action@v4
with:
files: packages/core-dart/coverage.lcov
flags: core-dart
fail_ci_if_error: false
notify:
name: PR test summary
runs-on: ubuntu-latest
if: always()
needs: [core-ts, core-go, core-dart]
steps:
- name: Comment on pull request
uses: actions/github-script@v7
with:
script: |
const results = {
'TypeScript tests': '${{ needs.core-ts.result }}',
'Go tests': '${{ needs.core-go.result }}',
'Dart tests': '${{ needs.core-dart.result }}',
};
const body = [
'## CI test results',
'',
...Object.entries(results).map(([name, result]) => `- ${name}: ${result}`),
'',
'Review the workflow run for details and artifacts.',
].join('\n');
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body,
});