Skip to content

Commit

Permalink
Merge branch 'master' into insecure
Browse files Browse the repository at this point in the history
  • Loading branch information
newpavlov authored Dec 11, 2024
2 parents eef3564 + 83bef12 commit a80b3ec
Show file tree
Hide file tree
Showing 19 changed files with 346 additions and 323 deletions.
99 changes: 73 additions & 26 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,12 @@ jobs:

cross:
name: Cross
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
strategy:
matrix:
target: [
sparcv9-sun-solaris,
x86_64-unknown-illumos,
x86_64-unknown-freebsd,
x86_64-unknown-netbsd,
]
steps:
- uses: actions/checkout@v4
Expand All @@ -58,26 +56,9 @@ jobs:
- name: Build Tests
run: cross test --no-run --target=${{ matrix.target }} --features=std

wasm64:
name: Wasm64
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly # Need to build libstd
with:
components: rust-src
- uses: Swatinem/rust-cache@v2
- name: Build and Link tests (build-std)
env:
RUSTFLAGS: -Dwarnings --cfg getrandom_backend="wasm_js"
# This target is Tier 3, so we have to build libstd ourselves.
# We currently cannot run these tests because wasm-bindgen-test-runner
# does not yet support memory64.
run: cargo test --no-run -Z build-std=std,panic_abort --target=wasm64-unknown-unknown

