Skip to content

test 6

test 6 #56

Workflow file for this run

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