|
1 | 1 | version: 2.1 |
2 | 2 |
|
3 | 3 | orbs: |
4 | | - windows: circleci/windows@2.4.1 |
| 4 | + windows: circleci/windows@5.0 |
5 | 5 |
|
6 | 6 | executors: |
7 | 7 | linux: |
@@ -76,23 +76,38 @@ commands: |
76 | 76 | name: Restore pkg cache |
77 | 77 | keys: |
78 | 78 | - &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) |
96 | 111 | - save_cache: |
97 | 112 | name: Retain pkg cache |
98 | 113 | key: *pkg-cache-key |
@@ -264,13 +279,18 @@ jobs: |
264 | 279 | name: windows/default |
265 | 280 | steps: |
266 | 281 | - checkout |
| 282 | + - run: |
| 283 | + name: Enable Corepack |
| 284 | + command: | |
| 285 | + npm install -g corepack |
| 286 | + corepack enable |
267 | 287 | - cached-dependencies |
268 | 288 | - build |
269 | 289 | - test-node: |
270 | 290 | max-workers: 3 |
271 | 291 | - test-harness: |
272 | 292 | os: windows |
273 | | - node-version: current |
| 293 | + node-version: *node-active-lts |
274 | 294 | max-workers: 3 |
275 | 295 |
|
276 | 296 | build-nix-binaries: |
|
0 commit comments