tier2:
name: Tier 2
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
strategy:
matrix:
target: [
Expand All @@ -96,7 +77,7 @@ jobs:

tier3:
name: Tier 3
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
strategy:
matrix:
target: [
Expand All @@ -118,9 +99,75 @@ jobs:
- uses: Swatinem/rust-cache@v2
- run: cargo build -Z build-std=core --target=${{ matrix.target }}

# Ubuntu does not support running x32 binaries:
# https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1994516/comments/21
linux-x32:
name: Linux x32
runs-on: ubuntu-24.04
strategy:
matrix:
target: [x86_64-unknown-linux-gnux32]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install libc and libgcc
run: |
sudo apt-get update
sudo apt-get install --no-install-recommends libc6-dev-x32 libx32gcc-11-dev
- uses: Swatinem/rust-cache@v2
- run: cargo build --target=${{ matrix.target }} --features=std
- env:
RUSTFLAGS: -Dwarnings --cfg getrandom_backend="linux_getrandom"
run: cargo build --target=${{ matrix.target }} --features=std
- env:
RUSTFLAGS: -Dwarnings --cfg getrandom_backend="linux_rustix"
run: cargo build --target=${{ matrix.target }} --features=std
- env:
RUSTFLAGS: -Dwarnings --cfg getrandom_test_linux_fallback
run: cargo build --features=std
- env:
RUSTFLAGS: -Dwarnings --cfg getrandom_backend="rdrand"
run: cargo build --features=std

web:
name: ${{ matrix.target.description }} ${{ matrix.feature.description }} ${{ matrix.atomic.description }}
runs-on: ubuntu-24.04
env:
RUSTFLAGS: --cfg getrandom_backend="wasm_js" ${{ matrix.atomic.flags }}
strategy:
fail-fast: false
matrix:
target: [
{ description: Web, target: wasm32-unknown-unknown },
{ description: WasmV1, target: wasm32v1-none },
]
feature: [
{ description: no_std, feature: "", build-std: "core,alloc", std: false },
{ feature: --features std, build-std: "panic_abort,std", std: true },
]
atomic: [
{ flags: "" },
{ description: with Atomics, flags: "-Ctarget-feature=+atomics,bulk-memory" },
]
exclude:
- target: { target: wasm32v1-none }
feature: { std: true }
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
targets: ${{ matrix.target.target }}
toolchain: nightly-2024-10-24
components: rust-src
- uses: Swatinem/rust-cache@v2
- name: Build
run: cargo build --target ${{ matrix.target.target }} ${{ matrix.feature.feature }} -Zbuild-std=${{ matrix.feature.build-std }}

rdrand:
name: RDRAND
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
strategy:
matrix:
target: [
Expand All @@ -139,7 +186,7 @@ jobs:

rndr:
name: RNDR
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
Expand All @@ -162,7 +209,7 @@ jobs:

esp-idf:
name: ESP-IDF
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly # Required to build libcore
Expand All @@ -175,7 +222,7 @@ jobs:

no-atomics:
name: No Atomics
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/nopanic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ env:
jobs:
linux:
name: Linux
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
Expand Down Expand Up @@ -82,7 +82,7 @@ jobs:

cross:
name: Cross
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
Expand Down
100 changes: 63 additions & 37 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04, windows-2022]
os: [ubuntu-24.04, windows-2022]
toolchain: [nightly, beta, stable, "1.63"]
# Only Test macOS on stable to reduce macOS CI jobs
include:
Expand All @@ -42,35 +42,23 @@ jobs:

linux:
name: Linux
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
strategy:
matrix:
target: [x86_64-unknown-linux-musl, i686-unknown-linux-musl]
include:
- target: i686-unknown-linux-gnu
packages: libc6-dev-i386 lib32gcc-11-dev
- target: x86_64-unknown-linux-gnux32
packages: libc6-dev-x32 libx32gcc-11-dev
# TODO: Find a Linux image/runner with CONFIG_X86_X32_ABI set
cargo_test_opts: --no-run
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install libc and libgcc
if: matrix.packages
run: |
sudo apt-get update
sudo apt-get install --no-install-recommends ${{ matrix.packages }}
- uses: Swatinem/rust-cache@v2
- run: cargo test ${{ matrix.cargo_test_opts }} --target=${{ matrix.target }} --features=std
- run: cargo test --target=${{ matrix.target }} --features=std
- env:
RUSTFLAGS: -Dwarnings --cfg getrandom_backend="linux_getrandom"
run: cargo test ${{ matrix.cargo_test_opts }} --target=${{ matrix.target }} --features=std
run: cargo test --target=${{ matrix.target }} --features=std
- env:
RUSTFLAGS: -Dwarnings --cfg getrandom_backend="linux_rustix"
run: cargo test ${{ matrix.cargo_test_opts }} --target=${{ matrix.target }} --features=std
run: cargo test --target=${{ matrix.target }} --features=std
- env:
RUSTFLAGS: -Dwarnings --cfg getrandom_test_linux_fallback
run: cargo test --features=std
Expand Down Expand Up @@ -144,7 +132,7 @@ jobs:

sanitizer:
name: Sanitizer
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
Expand All @@ -158,7 +146,7 @@ jobs:

cross:
name: Cross
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
strategy:
matrix:
target: [
Expand All @@ -182,7 +170,7 @@ jobs:

freebsd:
name: FreeBSD VM
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Test in FreeBSD
Expand All @@ -196,7 +184,7 @@ jobs:

openbsd:
name: OpenBSD VM
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Test in OpenBSD
Expand All @@ -210,7 +198,7 @@ jobs:

netbsd:
name: NetBSD VM
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Test in NetBSD
Expand All @@ -220,13 +208,15 @@ jobs:
usesh: true
prepare: |
/usr/sbin/pkg_add rust
run: cargo test
run: |
cargo test
RUSTFLAGS="--cfg getrandom_test_netbsd_fallback -D warnings" cargo test
# This job currently fails:
# https://github.com/rust-random/getrandom/actions/runs/11405005618/job/31735653874?pr=528
# dragonflybsd:
# name: DragonflyBSD VM
# runs-on: ubuntu-22.04
# runs-on: ubuntu-24.04
# steps:
# - uses: actions/checkout@v4
# - name: Test in DragonflyBSD
Expand All @@ -239,37 +229,73 @@ jobs:
# run: cargo test

web:
name: Web
runs-on: ubuntu-22.04
name: ${{ matrix.rust.description }}
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
rust:
- {
description: Web,
version: stable,
flags: -Dwarnings --cfg getrandom_backend="wasm_js",
args: --features=std,
}
- {
description: Web with Atomics,
version: nightly,
components: rust-src,
flags: '-Dwarnings --cfg getrandom_backend="wasm_js" -Ctarget-feature=+atomics,+bulk-memory',
args: '--features=std -Zbuild-std=panic_abort,std',
}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- run: choco install wget
if: runner.os == 'Windows'
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust.version }}
components: ${{ matrix.rust.components }}
- name: Install precompiled wasm-pack
shell: bash
run: |
VERSION=v0.12.1
VERSION=v0.13.1
URL=https://github.com/rustwasm/wasm-pack/releases/download/${VERSION}/wasm-pack-${VERSION}-x86_64-unknown-linux-musl.tar.gz
wget -O - $URL | tar -xz --strip-components=1 -C ~/.cargo/bin
wasm-pack --version
- uses: Swatinem/rust-cache@v2
- name: Test (Node)
env:
RUSTFLAGS: -Dwarnings --cfg getrandom_backend="wasm_js"
run: wasm-pack test --node
RUSTFLAGS: ${{ matrix.rust.flags }}
run: wasm-pack test --node -- ${{ matrix.rust.args }}
- name: Test (Firefox)
env:
RUSTFLAGS: -Dwarnings --cfg getrandom_backend="wasm_js" --cfg getrandom_browser_test
run: wasm-pack test --headless --firefox
WASM_BINDGEN_USE_BROWSER: 1
RUSTFLAGS: ${{ matrix.rust.flags }}
run: wasm-pack test --headless --firefox -- ${{ matrix.rust.args }}
- name: Test (Chrome)
env:
RUSTFLAGS: -Dwarnings --cfg getrandom_backend="wasm_js" --cfg getrandom_browser_test
run: wasm-pack test --headless --chrome
WASM_BINDGEN_USE_BROWSER: 1
RUSTFLAGS: ${{ matrix.rust.flags }}
run: wasm-pack test --headless --chrome -- ${{ matrix.rust.args }}
- name: Test (dedicated worker)
env:
WASM_BINDGEN_USE_DEDICATED_WORKER: 1
RUSTFLAGS: ${{ matrix.rust.flags }}
run: wasm-pack test --headless --firefox -- ${{ matrix.rust.args }}
- name: Test (shared worker)
env:
WASM_BINDGEN_USE_SHARED_WORKER: 1
RUSTFLAGS: ${{ matrix.rust.flags }}
run: wasm-pack test --headless --firefox -- ${{ matrix.rust.args }}
- name: Test (service worker)
env:
WASM_BINDGEN_USE_SERVICE_WORKER: 1
RUSTFLAGS: ${{ matrix.rust.flags }}
# Firefox doesn't support module service workers and therefor can't import scripts
run: wasm-pack test --headless --chrome -- ${{ matrix.rust.args }}

wasi:
name: WASI
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
Expand Down
Loading

0 comments on commit a80b3ec

Please sign in to comment.