-
Notifications
You must be signed in to change notification settings - Fork 1
118 lines (101 loc) · 3.67 KB
/
ci.yml
File metadata and controls
118 lines (101 loc) · 3.67 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
name: CI
env:
DO_NOT_TRACK: 1
permissions:
contents: read
packages: read
pull-requests: write
on:
push:
branches: [main]
paths:
- "packages/**"
pull_request:
branches: [main]
paths:
- "packages/**"
jobs:
build:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:latest
env:
POSTGRES_USER: orm
POSTGRES_PASSWORD: password
POSTGRES_DB: orm
ports:
- 54321:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v6
- name: Install pnpm
uses: pnpm/action-setup@v6
with:
run_install: false
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version-file: ".tool-versions"
cache: "pnpm"
registry-url: "https://npm.pkg.github.com"
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: Install dependencies
run: pnpm install --frozen-lockfile
env:
NODE_AUTH_TOKEN: ${{ secrets.GH_PACKAGES_TOKEN }}
- name: Run tests
run: pnpm test
- name: Check formatting
run: pnpm format:check
- name: Lint
run: pnpm lint
- name: Check dependencies are in sync
run: pnpm syncpack:check
- name: Check types
run: pnpm typecheck
- name: Upload coverage reports
if: github.actor != 'dependabot[bot]'
uses: actions/upload-artifact@v7
with:
name: coverage-reports
path: |
packages/*/coverage
retention-days: 7
- name: Extract coverage percentage
id: coverage
if: github.event_name == 'pull_request' && github.actor != 'dependabot[bot]'
shell: bash
run: |
echo "coverage<<EOF" >> $GITHUB_OUTPUT
for d in packages/*/coverage/coverage-summary.json; do
pkg=$(echo $d | cut -d'/' -f2)
pct=$(jq -r '.total.lines.pct' $d)
echo "* $pkg: ${pct}%" >> $GITHUB_OUTPUT
done
echo "EOF" >> $GITHUB_OUTPUT
- name: Find Comment
uses: peter-evans/find-comment@v4
if: github.event_name == 'pull_request' && github.actor != 'dependabot[bot]'
id: find-comment
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: "github-actions[bot]"
body-includes: "Coverage Report"
- name: Create or Update Comment
uses: peter-evans/create-or-update-comment@v5
if: github.event_name == 'pull_request' && github.actor != 'dependabot[bot]'
with:
comment-id: ${{ steps.find-comment.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: |
### Coverage Report
${{ steps.coverage.outputs.coverage }}
edit-mode: replace