Skip to content

Commit 935dacc

Browse files
committed
Add example kernels and azure pipelines CI script
1 parent 2e98cbe commit 935dacc

26 files changed

+1753
-0
lines changed

azure-pipelines.yml

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
# Documentation: https://aka.ms/yaml
2+
3+
trigger:
4+
batch: true
5+
branches:
6+
include:
7+
# This is where pull requests from "bors r+" are built.
8+
- staging
9+
# This is where pull requests from "bors try" are built.
10+
- trying
11+
# Build pull requests.
12+
- master
13+
14+
strategy:
15+
matrix:
16+
linux:
17+
image_name: 'ubuntu-16.04'
18+
rustup_toolchain: stable
19+
mac:
20+
image_name: 'macos-10.13'
21+
rustup_toolchain: stable
22+
windows:
23+
image_name: 'vs2017-win2016'
24+
rustup_toolchain: stable
25+
26+
pool:
27+
vmImage: $(image_name)
28+
29+
steps:
30+
- bash: |
31+
echo "Hello world from $AGENT_NAME running on $AGENT_OS"
32+
echo "Reason: $BUILD_REASON"
33+
case "$BUILD_REASON" in
34+
"Manual") echo "$BUILD_REQUESTEDFOR manually queued the build." ;;
35+
"PullRequest") echo "This is a CI build for a pull request on $BUILD_REQUESTEDFOR." ;;
36+
"IndividualCI") echo "This is a CI build for $BUILD_REQUESTEDFOR." ;;
37+
"BatchedCI") echo "This is a batched CI build for $BUILD_REQUESTEDFOR." ;;
38+
*) "$BUILD_REASON" ;;
39+
esac
40+
displayName: 'Build Info'
41+
continueOnError: true
42+
43+
- script: |
44+
set -euxo pipefail
45+
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain $RUSTUP_TOOLCHAIN
46+
echo "##vso[task.setvariable variable=PATH;]$PATH:$HOME/.cargo/bin"
47+
condition: or(eq( variables['Agent.OS'], 'Linux' ), eq( variables['Agent.OS'], 'Darwin' ))
48+
displayName: 'Install Rust (Linux/macOS)'
49+
50+
- script: curl -sSf -o rustup-init.exe https://win.rustup.rs && rustup-init.exe -y --default-toolchain %RUSTUP_TOOLCHAIN%
51+
condition: eq( variables['Agent.OS'], 'Windows_NT' )
52+
displayName: 'Install Rust (Windows)'
53+
54+
- script: |
55+
echo ##vso[task.setvariable variable=PATH;]%PATH%;%USERPROFILE%\.cargo\bin
56+
condition: eq( variables['Agent.OS'], 'Windows_NT' )
57+
displayName: 'Add ~/.cargo/bin to PATH (Windows)'
58+
59+
- script: |
60+
rustc -Vv
61+
cargo -V
62+
displayName: 'Print Rust Version'
63+
continueOnError: true
64+
65+
- script: cargo build
66+
displayName: 'Build'
67+
68+
- script: cargo test
69+
displayName: 'Test'
70+
71+
- script: rustup component add rust-src llvm-tools-preview
72+
displayName: 'Install Rustup Components'
73+
74+
- script: cargo install cargo-xbuild --debug
75+
displayName: 'Install cargo-xbuild'
76+
77+
- script: sudo apt update && sudo apt install qemu-system-x86
78+
condition: eq( variables['Agent.OS'], 'Linux' )
79+
displayName: 'Install QEMU (Linux)'
80+
81+
- script: |
82+
set -euxo pipefail
83+
export HOMEBREW_NO_AUTO_UPDATE=1
84+
export HOMEBREW_NO_BOTTLE_SOURCE_FALLBACK=1
85+
export HOMEBREW_NO_INSTALL_CLEANUP=1
86+
brew install qemu
87+
condition: eq( variables['Agent.OS'], 'Darwin' )
88+
displayName: 'Install QEMU (macOS)'
89+
90+
- script: |
91+
choco install qemu --limit-output --no-progress
92+
echo ##vso[task.setvariable variable=PATH;]%PATH%;C:\Program Files\qemu
93+
set PATH=%PATH%;C:\Program Files\qemu
94+
qemu-system-x86_64 --version
95+
condition: eq( variables['Agent.OS'], 'Windows_NT' )
96+
failOnStderr: true
97+
displayName: 'Install QEMU (Windows)'
98+
99+
- script: cargo install --path . --force --debug
100+
displayName: 'Install this bootimage version'
101+
102+
- script: rustup toolchain add nightly
103+
displayName: 'Install Rust Nightly'
104+
105+
- script: bootimage build --target x86_64-basic.json && file target/x86_64-basic/debug/bootimage-basic.bin
106+
workingDirectory: example-kernels/basic
107+
displayName: 'Build Example Kernel "Basic"'
108+
109+
- script: bootimage run --target x86_64-basic.json
110+
workingDirectory: example-kernels/basic
111+
displayName: 'Run Example Kernel "basic"'
112+
113+
- script: bootimage build && file target/x86_64-default-target/debug/bootimage-default-target-bootimage.bin
114+
workingDirectory: example-kernels/default-target-bootimage
115+
displayName: 'Build Example Kernel "default-target-bootimage"'
116+
117+
- script: bootimage run
118+
workingDirectory: example-kernels/default-target-bootimage
119+
displayName: 'Run Example Kernel "default-target-bootimage"'
120+
121+
- script: bootimage build && file target/x86_64-default-target/debug/bootimage-default-target-cargo.bin
122+
workingDirectory: example-kernels/default-target-cargo
123+
displayName: 'Build Example Kernel "default-target-cargo"'
124+
125+
- script: bootimage run
126+
workingDirectory: example-kernels/default-target-cargo
127+
displayName: 'Run Example Kernel "default-target-cargo"'

example-kernels/basic/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/target/
2+
**/*.rs.bk

0 commit comments

Comments
 (0)