Skip to content

Commit 8fd96dd

Browse files
authored
{platform}-github tags (#22)
* Fix windows python install (#17) * Skip Python from system_packages to avoid duplicate install - errors on windows runner * mx is cloned, err in system packages * Rm debug message * Skip mx/python in install system packages step * Set retagger base branch to the workflow base one * Add logs/artifacts rentention days inputs * Fix and optimize retagger * Fix retagger git diff on wrong branch * -github unittest tag * Ignore logs upload warning * Don't save artifacts produced in retagger jobs * Move test_patched_pip to tagged tests * Disable test_wheel on github_ci * Retagger set continue-on-error to true * Set git clone timeout
1 parent f311b70 commit 8fd96dd

File tree

333 files changed

+34115
-34081
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

333 files changed

+34115
-34081
lines changed

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

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@ on:
1212
jobs_to_run:
1313
required: true
1414
type: string
15+
logs_retention_days:
16+
required: false
17+
type: number
18+
default: 15
19+
artifacts_retention_days:
20+
required: false
21+
type: number
22+
default: 7
1523

1624
jobs:
1725
generate-tier1:
@@ -55,7 +63,6 @@ jobs:
5563
tier1:
5664
needs: generate-tier1
5765
runs-on: ${{ matrix.os }}
58-
#env: ${{ matrix.env }}
5966
strategy:
6067
fail-fast: false
6168
matrix:
@@ -150,6 +157,7 @@ jobs:
150157
if: ${{ matrix.mx_version }}
151158
shell: bash
152159
run: |
160+
git config --global http.timeout 600
153161
git clone https://github.com/graalvm/mx
154162
if [[ "${RUNNER_OS}" == "Windows" ]]; then
155163
./mx/mx.cmd fetch-jdk -A --jdk-id labsjdk-ce-latest
@@ -255,22 +263,23 @@ jobs:
255263
with:
256264
name: ${{ matrix.provide_artifact[0] }}
257265
path: main/${{ matrix.provide_artifact[0] }}.tar
258-
retention-days: 1
266+
retention-days: ${{ inputs.artifacts_retention_days || 7 }}
259267

260268
- name: Upload logs
261269
if: ${{ matrix.logs }}
262270
uses: actions/upload-artifact@v5
271+
continue-on-error: true
263272
with:
264273
name: ${{ format('{0}_logs', matrix.name) }}
265274
path: |
266275
${{ matrix.logs }}
267-
retention-days: 15
276+
retention-days: ${{ inputs.logs_retention_days || 15 }}
277+
if-no-files-found: ignore
268278

269279
tier2:
270280
if: ${{ success() || inputs.jobs_to_run }}
271281
needs: [generate-tier2, tier1]
272282
runs-on: ${{ matrix.os }}
273-
#env: ${{ matrix.env }}
274283
strategy:
275284
fail-fast: false
276285
matrix:
@@ -281,7 +290,6 @@ jobs:
281290
if: ${{ success() || inputs.jobs_to_run }}
282291
needs: [generate-tier3, tier2]
283292
runs-on: ${{ matrix.os }}
284-
#env: ${{ matrix.env }}
285293
strategy:
286294
fail-fast: false
287295
matrix:

.github/workflows/ci-unittest-retagger.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ jobs:
1515
uses: ./.github/workflows/ci-matrix-gen.yml
1616
with:
1717
jobs_to_run: ^(?=.*python-svm-build).*$
18+
artifacts_retention_days: 0
1819

1920
run-retagger:
2021
if: success()
@@ -27,9 +28,12 @@ jobs:
2728
name: Run retagger on ${{ matrix.target }}
2829
with:
2930
jobs_to_run: ${{ github.event.inputs.jobs_to_run || format('^python-unittest-retagger.*{0}.*', matrix.target) }}
31+
logs_retention_days: 7
32+
artifacts_retention_days: 0
3033

3134
merge_all_reports:
3235
runs-on: ubuntu-latest
36+
if: always()
3337
needs: run-retagger
3438
env:
3539
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -55,7 +59,7 @@ jobs:
5559
git config --global user.name "Retagger Workflow"
5660
git config --global user.email "[email protected]"
5761
git fetch origin
58-
git checkout -b weekly_retagger_${{ github.run_id }} origin/master
62+
git checkout -b weekly_retagger_${{ github.run_id }} origin/${{ github.head_ref || github.ref_name }}
5963
6064
- name: Merge retagger reports
6165
env:
@@ -69,14 +73,14 @@ jobs:
6973
for os in "${os_list[@]}"; do
7074
echo "Merging tags for $os"
7175
python3 .github/scripts/merge_retagger_results.py --dir ../retagger-reports --outfile "../retagger-reports/reports-merged-$os.json" --pattern "*$os*" || true
72-
python3 graalpython/com.oracle.graal.python.test/src/runner.py merge-tags-from-report "../retagger-reports/reports-merged-$os.json" --platform "$os" || true
76+
python3 graalpython/com.oracle.graal.python.test/src/runner.py merge-tags-from-report "../retagger-reports/reports-merged-$os.json" --platform "$os-github" || true
7377
git add -A
7478
git commit -m "Apply retags for $os" || true
7579
done
7680
7781
- name: Push updates to a new PR
7882
working-directory: main
7983
run: |
80-
[ "$(git diff origin/master...HEAD | wc -l)" -eq 0 ] && echo 'Nothing to push' || git push --set-upstream origin weekly_retagger_${{ github.run_id }}
84+
[ "$(git diff origin/${{ github.head_ref || github.ref_name }}...HEAD | wc -l)" -eq 0 ] && echo 'Nothing to push' || git push --set-upstream origin weekly_retagger_${{ github.run_id }}
8185
gh label create "weekly-retagger" --color "BDDFDF" -d "[DO NOT ADD] Automatically set to weekly retagger PR" || echo "Label 'weekly-retagger' already exists"
8286
gh pr create -B master --title "[WORKFLOW] Weekly Retagger: Update tags" --body "Applied weekly retags on $os_list" -l "weekly-retagger" || echo "Nothing to push"

.github/workflows/ci-unittests.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ jobs:
1111
uses: ./.github/workflows/ci-matrix-gen.yml
1212
with:
1313
jobs_to_run: ^(?=.*python-svm-build).*$
14+
logs_retention_days: 0
15+
artifacts_retention_days: 0
1416

1517
run-tests:
1618
if: github.event.pull_request.draft == false && success()

ci.jsonnet

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@
101101
local GRAAL_JDK_LATEST = "graal-jdk-latest",
102102
local TAGGED_UNITTESTS_SPLIT = 8,
103103
local COVERAGE_SPLIT = 3,
104-
local RETAGGER_SPLIT = 12,
104+
local RETAGGER_SPLIT = 16,
105105

106106
// -----------------------------------------------------------------------------------------------------------------
107107
// gates
@@ -242,10 +242,10 @@
242242
"linux:amd64:jdk-latest" : tier1,
243243
}),
244244
"python-unittest-retagger": ut_retagger + platform_spec(no_jobs) + batches(RETAGGER_SPLIT) + platform_spec({
245-
"linux:amd64:jdk-latest" : weekly + t("20:00:00"),
246-
"linux:aarch64:jdk-latest" : weekly + t("20:00:00"),
247-
"darwin:aarch64:jdk-latest" : weekly + t("20:00:00"),
248-
"windows:amd64:jdk-latest" : weekly + t("20:00:00"),
245+
"linux:amd64:jdk-latest" : weekly + t("20:00:00") + require(GPY_NATIVE_STANDALONE),
246+
"linux:aarch64:jdk-latest" : weekly + t("20:00:00") + require(GPY_NATIVE_STANDALONE),
247+
"darwin:aarch64:jdk-latest" : weekly + t("20:00:00") + require(GPY_NATIVE_STANDALONE),
248+
"windows:amd64:jdk-latest" : weekly + t("20:00:00") + require(GPY_NATIVE_STANDALONE),
249249
}),
250250
"python-coverage-jacoco-tagged": cov_jacoco_tagged + batches(COVERAGE_SPLIT) + platform_spec(no_jobs) + platform_spec({
251251
"linux:amd64:jdk21" : weekly + t("20:00:00"),

ci/python-gate.libsonnet

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,14 +151,14 @@
151151
darwin: {
152152
common: ENV_POSIX + {
153153
LC_CTYPE: "en_US.UTF-8",
154-
PATH: utils.path_combine(ENVIRONMENT.common.PATH, "$PATH:$PYTHON3_HOME:$MUSL_TOOLCHAIN/bin"),
154+
PATH: utils.path_combine(ENVIRONMENT.common.PATH, "$PYTHON3_HOME:$PATH:$MUSL_TOOLCHAIN/bin"),
155155
},
156156
amd64: {},
157157
aarch64: {},
158158
},
159159
windows: {
160160
common: {
161-
PATH: "%MAVEN_HOME%;%PATH%",
161+
PATH: "%MAVEN_HOME%\\bin;%PATH%",
162162
},
163163
amd64: {},
164164
aarch64: {},
@@ -509,7 +509,7 @@
509509
"mx", "graalpytest", "--svm",
510510
"--tagged", "--all", "--continue-on-collection-errors", ".",
511511
# More workers doesn't help, the job is bottlenecked on all the timeouts in test_asyncio
512-
"-n", "6",
512+
"-n", "4",
513513
# The default timeout is very generous to allow for infrastructure flakiness,
514514
# but we don't want to auto tag tests that take a long time
515515
"--timeout-factor", "0.3",

graalpython/com.oracle.graal.python.test/src/runner.py

Lines changed: 18 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@
8585
DISABLE_JIT_ENV = {'GRAAL_PYTHON_VM_ARGS': '--experimental-options --engine.Compilation=false'}
8686

8787
GITHUB_CI = os.environ.get("GITHUB_CI", None)
88+
if GITHUB_CI:
89+
PLATFORM_KEYS.add("github")
90+
CURRENT_PLATFORM += "-github"
8891

8992
# We leave the JIT enabled for the tests themselves, but disable it for subprocesses
9093
# noinspection PyUnresolvedReferences
@@ -907,7 +910,13 @@ def run_in_subprocess_and_watch(self):
907910

908911

909912
def platform_keys_match(items: typing.Iterable[str]):
910-
return any(all(key in PLATFORM_KEYS for key in item.split('-')) for item in items)
913+
matches = []
914+
for item in items:
915+
if GITHUB_CI:
916+
if not "github" in item.split('-'):
917+
continue
918+
matches.append(all(key in PLATFORM_KEYS for key in item.split('-')))
919+
return any(matches)
911920

912921

913922
@dataclass
@@ -1132,7 +1141,7 @@ def collect_module(test_file: TestFile, specifiers: list[TestSpecifier], use_tag
11321141
loader = TopLevelFunctionLoader() if config.run_top_level_functions else unittest.TestLoader()
11331142
tagged_ids = None
11341143
if use_tags and config.tags_dir:
1135-
tagged_ids = [tag.test_id for tag in read_tags(test_file) if platform_keys_match(tag.keys) and not tag.is_platform_excluded(CURRENT_PLATFORM)]
1144+
tagged_ids = [tag.test_id for tag in read_tags(test_file) if platform_keys_match(tag.keys)]
11361145
if not tagged_ids:
11371146
return None
11381147
test_module = test_path_to_module(test_file)
@@ -1208,52 +1217,36 @@ def collect(all_specifiers: list[TestSpecifier], *, use_tags=False, ignore=None,
12081217
class Tag:
12091218
test_id: TestId
12101219
keys: frozenset[str]
1211-
excluded_keys: frozenset[str]
12121220
is_exclusion: bool
12131221
comment: str | None = False
12141222

12151223
@classmethod
12161224
def for_key(cls, test_id, key) -> 'Tag':
1217-
return Tag(test_id, frozenset({key}), excluded_keys=frozenset(), is_exclusion=False)
1225+
return Tag(test_id, frozenset({key}), is_exclusion=False)
12181226

12191227
def with_key(self, key: str) -> 'Tag':
1220-
if GITHUB_CI:
1221-
return Tag(self.test_id, self.keys, self.excluded_keys - {key}, is_exclusion=self.is_exclusion)
1222-
1223-
return Tag(self.test_id, self.keys | {key}, self.excluded_keys, is_exclusion=self.is_exclusion)
1228+
return Tag(self.test_id, self.keys | {key}, is_exclusion=self.is_exclusion)
12241229

12251230
def without_key(self, key: str) -> 'Tag | None':
12261231
return self.without_keys({key})
12271232

12281233
def without_keys(self, keys: set[str]) -> 'Tag | None':
1229-
# disable test/platform only for github, not completely for internal ci
1230-
if GITHUB_CI:
1231-
exclusions = frozenset(list(self.excluded_keys) + list(keys))
1232-
return Tag(self.test_id, self.keys, exclusions, is_exclusion=self.is_exclusion)
1233-
12341234
keys = self.keys - keys
12351235
if keys:
12361236
if keys == self.keys:
12371237
return self
1238-
return Tag(self.test_id, keys, self.excluded_keys, is_exclusion=self.is_exclusion)
1238+
return Tag(self.test_id, keys, is_exclusion=self.is_exclusion)
12391239

12401240
def is_platform_excluded(self, key: str) -> bool:
1241-
return key in self.excluded_keys
1241+
return key not in self.keys
12421242

1243-
def get_keys_as_str(self) -> list[str]:
1244-
keys = []
1245-
for key in sorted(self.keys):
1246-
if "$" in key: print(f"[WARNING]: Invalid key with $ found in tag keys: {key}, {self.keys}, {self.excluded_keys}")
1247-
keys.append(key if key not in self.excluded_keys else f"${key}")
1248-
return keys
1249-
12501243
def __str__(self):
12511244
s = ''
12521245
if self.is_exclusion:
12531246
s += '!'
12541247
s += self.test_id.test_name
12551248
if self.keys:
1256-
s += f' @ {",".join(self.get_keys_as_str())}'
1249+
s += f' @ {",".join(sorted(self.keys))}'
12571250
if self.comment:
12581251
s = f'{self.comment}{s}'
12591252
return s
@@ -1282,19 +1275,13 @@ def read_tags(test_file: TestFile, allow_exclusions=False) -> list[Tag]:
12821275
is_exclusion = True
12831276
test = test.removeprefix('!')
12841277

1278+
12851279
if not keys and not is_exclusion:
12861280
log(f'WARNING: invalid tag {test}: missing platform keys')
12871281

1288-
keys = keys.split(',') if keys else []
1289-
excluded_keys = []
1290-
for key in keys:
1291-
if key.startswith('$'):
1292-
excluded_keys.append(key.removeprefix('$'))
1293-
12941282
tag = Tag(
12951283
TestId(test_path, test),
1296-
frozenset(keys),
1297-
excluded_keys=frozenset(excluded_keys),
1284+
frozenset(keys.split(',')) if keys else frozenset(keys),
12981285
is_exclusion=is_exclusion,
12991286
comment=comment,
13001287
)

graalpython/com.oracle.graal.python.test/src/tests/test_wheel.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@
4848

4949
from tests.testlib_helper import build_testlib
5050

51-
51+
# cannot be moved to tagged as it uses testlib_helper
52+
@unittest.skipIf(os.environ.get("GITHUB_CI"), "Skip on Github CI")
5253
class TestWheelBuildAndRun(unittest.TestCase):
5354
def test_build_install_and_run(self):
5455
# Build a C library and a wheel that depends on it. Then run it through repair_wheel to vendor the library in and verify that it can be imported

0 commit comments

Comments
 (0)