Skip to content

Commit a96facc

Browse files
chore: fail-safe update CDDL action (#3518)
Until Permissions and Bluetooth fixes are merged, move the task to a dedicated action. * w3c/permissions#464 * WebBluetoothCG/web-bluetooth#659 Another option would be tolerating exception during CDDL update, but that would mask the issues.
1 parent f74d512 commit a96facc

File tree

1 file changed

+64
-16
lines changed

1 file changed

+64
-16
lines changed

.github/workflows/update-bidi-types.yml

Lines changed: 64 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,28 +23,20 @@ on:
2323
type: string
2424

2525
jobs:
26-
build:
27-
name: Build WebDriverBiDi types
26+
build_main_spec:
27+
name: Build main spec cddl types
2828
runs-on: ubuntu-latest
2929
steps:
30+
- name: Install dependencies
31+
run: |
32+
cargo install [email protected];
33+
npm install parse5
3034
- name: Check out the main spec repository
3135
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
3236
with:
3337
repository: ${{ github.event.inputs.repository || 'w3c/webdriver-bidi' }}
3438
ref: ${{ github.event.inputs.source_ref || 'main' }}
3539
path: webdriver-bidi
36-
- name: Check out w3c/permissions spec repository
37-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
38-
with:
39-
repository: w3c/permissions
40-
ref: main
41-
path: permissions
42-
- name: Check out w3c/permissions spec repository
43-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
44-
with:
45-
repository: WebBluetoothCG/web-bluetooth
46-
ref: main
47-
path: web-bluetooth
4840
- name: Generate WebDriverBidi CDDL
4941
run: ./scripts/test.sh
5042
working-directory: webdriver-bidi
@@ -53,6 +45,27 @@ jobs:
5345
with:
5446
name: all-cddl
5547
path: webdriver-bidi/all.cddl
48+
49+
build_permissions:
50+
name: Build Permissions CDDL
51+
runs-on: ubuntu-latest
52+
steps:
53+
- name: Install dependencies
54+
run: |
55+
cargo install [email protected];
56+
npm install parse5
57+
- name: Check out the main spec repository
58+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
59+
with:
60+
repository: ${{ github.event.inputs.repository || 'w3c/webdriver-bidi' }}
61+
ref: ${{ github.event.inputs.source_ref || 'main' }}
62+
path: webdriver-bidi
63+
- name: Check out w3c/permissions spec repository
64+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
65+
with:
66+
repository: w3c/permissions
67+
ref: main
68+
path: permissions
5669
- name: Generate WebDriverBidi CDDL for Permissions
5770
run: ../webdriver-bidi/scripts/cddl/generate.js ./index.html && mv all.cddl permissions.cddl
5871
working-directory: permissions
@@ -61,18 +74,41 @@ jobs:
6174
with:
6275
name: permissions-cddl
6376
path: permissions/permissions.cddl
77+
78+
build_bluetooth_cddl:
79+
name: Build Bluetooth CDDL
80+
runs-on: ubuntu-latest
81+
steps:
82+
- name: Install dependencies
83+
run: |
84+
cargo install [email protected];
85+
npm install parse5
86+
- name: Check out the main spec repository
87+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
88+
with:
89+
repository: ${{ github.event.inputs.repository || 'w3c/webdriver-bidi' }}
90+
ref: ${{ github.event.inputs.source_ref || 'main' }}
91+
path: webdriver-bidi
92+
- name: Check out WebBluetoothCG/web-bluetooth spec repository
93+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
94+
with:
95+
repository: WebBluetoothCG/web-bluetooth
96+
ref: main
97+
path: web-bluetooth
6498
- name: Generate WebDriverBidi CDDL for web-bluetooth
6599
run: ../webdriver-bidi/scripts/cddl/generate.js ./index.bs && mv all.cddl web-bluetooth.cddl
66100
working-directory: web-bluetooth
67-
- name: Upload WebDriverBidi CDDL for Permissions
101+
- name: Upload WebDriverBidi CDDL for web-bluetooth
68102
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
69103
with:
70104
name: web-bluetooth-cddl
71105
path: web-bluetooth/web-bluetooth.cddl
72106

73107
pr:
74108
name: Send PR
75-
needs: build
109+
needs: [build_main_spec, build_permissions, build_bluetooth_cddl]
110+
# Run even if some CDDL's are not built.
111+
if: always()
76112
runs-on: ubuntu-latest
77113
steps:
78114
- name: Check out mapper repository
@@ -100,20 +136,32 @@ jobs:
100136
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
101137
with:
102138
name: all-cddl
139+
# Tolerate missing files.
140+
continue-on-error: true
103141
- name: Download WebDriverBidi CDDL for Permissions
104142
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
105143
with:
106144
name: permissions-cddl
145+
# Tolerate missing files.
146+
continue-on-error: true
107147
- name: Download WebDriverBidi CDDL for web-bluetooth
108148
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
109149
with:
110150
name: web-bluetooth-cddl
151+
# Tolerate missing files.
152+
continue-on-error: true
111153
- name: Generate TypeScript types for the main spec
112154
run: node tools/generate-bidi-types.mjs --cddl-file all.cddl
155+
# Tolerate errors during generating types.
156+
continue-on-error: true
113157
- name: Generate TypeScript types for Permissions spec
114158
run: node tools/generate-bidi-types.mjs --cddl-file permissions.cddl --ts-file src/protocol/generated/webdriver-bidi-permissions.ts --zod-file src/protocol-parser/generated/webdriver-bidi-permissions.ts
159+
# Tolerate errors during generating types.
160+
continue-on-error: true
115161
- name: Generate TypeScript types for web-bluetooth spec
116162
run: node tools/generate-bidi-types.mjs --cddl-file web-bluetooth.cddl --ts-file src/protocol/generated/webdriver-bidi-bluetooth.ts --zod-file src/protocol-parser/generated/webdriver-bidi-bluetooth.ts
163+
# Tolerate errors during generating types.
164+
continue-on-error: true
117165
- run: git diff
118166
# Needed for `npm run format`.
119167
- run: python -m pip install pre-commit

0 commit comments

Comments
 (0)