/** * @license * Copyright 2026 Qwen Team * SPDX-License-Identifier: Apache-2.0 */ import { readFileSync } from 'node:fs'; import { describe, expect, it } from 'vitest'; import { parse } from 'yaml'; describe('e2e workflow', () => { const workflow = readFileSync('.github/workflows/e2e.yml', 'utf8'); const yml = parse(workflow); it('never cancels in-progress runs on main', () => { // A full run takes ~40min while merges land every ~18min, so cancelling on // every merge starved the suite — over 100 push runs, 67 were cancelled and // only 25 ever reported. Runs on main must finish; dev branches still cancel // superseded runs. A future simplification back to `event_name == 'push'` // would silently reintroduce the starvation, so the guard is asserted. const cancel = yml.concurrency['cancel-in-progress']; expect(cancel).toContain( "github.event_name == 'push' && github.ref_name != 'main'", ); }); it('scopes the concurrency group by event and ref', () => { // Scoping by event keeps main pushes coalescing with each other without // touching the nightly schedule or a manual dispatch on the same ref. const group = yml.concurrency.group; expect(group).toContain('github.workflow'); expect(group).toContain('github.event_name'); expect(group).toContain('github.head_ref || github.ref_name'); }); });