-
Notifications
You must be signed in to change notification settings - Fork 324
Expand file tree
/
Copy pathtest-remote-vs-local-generation-parity.yml
More file actions
160 lines (141 loc) · 4.97 KB
/
Copy pathtest-remote-vs-local-generation-parity.yml
File metadata and controls
160 lines (141 loc) · 4.97 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
name: Test Remote vs Local Generation Parity
on:
# Runs on every commit to main
push:
branches:
- main
# Runs when triggered manually (supports testing from any branch)
workflow_dispatch:
inputs:
branch:
description: "Branch to test (defaults to the branch the workflow is dispatched from)"
required: false
type: string
# Runs when a generator is published successfully
workflow_run:
workflows:
- "Publish TypeScript SDK Generator"
- "Publish Go SDK Generator"
- "Publish Java SDK Generator"
- "Publish Python SDK Generator"
types:
- completed
branches:
- main
# Let the current run finish, but cancel any queued (pending) runs in favor of the newest
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
env:
DO_NOT_TRACK: "1"
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: "buildwithfern"
TURBO_REMOTE_CACHE_TIMEOUT: 60
jobs:
# Determine which generator to test based on the triggering workflow
determine-generator:
runs-on: ubuntu-latest
if: github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success'
outputs:
generators: ${{ steps.set-generators.outputs.generators }}
steps:
- name: Set generators to test
id: set-generators
run: |
if [ "${{ github.event_name }}" = "workflow_run" ]; then
# Map workflow name to generator
case "${{ github.event.workflow_run.name }}" in
"Publish TypeScript SDK Generator")
echo 'generators=["ts-sdk"]' >> $GITHUB_OUTPUT
;;
"Publish Go SDK Generator")
echo 'generators=["go-sdk"]' >> $GITHUB_OUTPUT
;;
"Publish Java SDK Generator")
echo 'generators=["java-sdk"]' >> $GITHUB_OUTPUT
;;
"Publish Python SDK Generator")
echo 'generators=["python-sdk"]' >> $GITHUB_OUTPUT
;;
*)
echo "Unknown workflow: ${{ github.event.workflow_run.name }}"
exit 1
;;
esac
else
# For push and workflow_dispatch, test all generators
echo 'generators=["ts-sdk", "java-sdk", "go-sdk", "python-sdk"]' >> $GITHUB_OUTPUT
fi
compile-and-build:
needs: determine-generator
runs-on: Seed
timeout-minutes: 30
steps:
- name: Checkout Repo
uses: actions/checkout@v4
with:
ref: ${{ inputs.branch || github.ref }}
- name: Install
uses: ./.github/actions/install
- name: Compile
run: pnpm compile
- name: Build Fern CLI
run: pnpm fern:build
- name: Build Seed CLI
run: pnpm seed:build
- name: Upload Seed CLI
uses: actions/upload-artifact@v4
with:
name: seed-cli
path: packages/seed/dist/
retention-days: 1
- name: Upload Fern CLI
uses: actions/upload-artifact@v4
with:
name: fern-cli
path: packages/cli/cli/dist/prod/
retention-days: 1
test-remote-local-parity:
needs: [determine-generator, compile-and-build]
runs-on: ubuntu-latest
timeout-minutes: 60
strategy:
fail-fast: false
# Run one generator at a time to prevent branch name collisions on the remote
# (Fiddle) target repo. Fiddle uses minute-level timestamps for branch names
# (e.g. fern-bot/2026-02-17T16-39Z) without a generator-specific prefix, so
# concurrent jobs can overwrite each other's branches and produce false parity
# failures. This can be removed once Fiddle includes the generator name in its
# branch naming (matching the local generation fix in PR #12331).
max-parallel: 1
matrix:
generator: ${{ fromJson(needs.determine-generator.outputs.generators) }}
steps:
- name: Checkout Repo
uses: actions/checkout@v4
with:
ref: ${{ inputs.branch || github.ref }}
- name: Install
uses: ./.github/actions/install
- name: Download Seed CLI
uses: actions/download-artifact@v4
with:
name: seed-cli
path: packages/seed/dist/
- name: Download Fern CLI
uses: actions/download-artifact@v4
with:
name: fern-cli
path: packages/cli/cli/dist/prod/
- name: Restore artifact permissions
run: chmod +x packages/cli/cli/dist/prod/cli.cjs packages/seed/dist/cli.cjs
- name: Run Seed Test Remote-Local (${{ matrix.generator }})
uses: nick-fields/retry@v3
with:
timeout_minutes: 30
max_attempts: 5
retry_wait_seconds: 120
command: pnpm seed test-remote-local --generator ${{ matrix.generator }} --output-mode github
env:
FERN_TOKEN: ${{ secrets.FERN_FERN_TOKEN }}
GITHUB_TOKEN: ${{ secrets.TEST_REMOTE_LOCAL_GITHUB_TOKEN }}