Skip to content

Commit 7e8f1eb

Browse files
committed
Windows set-export / unpack-artifact scripts
1 parent faf4a00 commit 7e8f1eb

File tree

4 files changed

+25
-1
lines changed

4 files changed

+25
-1
lines changed

.github/scripts/extract_matrix.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414

1515
DEFAULT_ENV = {
1616
"CI": "true",
17-
"GITHUB_CI": "true",
1817
"PYTHONIOENCODING": "utf-8",
18+
"GITHUB_CI": "true"
1919
}
2020

2121

@@ -123,11 +123,19 @@ def python_packages(self) -> list[str]:
123123
def get_download_steps(self, key: str, version: str) -> str:
124124
download_link = self.get_download_link(key, version)
125125
filename = download_link.split('/')[-1]
126+
127+
if self.runs_on == "windows-latest":
128+
return (f"""Invoke-WebRequest -Uri {download_link} -OutFile {filename}
129+
$dirname = (& tar -tzf {filename} | Select-Object -First 1).Split('/')[0]
130+
tar -xzf {filename}
131+
Add-Content $env:GITHUB_ENV "{key}=$(Resolve-Path $dirname)""")
132+
126133
return (f"wget -q {download_link} && "
127134
f"dirname=$(tar -tzf {filename} | head -1 | cut -f1 -d '/') && "
128135
f"tar -xzf {filename} && "
129136
f'echo {key}=$(realpath "$dirname") >> $GITHUB_ENV')
130137

138+
131139
def get_download_link(self, key: str, version: str) -> str:
132140
os, arch = OSS[self.runs_on]
133141
major_version = version.split(".")[0]

.github/scripts/set-export.cmd

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
@echo off
2+
setlocal
3+
4+
set "VAR_NAME=%1"
5+
set "ARTIFACT_PATH=%2"
6+
7+
call set "REAL_PATH=%ARTIFACT_PATH%"
8+
9+
if exist "%REAL_PATH%\" (
10+
set "%VAR_NAME%=%REAL_PATH%"
11+
echo %VAR_NAME%=%REAL_PATH%>>"%GITHUB_ENV%"
12+
)
13+
14+
endlocal

.github/workflows/ci-matrix-gen.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ jobs:
194194
working-directory: main
195195
if: ${{ matrix.run_steps && runner.os != 'Windows' }}
196196
run: |
197+
env
197198
${{ matrix.run_steps }}
198199
- name: Run on Windows
199200
if: ${{ matrix.run_steps && runner.os == 'Windows' }}

mx.graalpython/mx_graalpython.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -826,6 +826,7 @@ def graalpy_standalone_home(standalone_type, enterprise=False, dev=False, build=
826826

827827
mx_args = ['-p', SUITE.dir, *(['--env', env_file] if env_file else [])]
828828

829+
print(f"[DEBUG] GITHUB_CI env: {os.environ.get('GITHUB_CI')}")
829830
if os.environ.get("GITHUB_CI"):
830831
print("[DEBUG] Running in GitHub Ci")
831832
mx_args.append("--extra-image-builder-argument=-Ob")

0 commit comments

Comments
 (0)