diff --git a/.github/workflows/kernel-ci-jobs.yml b/.github/workflows/kernel-ci-jobs.yml index a1b63892d49e8f..451324c387ff59 100644 --- a/.github/workflows/kernel-ci-jobs.yml +++ b/.github/workflows/kernel-ci-jobs.yml @@ -121,15 +121,16 @@ jobs: - name: Check out the change uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: - ref: ${{ needs.plan.outputs.head_sha }} persist-credentials: false + # Fetch the event's named ref, not raw SHAs: the PR's merge ref contains + # both parents. SHA fetches exhausted this job before compilation. - name: Fetch history back to the target branch run: | - git fetch --quiet --no-tags --depth=1 origin "$BASE_SHA" "$HEAD_SHA" for depth in 64 256 1024 4096; do - git merge-base "$BASE_SHA" "$HEAD_SHA" >/dev/null && break - git fetch --quiet --no-tags --depth="$depth" origin "$BASE_SHA" "$HEAD_SHA" + git merge-base "$BASE_SHA" "$HEAD_SHA" >/dev/null 2>&1 && break + git fetch --quiet --no-tags --depth="$depth" origin "$GITHUB_REF" done + git merge-base "$BASE_SHA" "$HEAD_SHA" >/dev/null - name: Install LLVM 18 run: | sudo apt-get update -q diff --git a/sound/soc/codecs/tas2764.c b/sound/soc/codecs/tas2764.c index ec3dd171d0c78c..4f847e893595bb 100644 --- a/sound/soc/codecs/tas2764.c +++ b/sound/soc/codecs/tas2764.c @@ -1024,8 +1024,9 @@ static int tas2764_i2c_probe(struct i2c_client *client) if (client->dev.of_node) { result = tas2764_parse_dt(&client->dev, tas2764); if (result) { - dev_err(tas2764->dev, "%s: Failed to parse devicetree\n", - __func__); + if (result != -EPROBE_DEFER) + dev_err(tas2764->dev, "%s: Failed to parse devicetree\n", + __func__); return result; } } diff --git a/sound/soc/codecs/tas2770.c b/sound/soc/codecs/tas2770.c index a69aba06a4b10f..f0dbc2947ecda9 100644 --- a/sound/soc/codecs/tas2770.c +++ b/sound/soc/codecs/tas2770.c @@ -948,8 +948,9 @@ static int tas2770_i2c_probe(struct i2c_client *client) if (client->dev.of_node) { result = tas2770_parse_dt(&client->dev, tas2770); if (result) { - dev_err(tas2770->dev, "%s: Failed to parse devicetree\n", - __func__); + if (result != -EPROBE_DEFER) + dev_err(tas2770->dev, "%s: Failed to parse devicetree\n", + __func__); return result; } } diff --git a/tools/aurora-ci/tests/test_compile_fetch.py b/tools/aurora-ci/tests/test_compile_fetch.py new file mode 100644 index 00000000000000..7dcdd4a76ecc72 --- /dev/null +++ b/tools/aurora-ci/tests/test_compile_fetch.py @@ -0,0 +1,61 @@ +"""Exercise the compile workflow's history step without compiling a kernel.""" +import os +from pathlib import Path +import re +import subprocess +import tempfile +import unittest + + +class CompileFetchTests(unittest.TestCase): + def test_named_merge_ref_contains_both_sides_and_missing_head_refuses(self): + workflow = (Path(__file__).resolve().parents[3] / '.github/workflows/kernel-ci-jobs.yml').read_text() + compile_job = workflow.split('\n compile:\n', 1)[1].split('\n devicetree:\n', 1)[0] + checkout = compile_job.split('- name: Fetch history', 1)[0] + self.assertNotIn('ref: ${{ needs.plan.outputs.head_sha }}', checkout) + match = re.search(r'- name: Fetch history[^\n]*\n run: \|\n((?: .*\n)+)', compile_job) + self.assertIsNotNone(match) + assert match is not None + script = match[1] + script = '\n'.join(line[10:] for line in script.splitlines()) + self.assertNotIn('origin "$BASE_SHA"', script) + with tempfile.TemporaryDirectory() as tmp: + root = Path(tmp) + source = root / 'source' + source.mkdir() + + def git(*args, cwd=source): + return subprocess.check_output(['git', *args], cwd=cwd, text=True, stderr=subprocess.DEVNULL).strip() + + git('init', '-q', '-b', 'main') + git('config', 'user.name', 'CI test') + git('config', 'user.email', 'ci@example.invalid') + git('config', 'commit.gpgsign', 'false') + git('config', 'core.hooksPath', '/dev/null') + git('commit', '-q', '--allow-empty', '-m', 'common') + git('checkout', '-qb', 'change') + git('commit', '-q', '--allow-empty', '-m', 'change') + head = git('rev-parse', 'HEAD') + git('checkout', '-q', 'main') + git('commit', '-q', '--allow-empty', '-m', 'base') + base = git('rev-parse', 'HEAD') + git('merge', '-q', '--no-ff', 'change', '-m', 'merge') + event_ref = 'refs/pull/166/merge' + git('update-ref', event_ref, 'HEAD') + clone = root / 'clone' + clone.mkdir() + git('init', '-q', cwd=clone) + git('remote', 'add', 'origin', source.as_uri(), cwd=clone) + git('fetch', '-q', '--depth=1', 'origin', event_ref, cwd=clone) + git('checkout', '-q', 'FETCH_HEAD', cwd=clone) + env = dict(os.environ, BASE_SHA=base, HEAD_SHA=head, GITHUB_REF=event_ref) + result = subprocess.run(['bash', '-euo', 'pipefail', '-c', script], cwd=clone, env=env, capture_output=True) + self.assertEqual(result.returncode, 0, result.stderr.decode()) + self.assertTrue(git('merge-base', base, head, cwd=clone)) + env['HEAD_SHA'] = '0' * 40 + result = subprocess.run(['bash', '-euo', 'pipefail', '-c', script], cwd=clone, env=env, capture_output=True) + self.assertNotEqual(result.returncode, 0) + + +if __name__ == '__main__': + unittest.main()