Repository navigation
110 lines (97 loc) · 3.03 KB
/
Copy pathscoring.yml
File metadata and controls
110 lines (97 loc) · 3.03 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
name: Scoring
# Required pull-request checks for FindAny/ghfind: the public scoring module,
# SDKs and workflow lint. They need no secrets, so they are safe for forks. The
# full application suite (ci.yml) runs after merge and on every deploy commit.
on:
# No path filters: these are the required pull-request checks for main.
pull_request:
push:
branches: [main]
workflow_call:
permissions:
contents: read
concurrency:
group: scoring-${{ github.ref }}
cancel-in-progress: true
jobs:
scoring:
name: Scoring parity (TS / Go / Python) and boundary
runs-on: ubuntu-latest
timeout-minutes: 15
env:
# The scorer must never need GitHub access; keep credentials out entirely.
GITHUB_TOKEN: ""
GH_TOKEN: ""
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: pnpm
- uses: actions/setup-go@v5
with:
go-version: "1.23.x"
cache-dependency-path: scoring/go.mod
- name: Install scoring package dependencies only
run: pnpm install --frozen-lockfile --filter @ghfind/scoring...
- name: Boundary (pure TS, stdlib-only Go, no credentials)
run: node scripts/check-scoring-boundary.mjs
- name: TypeScript reference — typecheck and tests
working-directory: scoring
run: |
pnpm run typecheck
pnpm test
- name: Go port — vet, gofmt and tests
working-directory: scoring
run: |
go vet ./...
test -z "$(gofmt -l .)" || { gofmt -l .; exit 1; }
go test ./...
- name: Python port — parity tests
working-directory: packages/ghfind-py
run: |
python3 -m pip install --quiet pytest
python3 -m pytest -q
- name: Rating fixture is generated from the TypeScript reference
working-directory: scoring
run: |
pnpm run fixtures:rating
git diff --exit-code -- fixtures/rating-ladder.json
sdk-js:
name: JavaScript SDK
runs-on: ubuntu-latest
timeout-minutes: 10
defaults:
run:
working-directory: packages/ghfind-js
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: actions/setup-node@v4
with:
node-version: 22
- run: npm ci
- run: npm run typecheck
- run: npm test
- run: npm run build
workflow-lint:
name: Workflow lint
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: actionlint
uses: docker://rhysd/actionlint:1.7.12
with:
args: -color -shellcheck= -pyflakes=
- uses: actions/setup-node@v4
with:
node-version: 22
- name: Repository protection policy (scripts/feed-github-protection.mjs)
run: node --test scripts/feed-github-protection.test.mjs