-
Notifications
You must be signed in to change notification settings - Fork 3
195 lines (183 loc) · 6.27 KB
/
ci.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
name: Rust
on:
push:
branches:
- '*'
- '!gh-pages'
pull_request:
env:
# rust 1.68
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
jobs:
build:
runs-on: windows-latest
env:
RUST_BACKTRACE: 1
MIRIFLAGS: -Zmiri-disable-isolation
# taken from <rustc/src/ci/scripts/install-mingw.sh>.
MIRRORS_BASE: https://ci-mirrors.rust-lang.org/rustc
strategy:
matrix:
target:
- x86_64-pc-windows-msvc
- i686-pc-windows-msvc
- x86_64-pc-windows-gnu
- i686-pc-windows-gnu
include:
- target: x86_64-pc-windows-gnu
archive: x86_64-12.2.0-release-posix-seh-rt_v10-rev0.7z
mingw_dir: mingw64
- target: i686-pc-windows-gnu
archive: i686-12.2.0-release-posix-dwarf-rt_v10-rev0.7z
mingw_dir: mingw32
steps:
- uses: actions/checkout@v4
- run: |
rustup set auto-self-update disable
rustup toolchain install stable-${{ matrix.target }}
rustup default stable-${{ matrix.target }}
- name: Check out MinGW toolchain
# NOTE: The self-contained rust-mingw is enough for linking to Windows.
# Full MinGW toolchain is only needed when compiling C code.
#if: matrix.mingw_dir
if: false
run: |
set -x
curl -sSf -O "$MIRRORS_BASE/${{ matrix.archive }}"
7z x -y "${{ matrix.archive }}" -o/c/mingw
rm "${{ matrix.archive }}"
ls -l "/c/mingw/${{ matrix.mingw_dir }}/bin"
echo "C:\mingw\${{ matrix.mingw_dir }}\bin" >> $GITHUB_PATH
shell: bash
- run: cargo fetch
- run: cargo build
- run: cargo build --features nightly
- run: cargo build --all-targets
- run: cargo test
- run: cargo test --no-default-features
# NOTE: miri still needs to support more Windows API shims
- if: false
run: |
rustup component add miri
cargo clean
cargo miri setup
cargo miri test
- if: failure()
run: |
Set-PSDebug -Trace 1
Get-ChildItem -Path target\debug\junction-test-*\ | Select-Object FullName, Target
Get-ChildItem -Path target\debug\junction-test-*\junction | Select-Object FullName, Target
shell: powershell
- if: failure()
run: |
dir /aL C:\
dir /aL C:\Users
shell: cmd
msrv:
runs-on: windows-latest
# needs: [build]
env:
# assert! in consts
MSRV: 1.57.0
steps:
- uses: actions/checkout@v4
- run: |
rustup set auto-self-update disable
rustup toolchain install ${{ env.MSRV }}
rustup default ${{ env.MSRV }}
- run: |
rustup run stable cargo fetch
- run: |
cargo build --locked
rustfmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: cargo fmt -- --check
rustdoc:
runs-on: windows-latest
steps:
- name: Before checking out source and change \n -> \r\n
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- uses: actions/checkout@v4
- run: |
rustup set auto-self-update disable
rustup toolchain install nightly
rustup default nightly
- run: cargo doc --all --no-deps # --document-private-items
- run: echo '<meta http-equiv=refresh content=0;url=junction/index.html>' > target/doc/index.html
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: target/doc
retention-days: 1
deploy:
if: github.event_name != 'pull_request' && github.event.ref == 'refs/heads/main'
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
needs: [rustdoc]
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
uses: actions/deploy-pages@v4
clippy:
runs-on: windows-latest
needs: [build]
steps:
- uses: actions/checkout@v4
- run: |
rustup set auto-self-update disable
rustup toolchain install nightly -c clippy
rustup default nightly
- run: cargo fetch
- run: cargo clippy --all-targets --all-features -- -Dwarnings
# Use static analyzer Rudra <https://github.com/sslab-gatech/Rudra>.
# FIXME: Disable for now since it's very costly to run.
rudra:
if: false
runs-on: ubuntu-latest
env:
MSRV: nightly-2021-08-20
WIN_TARGET: x86_64-pc-windows-gnu
steps:
- uses: actions/checkout@v4
with:
path: junction
- uses: actions/checkout@v4
with:
repository: sslab-gatech/Rudra
path: Rudra
- name: setup
shell: bash
run: |
# Toolchain setup
rustup set auto-self-update disable
rustup toolchain install ${{ env.MSRV }} -c rustc-dev -c miri
rustup default ${{ env.MSRV }}
rustup target add ${{ env.WIN_TARGET }}
# Environment variable setup, put these in your `.bashrc`
export RUDRA_RUST_CHANNEL=${{ env.MSRV }}
export RUDRA_RUNNER_HOME="$HOME/rudra-home"
./setup_rudra_runner_home.py ${RUDRA_RUNNER_HOME}
RUDRA_LIB=$HOME/.rustup/toolchains/${RUDRA_RUST_CHANNEL}-x86_64-unknown-linux-gnu/lib
export RUSTFLAGS="-L ${RUDRA_LIB}"
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${RUDRA_LIB}"
echo "RUDRA_RUNNER_HOME=${RUDRA_RUNNER_HOME}" >> $GITHUB_ENV
echo "RUDRA_RUST_CHANNEL=${RUDRA_RUST_CHANNEL}" >> $GITHUB_ENV
echo "RUSTFLAGS=${RUSTFLAGS}" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=${LD_LIBRARY_PATH}" >> $GITHUB_ENV
working-directory: Rudra
- name: run
run: |
./install-release.sh
shell: bash
working-directory: Rudra
- run: |
# for single file testing (you need to set library include path, or use `cargo run` instead)
# rudra --crate-type lib tests/unsafe_destructor/normal1.rs
cargo rudra --target ${{ env.WIN_TARGET }} --all-targets # for crate compilation
working-directory: junction