Repository navigation
100 lines (91 loc) · 3.8 KB
/
Copy pathplatform-only-tests.yml
File metadata and controls
100 lines (91 loc) · 3.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# Copyright (c) Meta Platforms, Inc. and affiliates.
# Node tests that only one operating system can run, daily on main. Pull
# request CI runs the Node tests on Linux, where these cases skip:
# - windows: packages/cli/foundation/fs/path-safety.test.mjs, whose drive-path
# case reads real Windows paths on a real Windows file system;
# - macos: packages/native/src/icons/defaults.test.ts, whose SF Symbols case
# reads the installed system's symbol catalog.
# Each leg checks out main, installs the workspace, runs only its file with
# .github/scripts/vitest.platform-only.config.mjs (no global setup: neither
# file reads Core's build, the theme cache or the packed CLI), and then fails
# when its platform case did not pass (a case that skipped would otherwise
# pass in silence). A red run blocks no pull request. On a scheduled run, the
# report job keeps one issue: a failure opens it or comments on it, naming the
# failed case and the run, and the next passing scheduled run closes it
# (.github/scripts/platform-only-report.mjs).
name: Platform-only tests
on:
schedule:
- cron: '43 6 * * *'
workflow_dispatch:
permissions: {}
jobs:
platform-only:
name: platform-only (${{ matrix.os }})
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
file: packages/cli/foundation/fs/path-safety.test.mjs
case: reads Windows drive paths
- os: macos-latest
file: packages/native/src/icons/defaults.test.ts
case: names only SF Symbols the system has
runs-on: ${{ matrix.os }}
timeout-minutes: 30
permissions:
contents: read
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
- uses: ./.github/actions/setup
- name: Run the file
shell: bash
env:
FILE: ${{ matrix.file }}
run: pnpm exec vitest run --config .github/scripts/vitest.platform-only.config.mjs "$FILE" --reporter=default --reporter=json --outputFile.json="$RUNNER_TEMP/platform-only.json"
- name: Fail when the platform case did not run
if: always()
shell: bash
env:
CASE: ${{ matrix.case }}
run: |
node -e '
const fs = require("node:fs");
const want = process.env.CASE;
const report = JSON.parse(fs.readFileSync(process.env.RUNNER_TEMP + "/platform-only.json", "utf8"));
const results = report.testResults.flatMap(file => file.assertionResults);
const found = results.find(result => result.title === want);
const status = found ? found.status : "missing";
console.log(want + ": " + status);
process.exit(status === "passed" ? 0 : 1);
'
# A scheduled run reports every outcome but a cancel; a dispatched run leaves
# the issue alone. Only this job writes issues; the legs only read.
report:
needs: platform-only
if: always() && !cancelled() && github.event_name == 'schedule'
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
actions: read
contents: read
issues: write
steps:
- uses: actions/checkout@v7
with:
sparse-checkout: |
.github/scripts/platform-only-report.mjs
.github/scripts/platform-only-cases.mjs
.github/scripts/lib/daily-run-issue.mjs
sparse-checkout-cone-mode: false
persist-credentials: false
- name: Open, update or close the platform-only issue
uses: actions/github-script@v9
with:
script: |
const {reportPlatformOnly} = await import(`${process.env.GITHUB_WORKSPACE}/.github/scripts/platform-only-report.mjs`);
const done = await reportPlatformOnly({github, context});
core.info(`platform-only issue: ${done}`);