-
Notifications
You must be signed in to change notification settings - Fork 0
138 lines (112 loc) · 3.9 KB
/
Copy pathstack-lint.yml
File metadata and controls
138 lines (112 loc) · 3.9 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
133
134
135
136
137
138
name: Stack lint
on:
pull_request:
push:
branches:
- develop
- main
permissions:
contents: read
concurrency:
group: stack-lint-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
documentation:
name: Markdown and Mermaid
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- name: Lint Markdown
run: npx --yes markdownlint-cli2@0.18.1 "**/*.md" "#node_modules"
- name: Render Mermaid diagrams
shell: bash
run: |
set -euo pipefail
output_dir="${RUNNER_TEMP}/mermaid"
mkdir -p "$output_dir"
while IFS= read -r -d '' file; do
if grep -q '^```mermaid' "$file"; then
digest="$(printf '%s' "$file" | sha256sum | cut -d ' ' -f 1)"
npx --yes @mermaid-js/mermaid-cli@11.17.0 \
--puppeteerConfigFile .github/puppeteer-ci.json \
--input "$file" \
--output "$output_dir/$digest.md"
fi
done < <(find . -type f -name '*.md' -not -path './node_modules/*' -print0)
typescript:
name: ESLint and TypeScript
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Detect pnpm workspace
id: workspace
shell: bash
run: |
set -euo pipefail
if [[ -f package.json && -f pnpm-lock.yaml ]]; then
echo "enabled=true" >> "$GITHUB_OUTPUT"
elif [[ -f package.json || -f pnpm-lock.yaml ]]; then
echo "package.json and pnpm-lock.yaml must be committed together" >&2
exit 1
else
echo "enabled=false" >> "$GITHUB_OUTPUT"
echo "No TypeScript workspace yet; documentation lint remains active."
fi
- uses: pnpm/action-setup@v4
if: steps.workspace.outputs.enabled == 'true'
with:
run_install: false
- uses: actions/setup-node@v4
if: steps.workspace.outputs.enabled == 'true'
with:
node-version-file: '.nvmrc'
cache: pnpm
- name: Install locked dependencies
if: steps.workspace.outputs.enabled == 'true'
run: pnpm install --frozen-lockfile
- name: Require lint scripts
if: steps.workspace.outputs.enabled == 'true'
shell: bash
run: |
node -e "const p=require('./package.json'); for (const s of ['lint','typecheck']) if (!p.scripts?.[s]) { console.error('Missing package.json script: '+s); process.exitCode=1 }"
- name: Run ESLint
if: steps.workspace.outputs.enabled == 'true'
run: pnpm lint
- name: Run TypeScript compiler
if: steps.workspace.outputs.enabled == 'true'
run: pnpm typecheck
- name: Check generated contracts
if: steps.workspace.outputs.enabled == 'true'
run: pnpm check:generated
- name: Validate contract fixtures
if: steps.workspace.outputs.enabled == 'true'
run: pnpm validate:fixtures
- name: Run tests
if: steps.workspace.outputs.enabled == 'true'
run: pnpm test
- name: Run PostgreSQL integration tests
if: steps.workspace.outputs.enabled == 'true'
env:
TEST_POSTGRES: '1'
run: pnpm test:integration
browser:
name: Frontend browser acceptance
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
run_install: false
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: pnpm
- name: Install locked dependencies
run: pnpm install --frozen-lockfile
- name: Install Chromium
run: pnpm --filter @oneshot/web exec playwright install --with-deps chromium
- name: Run frontend browser acceptance
run: pnpm test:browser