Skip to content

Commit

Permalink
fix: windows tests (#6239)
Browse files Browse the repository at this point in the history
* wip

* ci: run winders always

* ci: merge build and run steps together

* chore: display full error msg

* ignore failing test

* chore: clippy

* chore: clean up script

* rm pretty_eq

* chore: simplify test macros

* test

* test: cache when building testdata project

* move

* ci: fix caching

* chore: update actions/checkout

* tmp: run all test matrices

* chore: relax timeout for external tests

* tmp: run all test matrices 2

* fix winders

* chore: relax timeout for external tests 2

* chore: relax timeout for forge_std test

* fix: add svm target platform

* fix: ignore geb

* fix: disable aarch64 target

* tmp: unrun all test matrices

* no cross
  • Loading branch information
DaniPopes authored Nov 8, 2023
1 parent 85f25c6 commit 855d005
Show file tree
Hide file tree
Showing 53 changed files with 877 additions and 1,094 deletions.
6 changes: 2 additions & 4 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@ cheats = "test -p foundry-cheatcodes-defs --features schema tests::"
rustflags = [
# Increases the stack size to 10MB, which is
# in line with Linux (whereas default for Windows is 1MB)
"-C",
"link-arg=/STACK:10000000",
"-Clink-arg=/STACK:10000000",
]

[target.i686-pc-windows-msvc]
rustflags = [
# Increases the stack size to 10MB, which is
# in line with Linux (whereas default for Windows is 1MB)
"-C",
"link-arg=/STACK:10000000",
"-Clink-arg=/STACK:10000000",
]
10 changes: 7 additions & 3 deletions .config/nextest.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
[profile.default]
retries = { backoff = "exponential", count = 3, delay = "1s", jitter = true }
slow-timeout = "3m"
retries = { backoff = "exponential", count = 2, delay = "2s", jitter = true }
slow-timeout = { period = "1m", terminate-after = 3 }

[[profile.default.overrides]]
filter = "test(/ext_integration|can_test_forge_std/)"
slow-timeout = { period = "5m", terminate-after = 4 }

[profile.heavy]
retries = 1
retries = 1
91 changes: 49 additions & 42 deletions .github/scripts/matrices.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,105 +4,114 @@
import os


# A runner target
class Target:
# GitHub runner OS
os_id: str
# Rust target triple
target: str
# SVM Solc target
svm_target_platform: str

def __init__(self, os_id: str, target: str):
def __init__(self, os_id: str, target: str, svm_target_platform: str):
self.os_id = os_id
self.target = target
self.svm_target_platform = svm_target_platform


# A single test suite to run.
class Case:
# Name of the test suite.
name: str
# Nextest filter expression.
filter: str
# Number of partitions to split the test suite into.
n_partitions: int
xplatform: bool
# Whether to run on non-Linux platforms for PRs. All platforms and tests are run on pushes.
pr_cross_platform: bool

def __init__(self, name: str, filter: str, n_partitions: int, xplatform: bool):
def __init__(
self, name: str, filter: str, n_partitions: int, pr_cross_platform: bool
):
self.name = name
self.filter = filter
self.n_partitions = n_partitions
self.xplatform = xplatform
self.pr_cross_platform = pr_cross_platform


# GHA matrix entry
class Expanded:
name: str
os: str
target: str
name: str
svm_target_platform: str
flags: str
partition: int

def __init__(self, os: str, target: str, name: str, flags: str, partition: int):
def __init__(
self,
name: str,
os: str,
target: str,
svm_target_platform: str,
flags: str,
partition: int,
):
self.name = name
self.os = os
self.target = target
self.name = name
self.svm_target_platform = svm_target_platform
self.flags = flags
self.partition = partition


default_target = Target("ubuntu-latest", "x86_64-unknown-linux-gnu")
if os.environ.get("EVENT_NAME") == "pull_request":
targets = [default_target]
else:
targets = [
default_target,
Target("ubuntu-latest", "aarch64-unknown-linux-gnu"),
Target("macos-latest", "x86_64-apple-darwin"),
# Disabled since the test binary will be built for M1/M2, but there are no
# GitHub runners capable of executing those binaries.
# Target("macos-latest", "aarch64-apple-darwin"),
Target("windows-latest", "x86_64-pc-windows-msvc"),
]
is_pr = os.environ.get("EVENT_NAME") == "pull_request"
t_linux_x86 = Target("ubuntu-latest", "x86_64-unknown-linux-gnu", "linux-amd64")
# TODO: Figure out how to make this work
# t_linux_arm = Target("ubuntu-latest", "aarch64-unknown-linux-gnu", "linux-aarch64")
t_macos = Target("macos-latest", "x86_64-apple-darwin", "macosx-amd64")
t_windows = Target("windows-latest", "x86_64-pc-windows-msvc", "windows-amd64")
targets = [t_linux_x86, t_windows] if is_pr else [t_linux_x86, t_macos, t_windows]

config = [
Case(
name="unit",
filter="kind(lib) | kind(bench) | kind(proc-macro)",
n_partitions=1,
xplatform=True,
pr_cross_platform=True,
),
Case(
name="integration",
filter="kind(test) & !test(/issue|forge_std|ext_integration/)",
n_partitions=3,
xplatform=True,
pr_cross_platform=True,
),
Case(
name="integration/issue-repros",
name="integration / issue-repros",
filter="package(=forge) & test(~issue)",
n_partitions=2,
xplatform=False,
pr_cross_platform=False,
),
Case(
name="integration/forge-std",
name="integration / forge-std",
filter="package(=forge) & test(~forge_std)",
n_partitions=1,
xplatform=False,
pr_cross_platform=False,
),
Case(
name="integration/external",
name="integration / external",
filter="package(=forge) & test(~ext_integration)",
n_partitions=2,
xplatform=False,
pr_cross_platform=False,
),
]


def build_matrix():
expanded = []
for target in targets:
expanded.append({"os": target.os_id, "target": target.target})
print_json({"include": expanded})


def test_matrix():
def main():
expanded = []
for target in targets:
for case in config:
if not case.xplatform and target != default_target:
if is_pr and (not case.pr_cross_platform and target != t_linux_x86):
continue

for partition in range(1, case.n_partitions + 1):
Expand All @@ -119,9 +128,10 @@ def test_matrix():
name += os_str

obj = Expanded(
name=name,
os=target.os_id,
target=target.target,
name=name,
svm_target_platform=target.svm_target_platform,
flags=flags,
partition=partition,
)
Expand All @@ -135,7 +145,4 @@ def print_json(obj):


if __name__ == "__main__":
if int(os.environ.get("TEST", "0")) == 0:
build_matrix()
else:
test_matrix()
main()
2 changes: 1 addition & 1 deletion .github/workflows/deny.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: EmbarkStudios/cargo-deny-action@v1
with:
command: check all
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/dependencies.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Automatically run `cargo update` periodically

name: Update Dependencies
name: dependencies

on:
schedule:
Expand Down Expand Up @@ -32,7 +32,7 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly

- name: cargo update
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build and Publish Docker
name: docker

on:
push:
Expand Down Expand Up @@ -27,7 +27,7 @@ jobs:
steps:
- name: Checkout repository
id: checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install Docker BuildX
uses: docker/setup-buildx-action@v2
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/heavy-integration.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Heavy (long-running) integration tests
name: heavy integration

on:
schedule:
Expand All @@ -17,7 +17,7 @@ jobs:
env:
ETH_RPC_URL: https://eth-mainnet.alchemyapi.io/v2/C3JEvfW6VgtqZQa-Qp1E-2srEiIc02sD
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: taiki-e/install-action@nextest
- uses: Swatinem/rust-cache@v2
Expand Down Expand Up @@ -48,7 +48,7 @@ jobs:
needs: heavy-integration
if: ${{ failure() }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: JasonEtco/create-an-issue@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
13 changes: 7 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Release version
name: release

on:
push:
Expand All @@ -9,8 +9,8 @@ on:
workflow_dispatch:

env:
IS_NIGHTLY: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
CARGO_TERM_COLOR: always
IS_NIGHTLY: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}

jobs:
prepare:
Expand All @@ -22,7 +22,7 @@ jobs:
release_name: ${{ steps.release_info.outputs.release_name }}
changelog: ${{ steps.build_changelog.outputs.changelog }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0

Expand Down Expand Up @@ -104,12 +104,13 @@ jobs:
platform: win32
arch: amd64
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
cache-on-failure: true

- name: Apple M1 setup
Expand Down Expand Up @@ -215,7 +216,7 @@ jobs:
needs: release
if: always()
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

# Moves the `nightly` tag to `HEAD`
- name: Move nightly tag
Expand All @@ -240,7 +241,7 @@ jobs:
needs: [prepare, release-docker, release, cleanup]
if: failure()
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: JasonEtco/create-an-issue@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
Loading

0 comments on commit 855d005

Please sign in to comment.