Skip to content

Commit 91b060b

Browse files
committed
Added determinism inspection workflow
1 parent 922b8d0 commit 91b060b

File tree

108 files changed

+15004
-2
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

108 files changed

+15004
-2
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
* text eol=lf
12
**/*Cargo.Bazel.lock linguist-generated
23
**/cargo-bazel-lock.json linguist-generated
34
crate_universe/3rdparty/crates/** linguist-generated

.github/workflows/determinism.yaml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Determinism
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
check:
8+
strategy:
9+
fail-fast: false
10+
matrix:
11+
# Create a job for each target triple
12+
include:
13+
- os: macos-latest
14+
test_args: ""
15+
- os: ubuntu-latest
16+
test_args: ""
17+
- os: windows-latest
18+
test_args: "--work-dir=C:/r"
19+
runs-on: ${{ matrix.os }}
20+
name: Check (${{ matrix.os }})
21+
steps:
22+
- uses: actions/checkout@master
23+
with:
24+
clean: true
25+
26+
- name: Run tests
27+
continue-on-error: true
28+
run: bazel run --compilation_mode=opt '//test/determinism:tester' '--' test --output=${{ github.workspace }}/results.json ${{ matrix.test_args }}
29+
30+
- name: Summarize (unix)
31+
if: runner.os != 'Windows'
32+
run: |
33+
if [[ ! -f results.json ]]; then
34+
exit 1
35+
fi
36+
37+
echo '<details>' >> ${GITHUB_STEP_SUMMARY}
38+
echo '' >> ${GITHUB_STEP_SUMMARY}
39+
echo '```json' >> ${GITHUB_STEP_SUMMARY}
40+
cat results.json >> ${GITHUB_STEP_SUMMARY}
41+
echo '' >> ${GITHUB_STEP_SUMMARY}
42+
echo '```' >> ${GITHUB_STEP_SUMMARY}
43+
echo '' >> ${GITHUB_STEP_SUMMARY}
44+
echo '</details>' >> ${GITHUB_STEP_SUMMARY}
45+
46+
if [[ "$(cat results.json)" != "[]"* ]]; then
47+
exit 1
48+
fi
49+
- name: Summarize (windows)
50+
if: runner.os == 'Windows'
51+
run: |
52+
if (-not (Test-Path results.json)) {
53+
exit 1
54+
}
55+
56+
echo '<details>' >> $env:GITHUB_STEP_SUMMARY
57+
echo '' >> $env:GITHUB_STEP_SUMMARY
58+
echo '```json' >> $env:GITHUB_STEP_SUMMARY
59+
Get-Content -Path results.json >> $env:GITHUB_STEP_SUMMARY
60+
echo '' >> $env:GITHUB_STEP_SUMMARY
61+
echo '```' >> $env:GITHUB_STEP_SUMMARY
62+
echo '' >> $env:GITHUB_STEP_SUMMARY
63+
echo '</details>' >> $env:GITHUB_STEP_SUMMARY
64+
65+
$content = Get-Content -Path results.json -Raw
66+
if (-not $content.StartsWith('[]')) {
67+
exit 1
68+
}

.github/workflows/formatting.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ jobs:
1313
code-format-checks:
1414
runs-on: ubuntu-latest
1515
steps:
16-
- uses: actions/checkout@v2
16+
- uses: actions/checkout@v4
17+
with:
18+
clean: true
1719
- name: Buildifier
1820
run: |
1921
wget "https://github.com/bazelbuild/buildtools/releases/download/v${BUILDIFIER_VERSION}/buildifier-linux-amd64" -O buildifier

MODULE.bazel

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,17 @@ use_repo(
7171
"buildkite_config",
7272
"generated_inputs_in_external_repo",
7373
"libc",
74+
"rrtd",
75+
"rrtd__anyhow-1.0.97",
76+
"rrtd__blake3-1.6.1",
77+
"rrtd__clap-4.5.32",
78+
"rrtd__serde-1.0.219",
79+
"rrtd__serde_json-1.0.140",
80+
"rrtd__tempfile-3.19.0",
81+
"rrtd__tokio-1.44.1",
82+
"rrtd__tracing-0.1.41",
83+
"rrtd__tracing-subscriber-0.3.19",
84+
"rrtd__walkdir-2.5.0",
7485
"rtra",
7586
"rtra__serde-1.0.219",
7687
"rtra__serde_json-1.0.140",

test/cargo_build_script/compile_data/test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
pub fn test_compile_data() {
33
let data = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/", env!("DATA")));
44

5-
assert_eq!("La-Li-Lu-Le-Lo\n", data);
5+
assert_eq!("La-Li-Lu-Le-Lo", data.trim());
66
}

test/deps.bzl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
44
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
5+
load("//test/determinism/3rdparty/crates:crates.bzl", determinism_test_crate_repositories = "crate_repositories")
56
load("//test/generated_inputs:external_repo.bzl", "generated_inputs_in_external_repo")
67
load("//test/load_arbitrary_tool:load_arbitrary_tool_test.bzl", "load_arbitrary_tool_test")
78
load("//test/rust_analyzer/3rdparty/crates:crates.bzl", rust_analyzer_test_crate_repositories = "crate_repositories")
@@ -40,6 +41,7 @@ def rules_rust_test_deps(is_bzlmod = False):
4041
direct_deps = load_arbitrary_tool_test()
4142
direct_deps.extend(generated_inputs_in_external_repo())
4243
direct_deps.extend(rust_analyzer_test_crate_repositories())
44+
direct_deps.extend(determinism_test_crate_repositories())
4345

4446
maybe(
4547
http_archive,

test/determinism/3rdparty/BUILD.bazel

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
load("//crate_universe:defs.bzl", "crate", "crates_vendor")
2+
3+
crates_vendor(
4+
name = "crates_vendor",
5+
cargo_lockfile = "Cargo.Bazel.lock",
6+
mode = "remote",
7+
packages = {
8+
"anyhow": crate.spec(version = "1.0.97"),
9+
"blake3": crate.spec(version = "1.6.1"),
10+
"clap": crate.spec(
11+
features = [
12+
"derive",
13+
"env",
14+
],
15+
version = "4.5.32",
16+
),
17+
"serde": crate.spec(
18+
features = ["derive"],
19+
version = "1.0.219",
20+
),
21+
"serde_json": crate.spec(version = "1.0.140"),
22+
"tempfile": crate.spec(version = "3.19.0"),
23+
"tokio": crate.spec(
24+
features = ["full"],
25+
version = "1.44.1",
26+
),
27+
"tracing": crate.spec(version = "0.1.41"),
28+
"tracing-subscriber": crate.spec(version = "0.3.19"),
29+
"walkdir": crate.spec(version = "2.5.0"),
30+
},
31+
# `rrtd` == `rules_rust_test_determinism`
32+
repository_name = "rrtd",
33+
tags = ["manual"],
34+
)

0 commit comments

Comments
 (0)