Skip to content

Commit 7ed0836

Browse files
authored
Merge pull request #1 from rust-random/master
Sync with upstream
2 parents aa13fa5 + 491d9d4 commit 7ed0836

Some content is hidden

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

58 files changed

+3243
-1617
lines changed

.cargo/config.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# Allow normal use of "cargo run" and "cargo test" on these wasm32 platforms.
22
[target.wasm32-unknown-unknown]
33
runner = 'wasm-bindgen-test-runner'
4-
[target.wasm32-wasi]
4+
[target.wasm32-wasip1]
5+
runner = 'wasmtime'
6+
[target.wasm32-wasip2]
57
runner = 'wasmtime'
68

79
# Just run on node by default (that's where emscripten is tested)

.clippy.toml

Lines changed: 0 additions & 1 deletion
This file was deleted.

.github/workflows/build.yml

Lines changed: 225 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,225 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches: master
6+
pull_request:
7+
branches: master
8+
schedule:
9+
- cron: "0 12 * * 1"
10+
11+
permissions:
12+
contents: read
13+
14+
env:
15+
CARGO_INCREMENTAL: 0
16+
RUSTFLAGS: "-Dwarnings"
17+
18+
jobs:
19+
macos:
20+
name: Apple Other
21+
# visionOS requires Xcode 15.2+, which is only available on the arm64 runners.
22+
runs-on: macos-14
23+
steps:
24+
- uses: actions/checkout@v4
25+
- uses: dtolnay/rust-toolchain@nightly
26+
with:
27+
targets: aarch64-apple-darwin, aarch64-apple-ios
28+
components: rust-src
29+
- uses: Swatinem/rust-cache@v2
30+
- run: cargo test --no-run --target=aarch64-apple-darwin --features=std
31+
- run: cargo test --no-run --target=aarch64-apple-ios --features=std
32+
- run: cargo test --no-run --target=aarch64-apple-tvos -Zbuild-std --features=std
33+
- run: cargo test --no-run --target=aarch64-apple-watchos -Zbuild-std --features=std
34+
# visionOS requires Xcode 15.2+, GitHub Actions defaults to an older version.
35+
- run: sudo xcode-select -switch /Applications/Xcode_15.2.app
36+
# std is broken on visionOS right now
37+
#- run: cargo test --no-run --target=aarch64-apple-visionos -Zbuild-std --features=std
38+
39+
cross:
40+
name: Cross
41+
runs-on: ubuntu-24.04
42+
strategy:
43+
matrix:
44+
target: [
45+
# This target is currently broken:
46+
# https://github.com/rust-random/getrandom/actions/runs/12949235456/job/36119544880
47+
# sparcv9-sun-solaris,
48+
x86_64-unknown-illumos,
49+
]
50+
steps:
51+
- uses: actions/checkout@v4
52+
- name: Install precompiled cross
53+
run: |
54+
VERSION=v0.2.5
55+
URL=https://github.com/cross-rs/cross/releases/download/${VERSION}/cross-x86_64-unknown-linux-gnu.tar.gz
56+
wget -O - $URL | tar -xz -C ~/.cargo/bin
57+
cross --version
58+
- name: Build Tests
59+
run: cross test --no-run --target=${{ matrix.target }} --features=std
60+
61+
tier2:
62+
name: Tier 2
63+
runs-on: ubuntu-24.04
64+
strategy:
65+
matrix:
66+
target: [
67+
aarch64-linux-android,
68+
x86_64-unknown-fuchsia,
69+
x86_64-unknown-redox,
70+
x86_64-fortanix-unknown-sgx,
71+
]
72+
steps:
73+
- uses: actions/checkout@v4
74+
- uses: dtolnay/rust-toolchain@stable
75+
with:
76+
targets: ${{ matrix.target }}
77+
- uses: Swatinem/rust-cache@v2
78+
- name: Build
79+
run: cargo build --target=${{ matrix.target }} --features=std
80+
81+
tier3:
82+
name: Tier 3
83+
runs-on: ubuntu-24.04
84+
strategy:
85+
matrix:
86+
target: [
87+
aarch64-kmc-solid_asp3,
88+
aarch64-unknown-nto-qnx710,
89+
armv6k-nintendo-3ds,
90+
armv7-sony-vita-newlibeabihf,
91+
i686-unknown-hurd-gnu,
92+
riscv32imc-esp-espidf,
93+
x86_64-unknown-hermit,
94+
x86_64-wrs-vxworks,
95+
x86_64-unknown-dragonfly,
96+
x86_64-unknown-haiku,
97+
]
98+
steps:
99+
- uses: actions/checkout@v4
100+
- uses: dtolnay/rust-toolchain@nightly # Required to build libcore
101+
with:
102+
components: rust-src
103+
- uses: Swatinem/rust-cache@v2
104+
- run: cargo build -Z build-std=core --target=${{ matrix.target }}
105+
106+
# Ubuntu does not support running x32 binaries:
107+
# https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1994516/comments/21
108+
linux-x32:
109+
name: Linux x32
110+
runs-on: ubuntu-24.04
111+
strategy:
112+
matrix:
113+
target: [x86_64-unknown-linux-gnux32]
114+
steps:
115+
- uses: actions/checkout@v4
116+
- uses: dtolnay/rust-toolchain@stable
117+
with:
118+
targets: ${{ matrix.target }}
119+
- name: Install libc and libgcc
120+
run: |
121+
sudo apt-get update
122+
sudo apt-get install --no-install-recommends libc6-dev-x32 libx32gcc-11-dev
123+
- uses: Swatinem/rust-cache@v2
124+
- run: cargo build --target=${{ matrix.target }} --features=std
125+
- env:
126+
RUSTFLAGS: -Dwarnings --cfg getrandom_backend="linux_getrandom"
127+
run: cargo build --target=${{ matrix.target }} --features=std
128+
- env:
129+
RUSTFLAGS: -Dwarnings --cfg getrandom_test_linux_fallback
130+
run: cargo build --features=std
131+
- env:
132+
RUSTFLAGS: -Dwarnings --cfg getrandom_backend="rdrand"
133+
run: cargo build --features=std
134+
135+
web:
136+
name: ${{ matrix.target.description }} ${{ matrix.feature.description }} ${{ matrix.atomic.description }}
137+
runs-on: ubuntu-24.04
138+
env:
139+
RUSTFLAGS: --cfg getrandom_backend="wasm_js" ${{ matrix.atomic.flags }}
140+
strategy:
141+
fail-fast: false
142+
matrix:
143+
target: [
144+
{ description: Web, target: wasm32-unknown-unknown },
145+
{ description: WasmV1, target: wasm32v1-none },
146+
]
147+
feature: [
148+
{ description: no_std, feature: "--features wasm_js", build-std: "core,alloc", std: false },
149+
{ feature: "--features wasm_js,std", build-std: "panic_abort,std", std: true },
150+
]
151+
atomic: [
152+
{ flags: "" },
153+
{ description: with Atomics, flags: "-Ctarget-feature=+atomics,bulk-memory" },
154+
]
155+
exclude:
156+
- target: { target: wasm32v1-none }
157+
feature: { std: true }
158+
steps:
159+
- uses: actions/checkout@v4
160+
- uses: dtolnay/rust-toolchain@master
161+
with:
162+
targets: ${{ matrix.target.target }}
163+
toolchain: nightly-2024-10-24
164+
components: rust-src
165+
- uses: Swatinem/rust-cache@v2
166+
- name: Build
167+
run: cargo build --target ${{ matrix.target.target }} ${{ matrix.feature.feature }} -Zbuild-std=${{ matrix.feature.build-std }}
168+
169+
rdrand-uefi:
170+
name: RDRAND UEFI
171+
runs-on: ubuntu-24.04
172+
strategy:
173+
matrix:
174+
target: [
175+
x86_64-unknown-uefi,
176+
i686-unknown-uefi,
177+
]
178+
steps:
179+
- uses: actions/checkout@v4
180+
- uses: dtolnay/rust-toolchain@nightly # Required to build libcore
181+
with:
182+
components: rust-src
183+
- uses: Swatinem/rust-cache@v2
184+
- env:
185+
RUSTFLAGS: -Dwarnings --cfg getrandom_backend="rdrand"
186+
run: cargo build -Z build-std=core --target=${{ matrix.target }}
187+
- env:
188+
RUSTFLAGS: -Dwarnings --cfg getrandom_backend="rdrand"
189+
run: cargo build -Z build-std=std --target=${{ matrix.target }} --features std
190+
191+
rndr:
192+
name: RNDR
193+
runs-on: ubuntu-24.04
194+
steps:
195+
- uses: actions/checkout@v4
196+
- uses: dtolnay/rust-toolchain@master
197+
with:
198+
toolchain: stable
199+
targets: aarch64-unknown-linux-gnu, aarch64-apple-darwin
200+
- uses: Swatinem/rust-cache@v2
201+
- name: RNDR enabled at compile time (Linux)
202+
env:
203+
RUSTFLAGS: -Dwarnings --cfg getrandom_backend="rndr" -C target-feature=+rand
204+
run: cargo build --target=aarch64-unknown-linux-gnu
205+
- name: Runtime RNDR detection without std (Linux)
206+
env:
207+
RUSTFLAGS: -Dwarnings --cfg getrandom_backend="rndr"
208+
run: cargo build --target=aarch64-unknown-linux-gnu
209+
- name: Runtime RNDR detection with std (macOS)
210+
env:
211+
RUSTFLAGS: -Dwarnings --cfg getrandom_backend="rndr"
212+
run: cargo build --target=aarch64-unknown-linux-gnu --features std
213+
214+
no-atomics:
215+
name: No Atomics
216+
runs-on: ubuntu-24.04
217+
steps:
218+
- uses: actions/checkout@v4
219+
- uses: dtolnay/rust-toolchain@stable
220+
with:
221+
targets: riscv32i-unknown-none-elf
222+
- uses: Swatinem/rust-cache@v2
223+
- env:
224+
RUSTFLAGS: -Dwarnings --cfg getrandom_backend="custom"
225+
run: cargo build --target riscv32i-unknown-none-elf

.github/workflows/lock_upd.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Update Cargo.lock
2+
3+
on:
4+
schedule:
5+
# Run every Sunday at 00:00 UTC
6+
- cron: '0 0 * * 0'
7+
8+
permissions:
9+
contents: read
10+
pull-requests: write
11+
12+
jobs:
13+
update-cargo-lock:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
- uses: dtolnay/rust-toolchain@master
18+
with:
19+
toolchain: stable
20+
- name: Update dependencies
21+
run: cargo update
22+
- name: Create Pull Request
23+
uses: peter-evans/create-pull-request@v7
24+
env:
25+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26+
with:
27+
title: "Update Cargo.lock"
28+
commit-message: "Update Cargo.lock"
29+
base: master
30+
branch: update-cargo-lock

0 commit comments

Comments
 (0)