Skip to content

Commit 1c1895e

Browse files
committed
Fix Windows Bazel invocation in CI
1 parent 68d7269 commit 1c1895e

4 files changed

Lines changed: 47 additions & 25 deletions

File tree

.bazelrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ test:macos --test_env=PATH=/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:/usr/s
2929

3030
build:windows --cxxopt=/std:c++17
3131
build:windows --host_cxxopt=/std:c++17
32-
build:windows --client_env=BAZEL_CXXOPTS=/std:c++17
32+
build:windows --action_env=BAZEL_SH
33+
build:windows --repo_env=BAZEL_SH
3334
build:windows --enable_runfiles
3435
test:windows --test_env=PATH
3536

.github/workflows/release.yml

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ jobs:
117117
BAZEL_SH: C:/Program Files/Git/bin/bash.exe
118118
MSYS2_ARG_CONV_EXCL: "*"
119119
MSYS_NO_PATHCONV: "1"
120+
USE_BAZEL_VERSION: "8.6.0"
120121
steps:
121122
- name: Cancel previous run
122123
uses: styfle/cancel-workflow-action@0.11.0
@@ -138,7 +139,7 @@ jobs:
138139
with:
139140
python-version: ${{ matrix.python-version }}
140141
- name: Install Windows dependencies
141-
shell: bash
142+
shell: pwsh
142143
run: |
143144
choco install -y make ninja strawberryperl swig
144145
- name: Install Qt 5
@@ -148,24 +149,34 @@ jobs:
148149
arch: "win64_msvc2019_64"
149150
set-env: "true"
150151
- name: Export Qt location
151-
shell: bash
152+
shell: pwsh
152153
run: |
153-
echo "BAZEL_RULES_QT_DIR=${QT_ROOT_DIR}" >> "$GITHUB_ENV"
154+
Add-Content -Path $env:GITHUB_ENV -Value "BAZEL_RULES_QT_DIR=$env:QT_ROOT_DIR"
154155
- name: Install bazelisk
155-
shell: bash
156+
shell: pwsh
156157
run: |
157158
go install github.com/bazelbuild/bazelisk@latest
158-
echo "$HOME/go/bin" >> "$GITHUB_PATH"
159+
Add-Content -Path $env:GITHUB_PATH -Value (Join-Path $HOME "go/bin")
159160
- name: Build
160-
shell: bash
161+
shell: pwsh
161162
run: |
162-
rm -rf dist
163-
make RELEASE_PYTHON=${{ matrix.python-version }} bazel-release
164-
pip3 install dist/*.whl --force-reinstall
163+
Copy-Item third_party/pip_requirements/requirements-release-lock.txt third_party/pip_requirements/requirements.txt -Force
164+
Remove-Item dist -Recurse -Force -ErrorAction SilentlyContinue
165+
$releaseSetupTarget = "//:setup_py${{ replace(matrix.python-version, '.', '') }}"
166+
bazelisk run $releaseSetupTarget --config=release -- bdist_wheel
167+
New-Item -ItemType Directory -Force -Path dist | Out-Null
168+
Copy-Item "bazel-bin/$($releaseSetupTarget.Substring(3)).runfiles/envpool/dist/*.whl" dist/
169+
pip3 install (Get-ChildItem dist/*.whl | Select-Object -ExpandProperty FullName) --force-reinstall
165170
- name: Test
166-
shell: bash
171+
shell: pwsh
167172
run: |
168-
make release-test
173+
Push-Location envpool
174+
python3 make_test.py
175+
Pop-Location
176+
Push-Location examples
177+
python3 make_env.py
178+
python3 env_step.py
179+
Pop-Location
169180
- name: Upload artifact
170181
uses: actions/upload-artifact@v7
171182
with:

.github/workflows/test.yml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ jobs:
161161
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
162162
MSYS2_ARG_CONV_EXCL: "*"
163163
MSYS_NO_PATHCONV: "1"
164+
USE_BAZEL_VERSION: "8.6.0"
164165
steps:
165166
- name: Cancel previous run
166167
uses: styfle/cancel-workflow-action@0.11.0
@@ -190,7 +191,7 @@ jobs:
190191
pip-test-v1-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('third_party/pip_requirements/requirements-dev-lock.txt') }}-
191192
pip-test-v1-${{ runner.os }}-${{ runner.arch }}-
192193
- name: Install Windows dependencies
193-
shell: bash
194+
shell: pwsh
194195
run: |
195196
choco install -y make ninja strawberryperl swig
196197
- name: Install Qt 5
@@ -200,9 +201,9 @@ jobs:
200201
arch: "win64_msvc2019_64"
201202
set-env: "true"
202203
- name: Export Qt location
203-
shell: bash
204+
shell: pwsh
204205
run: |
205-
echo "BAZEL_RULES_QT_DIR=${QT_ROOT_DIR}" >> "$GITHUB_ENV"
206+
Add-Content -Path $env:GITHUB_ENV -Value "BAZEL_RULES_QT_DIR=$env:QT_ROOT_DIR"
206207
- name: Restore Bazel caches
207208
uses: actions/cache/restore@v4
208209
with:
@@ -215,16 +216,17 @@ jobs:
215216
bazel-test-v3-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.bazelversion') }}-${{ env.DEFAULT_BRANCH }}-
216217
bazel-test-v3-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.bazelversion') }}-
217218
- name: Install bazelisk
218-
shell: bash
219+
shell: pwsh
219220
run: |
220221
go install github.com/bazelbuild/bazelisk@latest
221-
echo "$HOME/go/bin" >> "$GITHUB_PATH"
222+
Add-Content -Path $env:GITHUB_PATH -Value (Join-Path $HOME "go/bin")
222223
- name: Test
223-
shell: bash
224+
shell: pwsh
224225
run: |
225-
repo_cache="$(cygpath -m "$HOME/.cache/envpool-bazel-repo")"
226-
disk_cache="$(cygpath -m "$HOME/.cache/envpool-bazel-disk")"
227-
make BAZELOPT="--repository_cache=${repo_cache} --disk_cache=${disk_cache}" bazel-test
226+
Copy-Item third_party/pip_requirements/requirements-dev-lock.txt third_party/pip_requirements/requirements.txt -Force
227+
$repoCache = Join-Path $HOME ".cache/envpool-bazel-repo"
228+
$diskCache = Join-Path $HOME ".cache/envpool-bazel-disk"
229+
bazelisk test --test_output=all --repository_cache=$repoCache --disk_cache=$diskCache //... --config=test --spawn_strategy=local --color=yes
228230
- name: Save Bazel caches
229231
if: ${{ always() && !cancelled() }}
230232
uses: actions/cache/save@v4

third_party/zlib/zlib.BUILD

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ package(default_visibility = ["//visibility:public"])
1818

1919
licenses(["notice"]) # BSD/MIT-like license (for zlib)
2020

21+
config_setting(
22+
name = "windows",
23+
values = {"cpu": "x64_windows"},
24+
)
25+
2126
cc_library(
2227
name = "zlib",
2328
srcs = [
@@ -48,9 +53,12 @@ cc_library(
4853
"zutil.h",
4954
],
5055
hdrs = ["zlib.h"],
51-
copts = [
52-
"-Wno-shift-negative-value",
53-
"-DZ_HAVE_UNISTD_H",
54-
],
56+
copts = select({
57+
":windows": [],
58+
"//conditions:default": [
59+
"-Wno-shift-negative-value",
60+
"-DZ_HAVE_UNISTD_H",
61+
],
62+
}),
5563
includes = ["."],
5664
)

0 commit comments

Comments
 (0)