Skip to content

Commit 822cfca

Browse files
committed
Construct download links using string format + Disable linux aarch64 jobs
1 parent 605ec88 commit 822cfca

File tree

4 files changed

+28
-39
lines changed

4 files changed

+28
-39
lines changed

.github/scripts/extract_matrix.py

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,11 @@
3030

3131
# Python 3.8.10 (matrix.python_version) is not available for linux aarch64
3232
# cf. https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json
33-
"python-svm-build-gate-linux-aarch64"
33+
"linux-aarch64"
3434
)
3535

36-
# TODO build link using self.runs_on
3736
DOWNLOADS_LINKS = {
38-
"GRADLE_JAVA_HOME": {
39-
"https://download.oracle.com/java/21/latest/jdk-21_linux-x64_bin.tar.gz": ["linux", "amd64"],
40-
"https://download.oracle.com/java/21/latest/jdk-21_linux-aarch64_bin.tar.gz": ["linux", "aarch64"],
41-
"https://download.oracle.com/java/21/latest/jdk-21_macos-aarch64_bin.tar.gz": ["darwin", "aarch64"],
42-
"https://download.oracle.com/java/21/latest/jdk-21_windows-x64_bin.zip": ["windows", "amd64"],
43-
}
37+
"GRADLE_JAVA_HOME": "https://download.oracle.com/java/{major_version}/latest/jdk-{major_version}_{os}-{arch_short}_bin{ext}"
4438
}
4539

4640
# Gitlab Runners OSS
@@ -125,30 +119,38 @@ def python_packages(self) -> list[str]:
125119
python_packages.append(f"'{k[4:]}{v}'" if self.runs_on != "windows-latest" else f"{k[4:]}{v}")
126120
return python_packages
127121

128-
def get_download_steps(self, key: str) -> str:
129-
download_link = self.get_download_link(key)
122+
def get_download_steps(self, key: str, version: str) -> str:
123+
download_link = self.get_download_link(key, version)
130124
filename = download_link.split('/')[-1]
131125
return (f"wget -q {download_link} && "
132126
f"dirname=$(tar -tzf {filename} | head -1 | cut -f1 -d '/') && "
133127
f"tar -xzf {filename} && "
134128
f'echo {key}=$(realpath "$dirname") >> $GITHUB_ENV')
135129

136-
def get_download_link(self, key) -> str:
137-
os_pair = OSS[self.runs_on]
138-
oss_links = DOWNLOADS_LINKS[key]
130+
def get_download_link(self, key: str, version: str) -> str:
131+
os, arch = OSS[self.runs_on]
132+
major_version = version.split(".")[0]
133+
extension = ".tar.gz" if not os == "windows" else ".zip"
134+
os = os if os != "darwin" else "macos"
135+
arch_short = {"amd64": "x64", "aarch64": "aarch64"}[arch]
136+
137+
vars = {
138+
"major_version": major_version,
139+
"os":os,
140+
"arch": arch,
141+
"arch_short": arch_short,
142+
"ext": extension,
143+
}
139144

140-
for k, v in oss_links.items():
141-
if os_pair == v: return k
142-
143-
return ""
145+
return DOWNLOADS_LINKS[key].format(**vars)
144146

145147
@cached_property
146148
def downloads(self) -> list[str]:
147149
downloads = []
148-
for k, v in self.job.get("downloads", {}).items():
149-
if k in DOWNLOADS_LINKS:
150-
downloads.append(self.get_download_steps(k))
151-
#print(f"[DEBUG] {k}, {downloads}")
150+
for k, download_info in self.job.get("downloads", {}).items():
151+
if k in DOWNLOADS_LINKS and download_info["version"]:
152+
downloads.append(self.get_download_steps(k, download_info["version"]))
153+
152154
return downloads
153155

154156
@staticmethod

.github/scripts/set-export

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,9 @@
22

33
VAR_NAME="$1"
44
ARTIFACT_PATH="$2"
5-
65
REAL_PATH=$(eval echo $ARTIFACT_PATH)
76

87
if [ -d "$REAL_PATH" ]; then
9-
108
export "$VAR_NAME"="$REAL_PATH"
11-
echo "$REAL_PATH"
129
echo "$VAR_NAME"="$REAL_PATH" >> "$GITHUB_ENV"
13-
14-
which python
15-
python --version
16-
echo $PATH
17-
ls -l mxbuild/linux-amd64/GRAALPY_NATIVE_STANDALONE/ || true
1810
fi

.github/scripts/unpack-artifact

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,6 @@ if [ -n "$1" ]; then
55
to_extract="${ARTIFACT_PATH_PREFIX}/${1}.tar"
66
fi
77

8-
echo "pwd && ls"
9-
pwd && ls
10-
11-
echo "ls .."
12-
ls ..
13-
14-
158
for i in $to_extract; do
169
if [ -f "$i" ]; then
1710
tar -x -f "$i" -C "${ARTIFACT_PATH_PREFIX}" -v
@@ -21,6 +14,4 @@ for i in $to_extract; do
2114
ls "${ARTIFACT_PATH_PREFIX}"
2215
fi
2316

24-
done
25-
26-
pwd && ls ..
17+
done

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,10 @@ jobs:
186186
if: ${{ matrix.setup_steps }}
187187
run: |
188188
${{ matrix.setup_steps }}
189+
190+
- name: Check disk space
191+
run: df -h
192+
189193
- name: Run on Unix
190194
working-directory: main
191195
if: ${{ matrix.run_steps && runner.os != 'Windows' }}

0 commit comments

Comments
 (0)