|
| 1 | +name: Build |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - 'master' |
| 7 | + tags: |
| 8 | + - '*' |
| 9 | + schedule: |
| 10 | + - cron: '40 4 * * *' # every day at 4:40 |
| 11 | + pull_request: |
| 12 | + |
| 13 | +jobs: |
| 14 | + test: |
| 15 | + name: "Test" |
| 16 | + |
| 17 | + strategy: |
| 18 | + matrix: |
| 19 | + platform: [ |
| 20 | + ubuntu-latest, |
| 21 | + macos-latest, |
| 22 | + windows-latest |
| 23 | + ] |
| 24 | + |
| 25 | + runs-on: ${{ matrix.platform }} |
| 26 | + timeout-minutes: 15 |
| 27 | + |
| 28 | + steps: |
| 29 | + - name: "Checkout Repository" |
| 30 | + uses: actions/checkout@v1 |
| 31 | + |
| 32 | + - name: Install Rustup (macOS) |
| 33 | + run: | |
| 34 | + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y |
| 35 | + echo ::add-path::$HOME/.cargo/bin |
| 36 | + if: runner.os == 'macOS' |
| 37 | + |
| 38 | + - name: Set Rustup profile to minimal |
| 39 | + run: rustup set profile minimal |
| 40 | + |
| 41 | + - name: "Print Rust Version" |
| 42 | + run: | |
| 43 | + rustc -Vv |
| 44 | + cargo -Vv |
| 45 | +
|
| 46 | + - name: "Run cargo build" |
| 47 | + run: cargo build |
| 48 | + |
| 49 | + - name: "Run cargo test" |
| 50 | + run: cargo test |
| 51 | + |
| 52 | + - name: "Deny Warnings" |
| 53 | + run: cargo build |
| 54 | + env: |
| 55 | + RUSTFLAGS: "-D warnings" |
| 56 | + |
| 57 | + - name: "Install it" |
| 58 | + run: cargo install --path . |
| 59 | + |
| 60 | + - name: "Switch to Rust nightly" |
| 61 | + run: rustup default nightly |
| 62 | + |
| 63 | + - name: "Install Rustup Components" |
| 64 | + run: rustup component add rust-src llvm-tools-preview |
| 65 | + - name: "Install cargo-xbuild" |
| 66 | + run: cargo install cargo-xbuild --debug |
| 67 | + |
| 68 | + # install QEMU |
| 69 | + - name: Install QEMU (Linux) |
| 70 | + run: | |
| 71 | + sudo apt update |
| 72 | + sudo apt install qemu-system-x86 |
| 73 | + if: runner.os == 'Linux' |
| 74 | + - name: Install QEMU (macOS) |
| 75 | + run: brew install qemu |
| 76 | + if: runner.os == 'macOS' |
| 77 | + env: |
| 78 | + HOMEBREW_NO_AUTO_UPDATE: 1 |
| 79 | + HOMEBREW_NO_BOTTLE_SOURCE_FALLBACK: 1 |
| 80 | + HOMEBREW_NO_INSTALL_CLEANUP: 1 |
| 81 | + - name: Install Scoop (Windows) |
| 82 | + run: | |
| 83 | + Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh') |
| 84 | + echo ::add-path::$HOME\scoop\shims |
| 85 | + if: runner.os == 'Windows' |
| 86 | + shell: pwsh |
| 87 | + - name: Install QEMU (Windows) |
| 88 | + run: scoop install qemu |
| 89 | + if: runner.os == 'Windows' |
| 90 | + shell: pwsh |
| 91 | + |
| 92 | + - name: "Print QEMU Version" |
| 93 | + run: qemu-system-x86_64 --version |
| 94 | + |
| 95 | + - name: 'Build "basic" Kernel' |
| 96 | + run: cargo bootimage --target ../x86_64-bootimage-example-kernels.json |
| 97 | + working-directory: example-kernels/basic |
| 98 | + |
| 99 | + - name: 'Run QEMU with "basic" Kernel' |
| 100 | + run: | |
| 101 | + qemu-system-x86_64 -drive format=raw,file=target/x86_64-bootimage-example-kernels/debug/bootimage-basic.bin -device isa-debug-exit,iobase=0xf4,iosize=0x04 -display none |
| 102 | + if [ $? -eq 103 ]; then (exit 0); else (exit 1); fi |
| 103 | + shell: bash {0} |
| 104 | + working-directory: example-kernels |
| 105 | + |
| 106 | + - name: 'Run `cargo xrun` for "runner" kernel' |
| 107 | + run: | |
| 108 | + cargo xrun |
| 109 | + if [ $? -eq 109 ]; then (exit 0); else (exit 1); fi |
| 110 | + shell: bash {0} |
| 111 | + working-directory: example-kernels/runner |
| 112 | + |
| 113 | + - run: cargo xtest |
| 114 | + working-directory: example-kernels/runner-test |
| 115 | + name: 'Run `cargo xtest` for "runner-test" kernel' |
| 116 | + |
| 117 | + - run: cargo xtest -Z doctest-xcompile |
| 118 | + working-directory: example-kernels/runner-doctest |
| 119 | + name: 'Run `cargo xtest -Z doctest-xcompile` for "runner-doctest" kernel' |
| 120 | + |
| 121 | + check_formatting: |
| 122 | + name: "Check Formatting" |
| 123 | + runs-on: ubuntu-latest |
| 124 | + timeout-minutes: 2 |
| 125 | + steps: |
| 126 | + - uses: actions/checkout@v1 |
| 127 | + - run: rustup toolchain install nightly --profile minimal --component rustfmt |
| 128 | + - run: cargo +nightly fmt -- --check |
| 129 | + |
| 130 | + clippy: |
| 131 | + name: "Clippy" |
| 132 | + runs-on: ubuntu-latest |
| 133 | + timeout-minutes: 10 |
| 134 | + steps: |
| 135 | + - uses: actions/checkout@v1 |
| 136 | + - run: rustup toolchain install nightly --profile minimal --component clippy |
| 137 | + - run: cargo +nightly clippy -- -D warnings |
0 commit comments