Repository navigation
149 lines (144 loc) · 5.84 KB
/
Copy patheditor.yml
File metadata and controls
149 lines (144 loc) · 5.84 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
# The editor tools (spec/11 CP-8e): build the crate natively and as WebAssembly, run the language server's LSP tests on
# both the server and the extension's bundle, and package the VS Code extension (one .vsix for every platform) and the
# language server's npm package.
#
# Releases are by version (tooling/RELEASING.md), once the repository variable RELEASES is `on`. On main:
# - a version of tooling/rx-language-server that npm does not have is published there by trusted publishing (OIDC,
# no token), and tagged `language-server-v<version>`;
# - a version of tooling/vscode-rx without its tag `vscode-v<version>` is published to the VS Marketplace (a Microsoft
# Entra identity, or the secret VSCE_PAT) and Open VSX (the secret OVSX_PAT), and tagged.
# So a release is a version bump, merged.
name: editor
on:
push:
branches: [main]
paths: ["compiler/**", "tooling/**", ".github/workflows/editor.yml"]
pull_request:
paths: ["compiler/**", "tooling/**", ".github/workflows/editor.yml"]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown
- uses: Swatinem/rust-cache@v2
with:
workspaces: compiler
- uses: pnpm/action-setup@v4
with:
version: 11.1.1 # solid-next's packageManager
- uses: actions/setup-node@v5
with:
node-version: 22
- name: rxc and its WebAssembly build
run: |
cargo build --release --manifest-path compiler/Cargo.toml
cargo build --lib --release --target wasm32-unknown-unknown --manifest-path compiler/Cargo.toml
- name: Solid next (the types the tests check against)
run: sh ref/scripts/solid-next.sh && npm --prefix ref install
- name: Language server tests
working-directory: tooling/rx-language-server
run: |
npm ci
node test/run.js
RXC=$GITHUB_WORKSPACE/compiler/target/release/rxc node test/run.js
- name: Package the extension
working-directory: tooling/vscode-rx
run: |
npm ci
npm run package
SERVER=dist/server.js node ../rx-language-server/test/run.js
- name: Pack the language server
working-directory: tooling/rx-language-server
run: npm pack
- uses: actions/upload-artifact@v4
with:
name: vsix
path: tooling/vscode-rx/*.vsix
- uses: actions/upload-artifact@v4
with:
name: npm
path: tooling/rx-language-server/*.tgz
# which versions are new: run on main only, after the build passed
versions:
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && vars.RELEASES == 'on'
needs: build
runs-on: ubuntu-latest
outputs:
server: ${{ steps.v.outputs.server }}
vscode: ${{ steps.v.outputs.vscode }}
steps:
- uses: actions/checkout@v5
- id: v
run: |
s=$(node -p 'const p = require("./tooling/rx-language-server/package.json"); p.name + "@" + p.version')
if [ -z "$(npm view "$s" version 2>/dev/null)" ]; then echo "server=$s" >> "$GITHUB_OUTPUT"; fi
v=$(node -p 'require("./tooling/vscode-rx/package.json").version')
if [ -z "$(git ls-remote --tags origin "refs/tags/vscode-v$v")" ]; then echo "vscode=$v" >> "$GITHUB_OUTPUT"; fi
publish-npm:
needs: versions
if: needs.versions.outputs.server != ''
runs-on: ubuntu-latest
environment: release
permissions:
id-token: write # trusted publishing: npm takes the job's OIDC token, and adds provenance
contents: write # the tag
steps:
- uses: actions/checkout@v5
- uses: actions/download-artifact@v4
with:
name: npm
- uses: actions/setup-node@v5
with:
node-version: 22
registry-url: https://registry.npmjs.org
- run: npm install -g npm@latest # trusted publishing needs npm 11.5.1 or later
- run: npm publish ./*.tgz --access public
- name: Tag
run: |
t="language-server-v${SERVER##*@}"
git tag "$t" && git push origin "$t"
env:
SERVER: ${{ needs.versions.outputs.server }}
publish-vscode:
needs: versions
if: needs.versions.outputs.vscode != ''
runs-on: ubuntu-latest
environment: release
permissions:
id-token: write # the Marketplace by Microsoft Entra, when AZURE_CLIENT_ID is set
contents: write # the tag
env: # job-wide, so that a step's `if` can see whether each is set
VSCE_PAT: ${{ secrets.VSCE_PAT }}
OVSX_PAT: ${{ secrets.OVSX_PAT }}
steps:
- uses: actions/checkout@v5
- uses: actions/download-artifact@v4
with:
name: vsix
- uses: actions/setup-node@v5
with:
node-version: 22
# the Marketplace takes a Microsoft Entra identity (no token) when the repository has AZURE_CLIENT_ID and
# AZURE_TENANT_ID, else the secret VSCE_PAT (an Azure DevOps token: global ones end 2026-12-01)
- name: Sign in to Microsoft Entra (OIDC)
if: vars.AZURE_CLIENT_ID != ''
uses: azure/login@v2
with:
client-id: ${{ vars.AZURE_CLIENT_ID }}
tenant-id: ${{ vars.AZURE_TENANT_ID }}
allow-no-subscriptions: true
- name: VS Marketplace
if: vars.AZURE_CLIENT_ID != '' || env.VSCE_PAT != ''
run: npx --yes @vscode/vsce publish --packagePath ./*.vsix ${{ vars.AZURE_CLIENT_ID != '' && '--azure-credential' || '' }}
- name: Open VSX
if: env.OVSX_PAT != ''
run: npx --yes ovsx publish ./*.vsix -p "$OVSX_PAT"
- name: Tag
if: vars.AZURE_CLIENT_ID != '' || env.VSCE_PAT != '' || env.OVSX_PAT != ''
run: git tag "vscode-v$V" && git push origin "vscode-v$V"
env:
V: ${{ needs.versions.outputs.vscode }}