-
-
Notifications
You must be signed in to change notification settings - Fork 0
205 lines (182 loc) · 7.95 KB
/
Copy pathpipeline-parity-main.yml
File metadata and controls
205 lines (182 loc) · 7.95 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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
name: Pipeline Parity Test
on:
push:
branches: [main]
paths:
- 'src/**'
- 'packages/**'
- 'scripts/**'
- '.github/workflows/**'
workflow_dispatch:
inputs:
packages:
description: 'Packages to test (comma-separated or "all")'
required: false
default: 'all'
validator_version:
description: 'HL7 Validator version'
required: false
default: 'latest'
# @max-health-inc/config is installed from GitHub Packages (see .npmrc), which needs a token
# even though the package is public. Set at workflow level so every `npm ci` below is covered.
# An unset secret expands to an EMPTY string and fails with a 401 identical to a bad token.
# Nothing in this workflow publishes, so a workflow-wide NODE_AUTH_TOKEN is safe here.
env:
NODE_AUTH_TOKEN: ${{ secrets.GH_PACKAGES_TOKEN }}
jobs:
# ── Run both validators in parallel (reusable workflow) ────────────────────
parity-tests:
uses: ./.github/workflows/_parity-tests.yml
# Required: the reusable workflow's `npm ci` needs GH_PACKAGES_TOKEN to fetch
# @max-health-inc/config, and a called workflow sees NO secrets without this.
secrets: inherit
with:
packages: ${{ github.event.inputs.packages || 'all' }}
validator_version: ${{ github.event.inputs.validator_version || 'latest' }}
# ── Deploy results to GitHub Pages ───────────────────────────────────────────
deploy:
needs: parity-tests
if: always() && needs.parity-tests.result != 'skipped'
runs-on: ubuntu-latest
concurrency:
group: gh-pages-deploy
cancel-in-progress: false
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v7
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Node.js
uses: actions/setup-node@v7
with:
node-version: '22'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Download Firely reports
uses: actions/download-artifact@v8
with:
name: firely-reports
path: main-reports/firely
continue-on-error: true
- name: Download HL7 reports
uses: actions/download-artifact@v8
with:
name: hl7-reports
path: main-reports/hl7
continue-on-error: true
- name: Download internal reports
uses: actions/download-artifact@v8
with:
name: internal-reports
path: main-reports/internal
continue-on-error: true
- name: Prepare deploy directory
run: |
DEPLOY_DIR=$(mktemp -d)
echo "DEPLOY_DIR=$DEPLOY_DIR" >> $GITHUB_ENV
# Checkout existing gh-pages content
git fetch origin gh-pages:gh-pages 2>/dev/null || true
if git show-ref --verify --quiet refs/heads/gh-pages; then
git worktree add "$DEPLOY_DIR" gh-pages
else
git worktree add --orphan "$DEPLOY_DIR" gh-pages 2>/dev/null || {
git worktree add "$DEPLOY_DIR" --detach
git -C "$DEPLOY_DIR" checkout --orphan gh-pages
git -C "$DEPLOY_DIR" rm -rf . 2>/dev/null || true
}
fi
mkdir -p "$DEPLOY_DIR/badges"
- name: Clear stale data
run: |
# Remove old data so failed runs don't show stale results
rm -f "$DEPLOY_DIR"/parity-data.json
rm -f "$DEPLOY_DIR"/parity-data-hl7.json
rm -f "$DEPLOY_DIR"/parity-data-internal.json
rm -f "$DEPLOY_DIR"/SUMMARY-*.md
rm -f "$DEPLOY_DIR"/*-DETAIL*.md
- name: Copy Firely data to gh-pages
run: |
if [ -d "main-reports/firely" ]; then
cp main-reports/firely/parity-data.json "$DEPLOY_DIR/" 2>/dev/null || true
cp main-reports/firely/badge-*.json "$DEPLOY_DIR/badges/" 2>/dev/null || true
cp main-reports/firely/*-DETAIL-firely.md "$DEPLOY_DIR/" 2>/dev/null || true
cp main-reports/firely/SUMMARY.md "$DEPLOY_DIR/SUMMARY-firely.md" 2>/dev/null || true
fi
- name: Copy HL7 data to gh-pages
run: |
if [ -d "main-reports/hl7" ]; then
cp main-reports/hl7/parity-data-hl7.json "$DEPLOY_DIR/" 2>/dev/null || true
cp main-reports/hl7/badge-hl7-*.json "$DEPLOY_DIR/badges/" 2>/dev/null || true
cp main-reports/hl7/*-DETAIL-hl7.md "$DEPLOY_DIR/" 2>/dev/null || true
cp main-reports/hl7/SUMMARY.md "$DEPLOY_DIR/SUMMARY-hl7.md" 2>/dev/null || true
fi
- name: Copy internal data to gh-pages
run: |
if [ -d "main-reports/internal" ]; then
cp main-reports/internal/parity-data-internal.json "$DEPLOY_DIR/" 2>/dev/null || true
cp main-reports/internal/badge-internal-*.json "$DEPLOY_DIR/badges/" 2>/dev/null || true
cp main-reports/internal/*-DETAIL-internal.md "$DEPLOY_DIR/" 2>/dev/null || true
cp main-reports/internal/SUMMARY.md "$DEPLOY_DIR/SUMMARY-internal.md" 2>/dev/null || true
fi
- name: Patch stable version from latest release tag
run: |
git fetch --tags origin
LATEST_TAG=$(git tag --sort=-v:refname --list 'v*' | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | head -1)
if [ -n "$LATEST_TAG" ]; then
VERSION="${LATEST_TAG#v}"
for f in "$DEPLOY_DIR"/parity-data.json "$DEPLOY_DIR"/parity-data-hl7.json "$DEPLOY_DIR"/parity-data-internal.json; do
if [ -f "$f" ]; then
jq --arg v "$VERSION" '.babelfhirVersion = $v' "$f" > "${f}.tmp" && mv "${f}.tmp" "$f"
fi
done
echo "Patched stable version to $LATEST_TAG"
else
echo "No release tag found — using version from parity data"
fi
# Append this release's parity result to history-stable.json.
#
# update-history.js has supported --stable since it was written, but nothing
# ever called it that way: the only invocation is in pipeline-parity-develop
# without the flag, which writes the pre-release history.json. So
# history-stable.json had been frozen at 1.2.1 (2026-04-07) while every
# release since shipped unrecorded.
#
# This is now a load-bearing artifact, not just a trend chart: it is the
# public, per-release record of which babelfhir-ts version passed stable
# parity, and Max-Health-Inc/fhir-igs reads it to decide which release is
# safe to publish IG packages with. Runs BEFORE the report page, which reads
# the history to draw trends.
#
# A hard parity failure leaves no parity-data*.json to copy, so
# update-history.js finds no data and records nothing — absence of an entry
# is itself the "did not pass" signal.
- name: Record stable parity history for this release
run: node scripts/update-history.js "$DEPLOY_DIR" --stable
- name: Regenerate report page
run: |
node scripts/generate-report-page.js "$DEPLOY_DIR" "$DEPLOY_DIR"
node scripts/generate-report-downloads.js "$DEPLOY_DIR"
- name: Ensure .nojekyll exists
run: touch "$DEPLOY_DIR/.nojekyll"
- name: Commit and push to gh-pages
run: |
cd "$DEPLOY_DIR"
git config user.email "github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
git add -A
if git diff --cached --quiet; then
echo "No changes to deploy"
else
git commit -m "Update parity report (main) [skip ci]"
git push origin gh-pages
echo "Deployed results to GitHub Pages"
fi
- name: Cleanup worktree
if: always()
run: |
cd "${{ github.workspace }}"
git worktree remove "$DEPLOY_DIR" --force 2>/dev/null || true