Skip to content

Commit 6510089

Browse files
robertoaloifacebook-github-bot
authored andcommitted
Add Windows pipeline (excluding tests for now)
Summary: Given preliminary Windows support was introduced via #111, it sounds reasonable to add a Windows pipeline to CI. Tests are currently omitted, since failing. The next step would be to figure out why. The pipeline could use some refactoring, which can be done separately. Reviewed By: TD5 Differential Revision: D80716715 fbshipit-source-id: c07eb94e94efa2079880c0507e255ec659a1904d
1 parent bde703d commit 6510089

File tree

1 file changed

+122
-24
lines changed

1 file changed

+122
-24
lines changed

.github/workflows/ci.yml

Lines changed: 122 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,27 @@ on:
33
push: {}
44
release:
55
types: [published]
6-
env:
7-
EQWALIZER_DIR: ${{ github.workspace }}/eqwalizer/eqwalizer
8-
ELP_EQWALIZER_PATH: ${{ github.workspace }}/eqwalizer/eqwalizer/eqwalizer
96

107
jobs:
118
ci:
129
strategy:
1310
fail-fast: false
1411
matrix:
15-
platform-arch: [ubuntu-22.04-x64, ubuntu-22.04-arm, macos-13-x64, macos-latest-arm]
12+
platform-arch: [ubuntu-22.04-x64, ubuntu-22.04-arm, macos-13-x64, macos-latest-arm, windows-latest-x64]
1613
otp-version: [26.2, 27.3, 28.0]
1714
include:
1815
- otp-version: 26.2
1916
brew-otp-version: 26
2017
vscode-publish: true
18+
choco-otp-version: 26.2.5.13
2119
- otp-version: 27.3
2220
brew-otp-version: 27
2321
vscode-publish: false
22+
choco-otp-version: 27.3.4
2423
- otp-version: 28.0
2524
brew-otp-version: 28
2625
vscode-publish: false
26+
choco-otp-version: 28.0.1
2727
- platform-arch: ubuntu-22.04-x64
2828
platform: ubuntu-22.04
2929
os: linux
@@ -44,6 +44,11 @@ jobs:
4444
os: macos
4545
target: aarch64-apple-darwin
4646
vscode-target: darwin-arm64
47+
- platform-arch: windows-latest-x64
48+
platform: windows-latest
49+
os: windows
50+
target: x86_64-pc-windows-msvc
51+
vscode-target: win32-x64
4752
runs-on: ${{ matrix.platform }}
4853
steps:
4954
- name: Checkout erlang-language-platform
@@ -73,8 +78,8 @@ jobs:
7378
run: |
7479
sudo apt-get update
7580
sudo apt-get install -y crossbuild-essential-arm64
76-
- name: Install Erlang/OTP (Linux Only)
77-
if: matrix.os == 'linux'
81+
- name: Install Erlang/OTP (Linux, Windows)
82+
if: matrix.os == 'linux' || matrix.os == 'windows'
7883
uses: erlef/setup-beam@v1
7984
with:
8085
otp-version: ${{ matrix.otp-version }}
@@ -92,38 +97,101 @@ jobs:
9297
run: erl -eval 'erlang:display(erlang:system_info(otp_release)), halt().' -noshell
9398
- name: Install rebar3
9499
run: "mkdir rebar3 && curl https://s3.amazonaws.com/rebar3/rebar3 -o rebar3/rebar3 && chmod +x rebar3/rebar3"
95-
- name: Add rebar3 to path
100+
- name: Create rebar3.cmd (Windows Only)
101+
if: matrix.os == 'windows'
102+
working-directory: rebar3
103+
run: |
104+
echo '@echo off' > rebar3.cmd
105+
echo 'setlocal' >> rebar3.cmd
106+
echo 'set rebarscript=%~f0' >> rebar3.cmd
107+
echo 'escript.exe "%rebarscript:.cmd=%" %*' >> rebar3.cmd
108+
- name: Add rebar3 to path (No Windows)
109+
if: matrix.os != 'windows'
96110
run: 'echo "$GITHUB_WORKSPACE/rebar3" >> $GITHUB_PATH'
97-
- name: Verify rebar3 version
111+
- name: Add rebar3 to path (Windows Only)
112+
if: matrix.os == 'windows'
113+
run: '"$env:GITHUB_WORKSPACE\rebar3" | Out-File -FilePath "$env:GITHUB_PATH" -Append'
114+
- name: Verify rebar3 version (No Windows)
115+
if: matrix.os != 'windows'
98116
run: rebar3 version
99-
- name: Assemble eqwalizer.jar
117+
- name: Verify rebar3 version (Windows Only)
118+
if: matrix.os == 'windows'
119+
run: rebar3.cmd version
120+
- name: Assemble eqwalizer.jar (No Windows)
121+
if: matrix.os != 'windows'
100122
working-directory: eqwalizer/eqwalizer
101123
run: "sbt assembly"
102-
- name: Assemble eqwalizer binary
124+
- name: Assemble eqwalizer.jar (Windows Only)
125+
if: matrix.os == 'windows'
126+
working-directory: eqwalizer\eqwalizer
127+
run: "sbt assembly"
128+
shell: bash
129+
- name: Assemble eqwalizer binary (No Windows)
130+
if: matrix.os != 'windows'
103131
working-directory: eqwalizer/eqwalizer
104132
run: 'native-image -H:IncludeResources=application.conf --no-server --no-fallback -jar target/scala-3.6.4/eqwalizer.jar eqwalizer'
133+
- name: Assemble eqwalizer binary (Windows Only)
134+
if: matrix.os == 'windows'
135+
working-directory: eqwalizer\eqwalizer
136+
run: 'native-image -H:IncludeResources=application.conf --no-server --no-fallback -jar target\scala-3.6.4\eqwalizer.jar eqwalizer'
105137
- name: Ensure elp is formatted
106138
run: 'cargo fmt -- --check'
139+
- name: Configure Environment (No Windows)
140+
if: matrix.os != 'windows'
141+
run: |
142+
echo "EQWALIZER_DIR=${{ github.workspace }}/eqwalizer/eqwalizer" >> $GITHUB_ENV
143+
echo "ELP_EQWALIZER_PATH=${{ github.workspace }}/eqwalizer/eqwalizer/eqwalizer" >> $GITHUB_ENV
144+
- name: Configure Environment (Windows Only)
145+
if: matrix.os == 'windows'
146+
run: |
147+
echo "EQWALIZER_DIR=${{ github.workspace }}\eqwalizer\eqwalizer" >> $env:GITHUB_ENV
148+
echo "ELP_EQWALIZER_PATH=${{ github.workspace }}\eqwalizer\eqwalizer\eqwalizer.exe" >> $env:GITHUB_ENV
107149
- name: Test elp
108-
# Do not run the tests in case of cross-compilation
109-
if: matrix.platform-arch != 'macos-latest-arm'
150+
# Do not run the tests in case of cross-compilation or on Windows
151+
if: matrix.platform-arch != 'macos-latest-arm' && matrix.os != 'windows'
110152
run: 'cargo test --no-default-features --workspace --target ${{ matrix.target }}'
111-
- name: Build elp
153+
- name: Build elp (No Windows)
154+
if: matrix.os != 'windows'
112155
run: 'cargo build --release --target ${{ matrix.target }} --config target.aarch64-unknown-linux-gnu.linker=\"aarch64-linux-gnu-gcc\"'
113-
- name: Add elp to path
156+
- name: Build elp (Windows Only)
157+
if: matrix.os == 'windows'
158+
run: 'cargo build --release --target ${{ matrix.target }}'
159+
- name: Add elp to path (No Windows)
160+
if: matrix.os != 'windows'
114161
run: 'echo "$GITHUB_WORKSPACE/target/${{ matrix.target}}/release" >> $GITHUB_PATH'
115-
- name: Upload elp binary
162+
- name: Add elp to path (Windows Only)
163+
if: matrix.os == 'windows'
164+
run: '"$env:GITHUB_WORKSPACE\target\${{ matrix.target }}\release" | Out-File -FilePath "$env:GITHUB_PATH" -Append'
165+
- name: Upload elp binary (No Windows)
166+
if: matrix.os != 'windows'
116167
uses: "actions/upload-artifact@v4"
117168
with:
118169
name: elp-${{ matrix.os }}-${{ matrix.target }}-otp-${{ matrix.otp-version }}
119-
path: target/${{ matrix.target}}/release/elp
120-
- name: Upload eqwalizer native binary
170+
path: target/${{ matrix.target }}/release/elp
171+
- name: Upload elp binary (Windows Only)
172+
if: matrix.os == 'windows'
173+
uses: "actions/upload-artifact@v4"
174+
with:
175+
name: elp-${{ matrix.os }}-${{ matrix.target }}-otp-${{ matrix.otp-version }}
176+
path: target\${{ matrix.target }}\release\elp.exe
177+
- name: Upload eqwalizer native binary (No Windows)
178+
if: matrix.os != 'windows'
121179
uses: "actions/upload-artifact@v4"
122180
with:
123181
name: eqwalizer-${{ matrix.os }}-${{ matrix.target }}-otp-${{ matrix.otp-version }}
124182
path: ./eqwalizer/eqwalizer/eqwalizer
125-
- name: Make elp-${{ matrix.os }}-otp-${{ matrix.otp-version }}.tar.gz
183+
- name: Upload eqwalizer native binary (Windows Only)
184+
if: matrix.os == 'windows'
185+
uses: "actions/upload-artifact@v4"
186+
with:
187+
name: eqwalizer-${{ matrix.os }}-${{ matrix.target }}-otp-${{ matrix.otp-version }}
188+
path: .\eqwalizer\eqwalizer\eqwalizer.exe
189+
- name: Make elp-${{ matrix.os }}-otp-${{ matrix.otp-version }}.tar.gz (No Windows)
190+
if: matrix.os != 'windows'
126191
run: 'tar -zcvf elp-${{ matrix.os }}-otp-${{ matrix.otp-version }}.tar.gz -C target/${{ matrix.target}}/release/ elp'
192+
- name: Make elp-${{ matrix.os }}-otp-${{ matrix.otp-version }}.tar.gz (Windows Only)
193+
if: matrix.os == 'windows'
194+
run: 'tar -zcvf elp-${{ matrix.os }}-otp-${{ matrix.otp-version }}.tar.gz -C target\${{ matrix.target}}\release elp.exe'
127195
- env:
128196
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
129197
id: get_release_url
@@ -146,12 +214,25 @@ jobs:
146214
node-version: 20
147215
- name: Install VSCE
148216
run: npm install -g vsce
149-
- name: Prepare VS Code Extension to host binaries
217+
- name: Prepare VS Code Extension to host binaries (No Windows)
218+
if: matrix.os != 'windows'
150219
run: mkdir -p editors/code/bin
151-
- name: Package eqWAlizer binary into VS Code Extension
220+
- name: Prepare VS Code Extension to host binaries (Windows Only)
221+
if: matrix.os == 'windows'
222+
run: if not exist "editors\code\bin" mkdir "editors\code\bin"
223+
shell: cmd
224+
- name: Package eqWAlizer binary into VS Code Extension (No Windows)
225+
if: matrix.os != 'windows'
152226
run: cp eqwalizer/eqwalizer/eqwalizer editors/code/bin
153-
- name: Package ELP binary into VS Code Extension
227+
- name: Package eqWAlizer binary into VS Code Extension (Windows Only)
228+
if: matrix.os == 'windows'
229+
run: cp eqwalizer\eqwalizer\eqwalizer.exe editors\code\bin
230+
- name: Package ELP binary into VS Code Extension (No Windows)
231+
if: matrix.os != 'windows'
154232
run: cp target/${{ matrix.target}}/release/elp editors/code/bin
233+
- name: Package ELP binary into VS Code Extension (Windows Only)
234+
if: matrix.os == 'windows'
235+
run: cp target\${{ matrix.target}}\release\elp.exe editors\code\bin
155236
- name: Ensure binaries are executable
156237
run: chmod +x editors/code/bin/*
157238
- name: npm install
@@ -166,21 +247,38 @@ jobs:
166247
- name: Rename Package
167248
working-directory: editors/code
168249
run: mv erlang-language-platform-*.vsix erlang-language-platform.vsix
169-
- name: Upload Extension
250+
- name: Upload Extension (No Windows)
251+
if: matrix.os != 'windows'
170252
uses: "actions/upload-artifact@v4"
171253
with:
172254
name: elp-${{ matrix.os}}-${{ matrix.target }}-otp-${{ matrix.otp-version }}.vsix
173255
path: editors/code/erlang-language-platform.vsix
256+
- name: Upload Extension (Windows Only)
257+
if: matrix.os == 'windows'
258+
uses: "actions/upload-artifact@v4"
259+
with:
260+
name: elp-${{ matrix.os}}-${{ matrix.target }}-otp-${{ matrix.otp-version }}.vsix
261+
path: editors\code\erlang-language-platform.vsix
174262
- env:
175263
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
176-
name: Upload Extension Package
177-
if: ${{ github.event_name == 'release' }}
264+
name: Upload Extension Package (No Windows)
265+
if: ${{ github.event_name == 'release' && matrix.os != 'windows' }}
178266
uses: "actions/[email protected]"
179267
with:
180268
asset_content_type: application/octet-stream
181269
asset_name: elp-${{ matrix.os }}-${{ matrix.target }}-otp-${{ matrix.otp-version }}.vsix
182270
asset_path: editors/code/erlang-language-platform.vsix
183271
upload_url: "${{ steps.get_release_url.outputs.upload_url }}"
272+
- env:
273+
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
274+
name: Upload Extension Package (Windows Only)
275+
if: ${{ github.event_name == 'release' && matrix.os == 'windows' }}
276+
uses: "actions/[email protected]"
277+
with:
278+
asset_content_type: application/octet-stream
279+
asset_name: elp-${{ matrix.os }}-${{ matrix.target }}-otp-${{ matrix.otp-version }}.vsix
280+
asset_path: editors\code\erlang-language-platform.vsix
281+
upload_url: "${{ steps.get_release_url.outputs.upload_url }}"
184282
- name: Publish extension to marketplace
185283
working-directory: editors/code
186284
if: ${{ github.event_name == 'release' && matrix.vscode-publish }}

0 commit comments

Comments
 (0)