Skip to content

Commit e19172d

Browse files
DaniPopesmikelodder7
authored andcommitted
ci: improve test CI (foundry-rs#5661)
1 parent d402fc9 commit e19172d

17 files changed

+313
-617
lines changed

.github/INTEGRATION_FAILURE.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ title: "bug: long-running integration tests failed"
33
labels: P-high, T-bug
44
---
55

6-
The heavy (long-running) integration tests have failed. This indicates a regression in foundry.
6+
The heavy (long-running) integration tests have failed. This indicates a regression in Foundry.
77

8-
Check the [heavy integration tests workflow page]({{env.WORKFLOW_URL}}) for details.
8+
Check the [heavy integration tests workflow page]({{ env.WORKFLOW_URL }}) for details.
99

10-
This issue was raised by the workflow at `.github/workflows/heavy-integration.yml`.
10+
This issue was raised by the workflow at `.github/workflows/heavy-integration.yml`.

.github/RELEASE_FAILURE_ISSUE_TEMPLATE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ labels: P-high, T-bug
55

66
The release workflow has failed. Some or all binaries might have not been published correctly.
77

8-
Check the [release workflow page]({{env.WORKFLOW_URL}}) for details.
8+
Check the [release workflow page]({{ env.WORKFLOW_URL }}) for details.
99

10-
This issue was raised by the workflow at `.github/workflows/release.yml`.
10+
This issue was raised by the workflow at `.github/workflows/release.yml`.

.github/scripts/matrices.py

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
import json
2+
import os
3+
4+
5+
class Target:
6+
# GitHub runner OS
7+
os_id: str
8+
# Rust target triple
9+
target: str
10+
11+
def __init__(self, os_id: str, target: str):
12+
self.os_id = os_id
13+
self.target = target
14+
15+
16+
class Case:
17+
name: str
18+
filter: str
19+
n_partitions: int
20+
xplatform: bool
21+
22+
def __init__(self, name: str, filter: str, n_partitions: int, xplatform: bool):
23+
self.name = name
24+
self.filter = filter
25+
self.n_partitions = n_partitions
26+
self.xplatform = xplatform
27+
28+
29+
class Expanded:
30+
os: str
31+
target: str
32+
name: str
33+
flags: str
34+
partition: int
35+
36+
def __init__(self, os: str, target: str, name: str, flags: str, partition: int):
37+
self.os = os
38+
self.target = target
39+
self.name = name
40+
self.flags = flags
41+
self.partition = partition
42+
43+
44+
default_target = Target("ubuntu-latest", "x86_64-unknown-linux-gnu")
45+
if os.environ.get("EVENT_NAME") == "pull_request":
46+
targets = [default_target]
47+
else:
48+
targets = [
49+
default_target,
50+
Target("ubuntu-latest", "aarch64-unknown-linux-gnu"),
51+
Target("macos-latest", "x86_64-apple-darwin"),
52+
Target("macos-latest", "aarch64-apple-darwin"),
53+
Target("windows-latest", "x86_64-pc-windows-msvc"),
54+
]
55+
56+
config = [
57+
Case(
58+
name="unit",
59+
filter="kind(lib) | kind(bench) | kind(proc-macro)",
60+
n_partitions=1,
61+
xplatform=True,
62+
),
63+
Case(
64+
name="integration",
65+
filter="kind(test) & !test(/issue|forge_std|ext_integration/)",
66+
n_partitions=3,
67+
xplatform=True,
68+
),
69+
Case(
70+
name="integration/issue-repros",
71+
filter="package(=forge) & test(~issue)",
72+
n_partitions=2,
73+
xplatform=False,
74+
),
75+
Case(
76+
name="integration/forge-std",
77+
filter="package(=forge) & test(~forge_std)",
78+
n_partitions=1,
79+
xplatform=False,
80+
),
81+
Case(
82+
name="integration/external",
83+
filter="package(=forge) & test(~ext_integration)",
84+
n_partitions=2,
85+
xplatform=False,
86+
),
87+
]
88+
89+
90+
def build_matrix():
91+
os_ids = []
92+
targets_ = []
93+
for target in targets:
94+
os_ids.append(target.os_id)
95+
targets_.append(target.target)
96+
print(json.dumps({"os": os_ids, "target": targets_}))
97+
98+
99+
def test_matrix():
100+
expanded = []
101+
for target in targets:
102+
for case in config:
103+
if not case.xplatform and target != default_target:
104+
continue
105+
106+
for partition in range(1, case.n_partitions + 1):
107+
os_str = ""
108+
if len(targets) > 1:
109+
os_str = f" ({target.target})"
110+
111+
name = case.name
112+
flags = f"-E '{case.filter}'"
113+
if case.n_partitions > 1:
114+
s = f"{partition}/{case.n_partitions}"
115+
name += f" ({s})"
116+
flags += f" --partition count:{s}"
117+
name += os_str
118+
119+
obj = Expanded(
120+
os=target.os_id,
121+
target=target.target,
122+
name=name,
123+
flags=flags,
124+
partition=partition,
125+
)
126+
expanded.append(vars(obj))
127+
128+
print(json.dumps({"include": expanded}), end="", flush=True)
129+
130+
131+
if __name__ == "__main__":
132+
if int(os.environ.get("TEST", "0")) == 0:
133+
build_matrix()
134+
else:
135+
test_matrix()

.github/workflows/cross-platform.yml

Lines changed: 0 additions & 206 deletions
This file was deleted.

.github/workflows/deny.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ jobs:
1515
cargo-deny:
1616
name: cargo deny check
1717
runs-on: ubuntu-latest
18+
timeout-minutes: 30
1819
steps:
1920
- uses: actions/checkout@v3
2021
- uses: EmbarkStudios/cargo-deny-action@v1

0 commit comments

Comments
 (0)