Skip to content

Commit c22f408

Browse files
committed
build(repo): fix broken Windows workflow
1 parent 91fdded commit c22f408

File tree

1 file changed

+40
-20
lines changed

1 file changed

+40
-20
lines changed

.circleci/config.yml

+40-20
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
version: 2.1
22

33
orbs:
4-
windows: circleci/windows@2.4.1
4+
windows: circleci/windows@5.0
55

66
executors:
77
linux:
@@ -23,7 +23,7 @@ defaults:
2323
- "12.22"
2424
- "14.21"
2525
- &node-maintenance-lts "16.20"
26-
- &node-active-lts "18.17"
26+
- &node-active-lts "18.18"
2727
- &node-current "20.5"
2828
pkg-cache-path: &pkg-cache-path /tmp/pkg-node-binaries
2929
ldid-version: &ldid-version 2.1.5-procursus7 # https://github.com/ProcursusTeam/ldid
@@ -76,23 +76,38 @@ commands:
7676
name: Restore pkg cache
7777
keys:
7878
- &pkg-cache-key pkg-cache-<< parameters.targets >>-<< parameters.node-version >>
79-
- run:
80-
name: Create the Spectral Binary
81-
environment:
82-
PKG_CACHE_PATH: *pkg-cache-path
83-
command: |
84-
NODE_VERSION=$(echo "<< parameters.node-version >>" | awk -F "." '{ print $1 }')
85-
TARGETS=$(echo "<< parameters.targets >>" | awk -v node_version="$NODE_VERSION" -F "," '{for (i=1;i<=NF;i++) printf "node" node_version "-" $i "," }' | sed "s/,$/\n/")
86-
export ARCH=$(echo << parameters.targets >> | awk 'match($0, /-(arm64|x64)/){ print substr($0, RSTART+1, RLENGTH-1) }')
87-
88-
if [ "<< parameters.bytecode >>" = true ]
89-
then
90-
yarn workspace @stoplight/spectral-cli pkg . --public --public-packages "*" --targets $TARGETS --output binaries/spectral
91-
else
92-
yarn workspace @stoplight/spectral-cli pkg . --no-bytecode --public --public-packages "*" --targets $TARGETS --output binaries/spectral
93-
fi
94-
95-
(cd packages/cli/binaries && ls . | sed -n -E 's/^(spectral)-(alpine|linux|macos)$/mv "\1-\2" "\1-\2"-$ARCH/p' | sh)
79+
- when:
80+
condition: &is-windows
81+
equal:
82+
- windows
83+
- << parameters.targets >>
84+
steps:
85+
- run:
86+
name: Create the Spectral Binary
87+
environment:
88+
PKG_CACHE_PATH: *pkg-cache-path
89+
command: |
90+
yarn workspace @stoplight/spectral-cli pkg . --public --public-packages "*" --targets node<< parameters.node-version >>-windows --output binaries/spectral
91+
- unless:
92+
condition: *is-windows
93+
steps:
94+
- run:
95+
name: Create the Spectral Binary
96+
environment:
97+
PKG_CACHE_PATH: *pkg-cache-path
98+
command: |
99+
NODE_VERSION=$(echo "<< parameters.node-version >>" | awk -F "." '{ print $1 }')
100+
TARGETS=$(echo "<< parameters.targets >>" | awk -v node_version="$NODE_VERSION" -F "," '{for (i=1;i<=NF;i++) printf "node" node_version "-" $i "," }' | sed "s/,$/\n/")
101+
export ARCH=$(echo << parameters.targets >> | awk 'match($0, /-(arm64|x64)/){ print substr($0, RSTART+1, RLENGTH-1) }')
102+
103+
if [ "<< parameters.bytecode >>" = true ]
104+
then
105+
yarn workspace @stoplight/spectral-cli pkg . --public --public-packages "*" --targets $TARGETS --output binaries/spectral
106+
else
107+
yarn workspace @stoplight/spectral-cli pkg . --no-bytecode --public --public-packages "*" --targets $TARGETS --output binaries/spectral
108+
fi
109+
110+
(cd packages/cli/binaries && ls . | sed -n -E 's/^(spectral)-(alpine|linux|macos)$/mv "\1-\2" "\1-\2"-$ARCH/p' | sh)
96111
- save_cache:
97112
name: Retain pkg cache
98113
key: *pkg-cache-key
@@ -264,13 +279,18 @@ jobs:
264279
name: windows/default
265280
steps:
266281
- checkout
282+
- run:
283+
name: Enable Corepack
284+
command: |
285+
npm install -g corepack
286+
corepack enable
267287
- cached-dependencies
268288
- build
269289
- test-node:
270290
max-workers: 3
271291
- test-harness:
272292
os: windows
273-
node-version: current
293+
node-version: *node-active-lts
274294
max-workers: 3
275295

276296
build-nix-binaries:

0 commit comments

Comments
 (0)