-
-
Notifications
You must be signed in to change notification settings - Fork 0
81 lines (64 loc) · 2.14 KB
/
rust.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
name: Rust OS Kernel Tests
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
permissions:
issues: write
contents: read
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y qemu-system-x86
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true
components: rust-src, llvm-tools-preview
- name: Install bootimage
run: cargo install bootimage
- name: Add custom target
run: |
mkdir -p ~/.cargo
echo '[build]' > ~/.cargo/config.toml
echo 'target = "x86_64-PortfoliOS.json"' >> ~/.cargo/config.toml
- name: Build kernel
run: cargo build --verbose
- name: Run tests
id: test
run: cargo test --verbose
continue-on-error: true
timeout-minutes: 10
- name: Create issue on test failure
if: steps.test.outcome == 'failure'
uses: actions/github-script@v6
with:
script: |
const testOutput = `${{ steps.test.outputs.stderr || steps.test.outputs.stdout }}`;
await github.rest.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: `🔴 Test Failure in commit ${context.sha.slice(0, 7)}`,
body: `Tests failed in [commit ${context.sha}](${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/commit/${context.sha})
<details>
<summary>Test Output</summary>
\`\`\`
${testOutput}
\`\`\`
</details>
[View Run](${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId})
`,
labels: ['bug', 'test-failure']
});
- name: Fail workflow if tests failed
if: steps.test.outcome == 'failure'
run: exit 1