Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The getrandom crate #1

Open
wants to merge 248 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
248 commits
Select commit Hold shift + click to select a range
c9440a2
Add library skeleton
dhardy Jan 19, 2019
71a3cb8
first commit
newpavlov Feb 4, 2019
9420df9
remove fuchsia loop
newpavlov Feb 5, 2019
99a1310
use fuchsia-cprng
newpavlov Feb 5, 2019
d8c356b
remove wasm-bindgen shims
newpavlov Feb 5, 2019
8f6edad
add benchmarks
newpavlov Feb 5, 2019
1049ce8
review updates
newpavlov Feb 5, 2019
39ba5d2
remove redundant extern crate
newpavlov Feb 5, 2019
9855b52
change test cfg
newpavlov Feb 5, 2019
5ebbaf7
remove unsafe and newlines, add notice
newpavlov Feb 6, 2019
f860bde
use atomic bool to check RNG initialization
newpavlov Feb 6, 2019
1e2a5aa
new error
newpavlov Feb 6, 2019
9871d55
remove unsafe
newpavlov Feb 6, 2019
af5035f
remove unused feature
newpavlov Feb 6, 2019
24e7f8f
Merge pull request #6 from newpavlov/init
dhardy Feb 14, 2019
4374fd7
Add getrandom wrapper func and documentation
dhardy Feb 18, 2019
9ba1d37
Impl From not Into
dhardy Feb 18, 2019
7ff3aff
Error doc; fix for Solaris
dhardy Feb 18, 2019
0f371be
Rename getrandom_os → getrandom_inner; more WASM doc
dhardy Feb 18, 2019
10fdedd
Merge pull request #7 from dhardy/master
dhardy Feb 20, 2019
819fb3f
8 Update Solaris getrandom
jasonbking Feb 23, 2019
7f68c78
Merge pull request #9 from jasonbking/illumos
dhardy Feb 25, 2019
ae1e2aa
Add note on min Rustc version
dhardy Feb 25, 2019
b6e859c
Add CI configuration
dhardy Feb 25, 2019
557ee8f
CI fix: do not test benches on stable
dhardy Feb 25, 2019
25bc1ac
Fix doc links
dhardy Feb 25, 2019
446cff3
Fix cross-compilation script; disable non-existant Fuchsia target
dhardy Feb 25, 2019
5607368
Fix Mac OSX implementation
dhardy Feb 25, 2019
51303b5
Implement on WASM via stdweb and bindgen; add tests
dhardy Feb 25, 2019
a40d3de
Fixes for CI, CloudABI, 32-bit Linux, MacOS, WASM
dhardy Feb 25, 2019
0d5f4c5
Remove usage of ATOMIC_BOOL_INIT
dhardy Feb 25, 2019
ac13e04
CI: do not test benches with stable Rustc (again)
dhardy Feb 25, 2019
679c52c
Merge pull request #10 from dhardy/ci
dhardy Feb 26, 2019
b771a82
Revise error types and codes
dhardy Mar 1, 2019
1a2dcdc
Set correct requirements for minimal versions; test in CI
dhardy Mar 1, 2019
1fabf59
Don't test minimal versions in CI
dhardy Mar 1, 2019
23d8285
Re-enable minimal dependency version testing on nightly runners
dhardy Mar 2, 2019
7d93104
Print error codes in hex; include codes in documentation
dhardy Mar 11, 2019
13d49ec
Remove error module from API
dhardy Mar 11, 2019
d33356f
Enable optional logging support
dhardy Mar 12, 2019
214a713
Enable optional logging of failures
dhardy Mar 12, 2019
f2322f4
Bump libc version requirement to the latest.
dhardy Mar 14, 2019
170cbc1
Merge pull request #11 from dhardy/master
dhardy Mar 14, 2019
19c39fb
Minor updates (#12)
newpavlov Mar 16, 2019
7807932
MSRV bump, module changes
newpavlov Mar 22, 2019
7e70829
stdweb fix
newpavlov Mar 22, 2019
a4cd116
import js macro
newpavlov Mar 22, 2019
9e844d5
readme update
newpavlov Mar 22, 2019
5e23e13
fix stdweb
newpavlov Mar 22, 2019
7e93a69
Merge pull request #15 from newpavlov/edition
dhardy Mar 23, 2019
6e89775
Prepare 0.1.0 release
dhardy Mar 23, 2019
4c1d7c4
Merge pull request #16 from dhardy/master
dhardy Mar 23, 2019
d2a9729
cloudabi fix
newpavlov Apr 2, 2019
aa2bde5
Prepare 0.1.1 release and add zero-len test
dhardy Apr 5, 2019
c2f13c8
Merge pull request #18 from dhardy/master
dhardy Apr 5, 2019
d8bbf43
Added support for wasm32-unknown-wasi
nipzu Apr 6, 2019
3d2682e
Added some tests for wasm32-unknown-wasi
nipzu Apr 6, 2019
8395a9e
Update changelog
nipzu Apr 6, 2019
0b52d8e
Update crate version
nipzu Apr 6, 2019
dffc125
Update crate version to 0.1.2
nipzu Apr 6, 2019
0f411bb
Update README
nipzu Apr 6, 2019
3142dee
Merge pull request #20 from nipzu/master
dhardy Apr 6, 2019
6eb55f1
Update the WASI support.
sunfishcode May 15, 2019
33a6157
Bump the cargo version and add a CHANGELOG.md entry.
sunfishcode May 15, 2019
0a18857
Merge pull request #22 from sunfishcode/master
dhardy May 16, 2019
db27e97
Don't block in getrandom() detection (#26)
josephlr Jun 10, 2019
ce4a089
Add a (nonfailing) rustfmt check to the CI (#23)
josephlr Jun 10, 2019
50212bd
linux: Use libc::GRND_NONBLOCK (#29)
josephlr Jun 12, 2019
9e64082
Improve RDRAND implementation (#24)
josephlr Jun 12, 2019
bcad3fb
macos: Cleanup SecRandom type (#28)
josephlr Jun 12, 2019
ac7a542
Fix long buffer issues (#33)
josephlr Jun 14, 2019
0381ee0
Support x86_64-unknown-uefi
josephlr Jun 12, 2019
94440e1
Use custom implementation of is_rdrand_supported
josephlr Jun 13, 2019
fc8ab62
Add missing not
josephlr Jun 14, 2019
5c6294a
Add error for sgx && !rdrand
josephlr Jun 14, 2019
25bd5a5
Fix cfg guards
josephlr Jun 14, 2019
8053d7e
Improve compile_error! message
josephlr Jun 16, 2019
0b87a09
Merge pull request #30 from josephlr/uefi
dhardy Jun 17, 2019
a91b60b
freebsd: Increase consistancy with libc implementation (#36)
josephlr Jun 19, 2019
af4ea8d
Remove TLS by using lazy_static (#25)
josephlr Jun 25, 2019
3d8373b
Run Rustfmt on entire repo
josephlr Jun 26, 2019
27b883f
Update docs with RDRAND link (#41)
josephlr Jun 26, 2019
5c7faa5
Merge pull request #39 from josephlr/rustfmt
dhardy Jun 26, 2019
ea999a6
Remove cloudabi, winapi, and fuchsia-cprng dependancies (#40)
josephlr Jun 27, 2019
70f6ff7
Prepare v0.1.4 release (#42)
newpavlov Jun 28, 2019
31ce376
version typo fix
newpavlov Jun 28, 2019
11eefaa
Use shared File instead of shared FD. (#45)
josephlr Jun 29, 2019
5b56734
Check for AMD RDRAND bug (#43)
josephlr Jun 29, 2019
e992e45
macOS: Try getentropy() then fallback to /dev/random (#46)
josephlr Jun 29, 2019
30ac773
prepare release v0.1.5 (#47)
newpavlov Jun 29, 2019
cbc44ee
Alternative way to detect AMD bug (#48)
josephlr Jun 30, 2019
e02e946
release v0.1.6
newpavlov Jun 30, 2019
4f65408
link fix
newpavlov Jul 1, 2019
61cd3c2
openBSD: Make imports consistent (#53)
josephlr Jul 2, 2019
b1e8154
Add Structures for lock-free initialization (#51)
josephlr Jul 2, 2019
0c72017
Remove lazy_static dependancy (#52)
josephlr Jul 4, 2019
479d036
Use cfg-if to simplify lib.rs (#55)
josephlr Jul 5, 2019
ca33db9
Remove Bitrig support (#56)
josephlr Jul 7, 2019
0ada41a
Updated link to the official WASI repo (#59)
syrusakbary Jul 8, 2019
1705b40
replace mem::uninitialized with mem::zeroed
newpavlov Jul 9, 2019
65660e0
Try getrandom() first on FreeBSD, add sys_fill_exact helper (#57)
josephlr Jul 9, 2019
9e0d7c7
Incorperate feedback on Lazy helpers (#60)
josephlr Jul 11, 2019
b3e609f
Add support for hermit and l4re (#61)
josephlr Jul 12, 2019
00c3cff
Improve Error handling (#54)
josephlr Jul 27, 2019
dadef45
Fix stdweb extern issue (#66)
josephlr Jul 28, 2019
d93954a
Prepare v0.1.7 release (#67)
newpavlov Jul 29, 2019
ab44edf
fix readme example
newpavlov Aug 3, 2019
6716ad0
Explicitly specify types to arguments of 'libc::syscall' (#74)
Aaron1011 Aug 4, 2019
199b115
prepare release v0.1.8 (#76)
newpavlov Aug 5, 2019
b69f832
Remove libstd dependancy for Opening and Reading files (#58)
josephlr Aug 6, 2019
98934cb
Add rustc-dep-of-std feature (#78)
josephlr Aug 6, 2019
10e41b2
Updating link to Fuchsia documentation (#81)
claywilkinson Aug 7, 2019
86c2cd6
Use wasi isntead of libc (#64)
newpavlov Aug 8, 2019
283f9f8
Add Windows UWP support (#69)
newpavlov Aug 8, 2019
7449a08
Add dummy feature (#71)
newpavlov Aug 8, 2019
f94b44a
Add warning checks (#80)
josephlr Aug 12, 2019
bf54eaa
Deny warnings in CI tests (#82)
newpavlov Aug 13, 2019
e266249
Prepare release v0.1.9 (#83)
newpavlov Aug 14, 2019
3d1d2ff
Wasi does not need libc (#88)
josephlr Aug 15, 2019
73bbbdc
Always build on wasm32-unknown-unknown (#90)
josephlr Aug 17, 2019
f073a95
Fix CSP error for wasm bindgen (#92)
evq Aug 17, 2019
a9b7f92
Prepare release v0.1.10 (#93)
newpavlov Aug 17, 2019
8197a18
Add back in std-only trait definitions (#96)
josephlr Aug 24, 2019
4db1b14
Fix Redox CI (#85)
josephlr Aug 25, 2019
208b318
Prepare release v0.1.11 (#97)
newpavlov Aug 25, 2019
31e5b2f
Update wasi dependency (#100)
newpavlov Aug 31, 2019
5cfa668
Prepare release v0.1.12 (#103)
newpavlov Sep 6, 2019
ccc4774
Handle zero-length slices (#104)
elichai Sep 19, 2019
fa6f929
Improve CI for web targets (#108)
josephlr Sep 21, 2019
3b6c90c
Run Rustfmt and make formatting error fail the CI
josephlr Sep 22, 2019
6bd6e04
Merge pull request #111 from josephlr/fmt
dhardy Sep 23, 2019
2052159
cfg-if 0.1.2 needed as minimal version of dep
dekellum Sep 30, 2019
93312bd
Fix CI
josephlr Sep 30, 2019
04f6517
Remove jq dep
josephlr Sep 30, 2019
7f013b1
Merge pull request #114 from josephlr/ci
dhardy Oct 1, 2019
6b4925a
Merge pull request #112 from dekellum/min-cfg-if
dhardy Oct 1, 2019
6057367
Only impl std traits if feature is specified (#106)
josephlr Sep 20, 2019
add45a3
Remove dummy implementation (#107)
josephlr Sep 22, 2019
2fa1bba
Switch to using the arandom sysctl on NetBSD (same as FreeBSD). (#115)
alarixnia Oct 23, 2019
9a385f1
Add VxWorks support (#86)
newpavlov Oct 23, 2019
81bd43e
Fix typos and bad doc links. (#117)
josephlr Oct 24, 2019
1f1f964
Merge branch 'master' into 0.2
josephlr Oct 24, 2019
d661aa7
Prepare release v0.1.13 (#118)
newpavlov Oct 25, 2019
cf2d81b
Improve src/lib.rs cfgs (#119)
josephlr Oct 25, 2019
8096bac
0.2: Error and Testing improvements (#120)
josephlr Oct 28, 2019
48781cd
wasi: Update and Fix Travis failures (#126)
josephlr Jan 5, 2020
a913c9c
dragonfly: Don't try to read errno value (#129)
josephlr Jan 7, 2020
245b5b2
util_libc: open_readonly shoud return a Result
josephlr Jan 6, 2020
46963aa
use_file: Remove use of spin-locks
josephlr Jan 6, 2020
c5e2025
util: Remove unused spin-lock interfaces
josephlr Jan 6, 2020
33b859b
Prepare release v0.1.14 (#128)
newpavlov Jan 7, 2020
0f14f2a
Merge branch 'master' into 0.2
josephlr Jan 8, 2020
d6b75d1
log: Remove optional log dependancy (#131)
josephlr Jan 9, 2020
448bcac
custom: Add support for Custom RNGs
josephlr Oct 26, 2019
3d7a7b5
Remove built-in support for wasm32-unknown-unknown
josephlr Oct 26, 2019
7d558f1
custom: Add custom RNG for stdweb
josephlr Oct 26, 2019
8365277
custom: Add Custom RNG for wasm-bindgen
josephlr Oct 26, 2019
4263ac6
custom: Allow no_std custom RNG handlers
josephlr Feb 19, 2020
cd84484
target: Drop support for some x86_64 targets
josephlr Feb 19, 2020
ff6299d
cpu: Add support for CPU-based randomness
josephlr Feb 19, 2020
1375181
tests: Improve testing infrastructure
josephlr Feb 19, 2020
52e7e9f
tests: Test CPU-based RNG on all x86 targets
josephlr Feb 19, 2020
2e39004
rdrand: Add 32-bit x86 support
josephlr Feb 19, 2020
c25d0a8
travis: Fix wasm32 CI
josephlr Apr 25, 2020
3d17318
Merge pull request #141 from josephlr/travis
dhardy Apr 26, 2020
d1a84db
error: Make internal_error! a function
josephlr Feb 25, 2020
b3d3fbc
assert: Make use of asserts consistent
josephlr Feb 26, 2020
afcfcd1
build: Remove getrandom_uwp cfg
josephlr Feb 26, 2020
138d903
ios: Don't use SecRandom type
josephlr Feb 26, 2020
74eca5e
fmt: Use consistent include style
josephlr Feb 26, 2020
c7862af
travis: Allow nightly builds to fail
josephlr Apr 27, 2020
717b5cc
Merge pull request #145 from josephlr/nightly
dhardy Apr 27, 2020
b44da72
travis: Fix wasm32 CI
josephlr Apr 25, 2020
54b4c8d
travis: Allow nightly builds to fail
josephlr Apr 27, 2020
f1c264d
Fixing Webpack require warning
Pauan Mar 30, 2020
0ad1c77
wasm-bindgen: Added support for Internet Explorer 11
zer0x64 Apr 24, 2020
7bfdabf
wasm-bindgen: Added support for Internet Explorer 11
zer0x64 Apr 24, 2020
ec4a3e1
Fixing Webpack require warning
Pauan Mar 30, 2020
8191d7f
Merge pull request #143 from josephlr/fixing-webpack-warning
dhardy Apr 28, 2020
7631f75
ci: Pin the Cross binary to avoid breaking the CI
josephlr May 23, 2020
10df558
AppVeyor: Run CI on 0.2 branch
josephlr May 25, 2020
a29180a
wasm32: Unify error codes an implementations
josephlr May 22, 2020
618593c
cpu: Have "cpu" feature take precedence over "custom"
josephlr May 28, 2020
6aba12c
Rename "cpu" feature to "rdrand"
josephlr May 29, 2020
eacffd5
wasm: Move JS-based Custom RNGs back into the main crate
josephlr May 28, 2020
11b4f9e
wasm: Update testing framework
josephlr May 28, 2020
706a429
stdweb: Remove CI runs with cargo-web
josephlr Jul 21, 2020
f6af828
ci: Remove old reference to wasm-bindgen-getrandom
josephlr Jul 21, 2020
2b03b0e
Remove workaround for older Linux kernels
newpavlov Jul 19, 2020
fc83790
rustfmt: Run cargo fmt
josephlr Jul 22, 2020
24e5886
bsd_arandom: Read only 256 bytes at a time
josephlr Aug 14, 2020
2723e7f
travis: Apply #157 to 0.2 branch
josephlr Sep 8, 2020
0a5017e
Update MSRV to 1.34
josephlr Sep 8, 2020
d8679fb
travis: Update pinned dependancies
josephlr Sep 8, 2020
9ec7d21
travis: Move cloudabi to xbuild section
josephlr Sep 8, 2020
7dcb167
travis: Stop Pinning nightly
josephlr Sep 8, 2020
c36dc82
travis: Stop pinning nightly on 0.2
josephlr Sep 8, 2020
4d750dd
travis: Enable Firefox testing
josephlr Sep 9, 2020
99260df
Update docs for 0.2
josephlr May 25, 2020
4f4009a
Format compile_error!
josephlr Sep 8, 2020
e8ff222
docs: Update wasm32 support section
josephlr Sep 8, 2020
b416060
docs: Clarify when/where to use custom implementations
josephlr Sep 8, 2020
bf6d124
travis: Make sure to run docs tests for all features
josephlr Sep 9, 2020
a6fa63c
docs: Update section headers
josephlr Sep 9, 2020
1ebd2ce
docs: Clarify intended usage for Custom RNGs
josephlr Sep 9, 2020
b8c0c8d
custom: Add check for function type
josephlr Sep 9, 2020
e0c155e
docs: Clarify deps of root binary crate
josephlr Sep 9, 2020
b929998
docs: add target triple to docs table
josephlr Sep 10, 2020
5f4886b
Merge branch 'master' into 0.2
josephlr Sep 10, 2020
5d2a4a2
Update Changelog for 0.2
josephlr Sep 10, 2020
7dd681e
Update to cfg-if 1.0
mbrubeck Oct 12, 2020
3a7e605
Update wasi to 0.10
koushiro Oct 16, 2020
c29dd5f
Fix multithreaded wasm crash (solves #164) (#165)
chemicstry Oct 26, 2020
2d89994
Enable travis for 0.1 branch
josephlr Oct 28, 2020
6f11660
Migrate CI to GitHub Actions (#180)
newpavlov Dec 14, 2020
b4834a5
Fix redox<->cloudabi mixup in supported targets list (#182)
icewind1991 Dec 18, 2020
9b4bb00
Remove CloudABI support (#184)
newpavlov Jan 2, 2021
77740f8
remove direct stdweb support (#178)
newpavlov Jan 2, 2021
cadf11e
Fix clippy warning (#187)
newpavlov Jan 2, 2021
b78e2e8
Update badges (#189)
josephlr Jan 3, 2021
ffb7215
Remove RtlGenRandom implementation
josephlr Jan 2, 2021
a0d23eb
Rename BCryptGenRandom impl to windows.rs
josephlr Jan 2, 2021
a37be0d
Fix Target Triple
josephlr Jan 3, 2021
95be9b4
Release v0.2.1 (#188)
newpavlov Jan 4, 2021
6c94834
Remove outdated entries from Cargo.toml (#193)
newpavlov Jan 4, 2021
3303349
Use -Z build-std=core instead of xbuild
josephlr Jan 3, 2021
d5186e0
Add Clippy msrv configuration file
josephlr Jan 3, 2021
ea73f5a
Update CI
josephlr Jan 3, 2021
7687498
Only test macOS on stable
josephlr Jan 3, 2021
e593f43
Clarify use of .cargo/config
josephlr Jan 4, 2021
7b8f2ba
Note that installed binaries are precompiled
josephlr Jan 4, 2021
1c6749e
Merge pull request #192 from rust-random/ci
josephlr Jan 4, 2021
e29ed04
Move tests to tests/ directory (#195)
josephlr Jan 4, 2021
9d7a76c
Add Emscripten tests (#196)
josephlr Jan 5, 2021
347a300
Add test for custom RNG handler (#197)
josephlr Jan 5, 2021
03cc4f7
Cache Cargo index and Rust build directory
josephlr Jan 14, 2021
3661e9d
Properly forward `rustc-dep-of-std` feature
josephlr Jan 14, 2021
9a48bfa
Merge pull request #198 from rust-random/hermit
josephlr Jan 17, 2021
69634b7
Use doc_cfg to improve register_custom_getrandom docs
newpavlov Jan 17, 2021
2cfbd8e
Modify doc tests to set `docsrs`
josephlr Jan 19, 2021
d7a0d58
Set doc(cfg(feature = "std")) on std trait impls
josephlr Jan 19, 2021
27b5172
Merge pull request #200 from rust-random/doc_feature
josephlr Jan 19, 2021
d79de0c
Release v0.2.2 (#201)
newpavlov Jan 19, 2021
9b2d558
Fix WASI function name and doc link (#202)
newpavlov Feb 2, 2021
c4a0004
Replace build.rs with link attributes (#205)
newpavlov Feb 17, 2021
0eb0be1
Update docs and compile_errors for wasm32-unknown-unknown (#209)
josephlr Mar 6, 2021
36d085a
Add support for getrandom syscall on DragonFly BSD (#210)
tklauser Apr 4, 2021
3d60f91
Merge branch 'main'
m-ou-se Apr 11, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .cargo/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Allow normal use of "cargo run" and "cargo test" on these wasm32 platforms.
[target.wasm32-unknown-unknown]
runner = 'wasm-bindgen-test-runner'
[target.wasm32-wasi]
runner = 'wasmtime'

# Just run on node by default (that's where emscripten is tested)
[target.'cfg(target_os = "emscripten")']
runner = 'node'
1 change: 1 addition & 0 deletions .clippy.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
msrv = "1.34"
335 changes: 335 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,335 @@
name: Tests

on:
push:
branches: master
pull_request:
branches: master
schedule:
- cron: "0 12 * * 1"

env:
CARGO_INCREMENTAL: 0
RUSTFLAGS: "-Dwarnings"

jobs:
check-doc:
name: Docs, deadlinks, minimal dependencies
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly # Needed for -Z minimal-versions and doc_cfg
override: true
- uses: Swatinem/rust-cache@v1
- name: Install precompiled cargo-deadlinks
run: |
export URL=$(curl -s https://api.github.com/repos/deadlinks/cargo-deadlinks/releases/latest | jq -r '.assets[] | select(.name | contains("cargo-deadlinks-linux")) | .browser_download_url')
wget -O /tmp/cargo-deadlinks $URL
chmod +x /tmp/cargo-deadlinks
mv /tmp/cargo-deadlinks ~/.cargo/bin
- name: Generate Docs
env:
RUSTDOCFLAGS: --cfg docsrs
run: cargo deadlinks -- --features=custom,std
- run: |
cargo generate-lockfile -Z minimal-versions
cargo test --features=custom,std

main-tests:
name: Main tests
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
toolchain: [nightly, beta, stable, 1.34]
# Only Test macOS on stable to reduce macOS CI jobs
include:
- os: macos-latest
toolchain: stable
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.toolchain }}
override: true
- uses: Swatinem/rust-cache@v1
- run: cargo test
- run: cargo test --features=std
- run: cargo test --features=custom # custom should do nothing here
- if: ${{ matrix.toolchain == 'nightly' }}
run: cargo build --benches

linux-tests:
name: Additional Linux targets
runs-on: ubuntu-latest
strategy:
matrix:
target: [
x86_64-unknown-linux-musl,
i686-unknown-linux-gnu,
i686-unknown-linux-musl,
]
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
target: ${{ matrix.target }}
toolchain: stable
- uses: Swatinem/rust-cache@v1
- name: Install multilib
# update is needed to fix the 404 error on install, see:
# https://github.com/actions/virtual-environments/issues/675
run: |
sudo apt-get update
sudo apt-get install gcc-multilib
- run: cargo test --target=${{ matrix.target }} --features=std

# We can only Build/Link on these targets for now.
# TODO: Run the iOS binaries in the simulator
# TODO: build/run aarch64-apple-darwin binaries on a x86_64 Mac
apple-tests:
name: Additional Apple targets
runs-on: macos-latest
strategy:
matrix:
target: [
aarch64-apple-ios,
x86_64-apple-ios,
]
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
target: ${{ matrix.target }}
toolchain: stable
- uses: Swatinem/rust-cache@v1
- name: Build Tests
run: cargo test --no-run --target=${{ matrix.target }} --features=std

windows-tests:
name: Additional Windows targets
runs-on: windows-latest
strategy:
matrix:
toolchain: [
stable-x86_64-gnu,
stable-i686-gnu,
stable-i686-msvc,
]
steps:
- uses: actions/checkout@v2
- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.toolchain }}
override: true
- uses: Swatinem/rust-cache@v1
- run: cargo test --features=std

cross-tests:
name: Cross Test
runs-on: ubuntu-latest
strategy:
matrix:
target: [
aarch64-unknown-linux-gnu,
aarch64-linux-android,
mips-unknown-linux-gnu,
]
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
target: ${{ matrix.target }}
toolchain: stable
- uses: Swatinem/rust-cache@v1
- name: Install precompiled cross
run: |
export URL=$(curl -s https://api.github.com/repos/rust-embedded/cross/releases/latest | jq -r '.assets[] | select(.name | contains("x86_64-unknown-linux-gnu.tar.gz")) | .browser_download_url')
wget -O /tmp/binaries.tar.gz $URL
tar -C /tmp -xzf /tmp/binaries.tar.gz
mv /tmp/cross ~/.cargo/bin
- name: Test
run: cross test --no-fail-fast --target=${{ matrix.target }} --features=std

cross-link:
name: Cross Build/Link
runs-on: ubuntu-latest
strategy:
matrix:
target: [
x86_64-sun-solaris,
x86_64-unknown-netbsd,
]
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
target: ${{ matrix.target }}
toolchain: stable
- uses: Swatinem/rust-cache@v1
- name: Install precompiled cross
run: |
export URL=$(curl -s https://api.github.com/repos/rust-embedded/cross/releases/latest | jq -r '.assets[] | select(.name | contains("x86_64-unknown-linux-gnu.tar.gz")) | .browser_download_url')
wget -O /tmp/binaries.tar.gz $URL
tar -C /tmp -xzf /tmp/binaries.tar.gz
mv /tmp/cross ~/.cargo/bin
- name: Build Tests
run: cross test --no-run --target=${{ matrix.target }} --features=std

web-tests:
name: Web tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
target: wasm32-unknown-unknown
toolchain: stable
- uses: Swatinem/rust-cache@v1
- name: Install precompiled wasm-bindgen-test-runner
run: |
export VERSION=$(cargo metadata --format-version=1 | jq -r '.packages[] | select ( .name == "wasm-bindgen" ) | .version')
wget -O /tmp/binaries.tar.gz https://github.com/rustwasm/wasm-bindgen/releases/download/$VERSION/wasm-bindgen-$VERSION-x86_64-unknown-linux-musl.tar.gz
tar -C /tmp -xzf /tmp/binaries.tar.gz --strip-components=1
mv /tmp/wasm-bindgen-test-runner ~/.cargo/bin
- name: Test (Node)
run: cargo test --target=wasm32-unknown-unknown --features=js
- name: Test (Firefox)
env:
GECKODRIVER: /usr/bin/geckodriver
run: cargo test --target=wasm32-unknown-unknown --features=js,test-in-browser
- name: Test (Chrome)
env:
CHROMEDRIVER: /usr/bin/chromedriver
run: cargo test --target=wasm32-unknown-unknown --features=js,test-in-browser
- name: Test (custom getrandom)
run: cargo test --target=wasm32-unknown-unknown --features=custom

wasi-tests:
name: WASI test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
target: wasm32-wasi
toolchain: stable
- uses: Swatinem/rust-cache@v1
- name: Install precompiled wasmtime
run: |
export URL=$(curl -s https://api.github.com/repos/bytecodealliance/wasmtime/releases/latest | jq -r '.assets[] | select(.name | contains("x86_64-linux.tar.xz")) | .browser_download_url')
wget -O /tmp/binaries.tar.xz $URL
tar -C /tmp -xf /tmp/binaries.tar.xz --strip-components=1
mv /tmp/wasmtime ~/.cargo/bin
- run: cargo test --target wasm32-wasi

emscripten-tests:
name: Emscripten tests
runs-on: ubuntu-latest
env:
EMSDK_VERSION: 1.39.20 # Last emsdk compatible with Rust's LLVM 11
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
- run: rustup target add wasm32-unknown-emscripten
- run: rustup target add asmjs-unknown-emscripten
- uses: Swatinem/rust-cache@v1
- name: Cache emsdk
id: cache-emsdk
uses: actions/cache@v2
with:
path: ~/emsdk
key: ${{ runner.os }}-${{ env.EMSDK_VERSION }}-emsdk
- name: Install emsdk
if: steps.cache-emsdk.outputs.cache-hit != 'true'
run: |
git clone https://github.com/emscripten-core/emsdk.git ~/emsdk
cd ~/emsdk
./emsdk install $EMSDK_VERSION
./emsdk activate $EMSDK_VERSION
- run: echo "$HOME/emsdk/upstream/emscripten" >> $GITHUB_PATH
- name: wasm test
run: cargo test --target=wasm32-unknown-emscripten --features=std
- name: asm.js test
run: | # Debug info breaks on asm.js
RUSTFLAGS="$RUSTFLAGS -C debuginfo=0"
cargo test --target=asmjs-unknown-emscripten --features=std

build:
name: Build only
runs-on: ubuntu-latest
strategy:
matrix:
target: [
x86_64-unknown-freebsd,
x86_64-fuchsia,
x86_64-unknown-redox,
x86_64-fortanix-unknown-sgx,
]
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
target: ${{ matrix.target }}
toolchain: nightly # Required to build libc for Redox
override: true
- uses: Swatinem/rust-cache@v1
- name: Build
run: cargo build --target=${{ matrix.target }} --features=std

build-std:
name: Build-only (build-std)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly # Required to build libcore
components: rust-src
override: true
- uses: Swatinem/rust-cache@v1
- name: UEFI (RDRAND)
run: cargo build -Z build-std=core --features=rdrand --target=x86_64-unknown-uefi
- name: Hermit (RDRAND)
run: cargo build -Z build-std=core --features=rdrand --target=x86_64-unknown-hermit
- name: L4Re (RDRAND)
run: cargo build -Z build-std=core --features=rdrand --target=x86_64-unknown-l4re-uclibc
- name: VxWorks
run: cargo build -Z build-std=core --target=x86_64-wrs-vxworks

clippy-fmt:
name: Clippy + rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1
with:
profile: minimal
# https://github.com/rust-lang/rust-clippy/pull/6379 added MSRV
# support, so we need to use nightly until this is on stable.
toolchain: nightly
components: rustfmt, clippy
override: true
- uses: Swatinem/rust-cache@v1
- name: clippy
run: cargo clippy --all --features=custom,std
- name: fmt
run: cargo fmt --all -- --check
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/target
**/*.rs.bk
Cargo.lock
*.ts
*.js
*.wasm
Loading