forked from amazon-ion/ion-rust
-
Notifications
You must be signed in to change notification settings - Fork 0
53 lines (50 loc) · 2.31 KB
/
miri.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
name: Miri test
on: [ push, pull_request ]
jobs:
build:
name: Test with Miri
runs-on: ${{ matrix.os }}
# We want to run on external PRs, but not on internal ones as push automatically builds
# H/T: https://github.com/Dart-Code/Dart-Code/commit/612732d5879730608baa9622bf7f5e5b7b51ae65
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != 'amazon-ion/ion-rust'
strategy:
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]
# build and test for experimental features with miri
features: [ 'experimental' ]
permissions:
checks: write
steps:
- name: Git Checkout
uses: actions/checkout@v2
with:
submodules: recursive
- name: Rust Toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
components: miri
override: true
- name: Install Miri
run: |
rustup toolchain install nightly --component miri
rustup override set nightly
cargo miri setup
- name: Test with Miri (ubuntu and macos)
# miri test for Linux and macOS os, since Windows os requires a different syntax to enable miri flags
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
# Miri flags
#
# -Zmiri-disable-isolation
# We need to pass the miri flag to disable host isolation in order to access host for clock information on timestamps
# more information can be found: https://github.com/rust-lang/miri#miri--z-flags-and-environment-variables
#
# -Zmiri-tree-borrows
# Miri's default aliasing model (stacked borrows) is known to be unnecessarily restrictive. Their alternative
# aliasing model (tree borrows) accepts valid programs that stacked borrows would reject.
# For more information, see: https://www.ralfj.de/blog/2023/06/02/tree-borrows.html
run: MIRIFLAGS="-Zmiri-disable-isolation -Zmiri-tree-borrows" cargo miri test serde --features "${{ matrix.features }}"
- name: Test with Miri (windows)
if: matrix.os == 'windows-latest'
run: $env:MIRIFLAGS="-Zmiri-disable-isolation -Zmiri-tree-borrows" ; cargo miri test serde --features "${{ matrix.features }}"