Skip to content

Commit

Permalink
Merge pull request #835 from phil-opp/post-02-Zbuild-std
Browse files Browse the repository at this point in the history
Migrate post-02 code from cargo-xbuild to `-Zbuild-std`
  • Loading branch information
phil-opp authored Jul 17, 2020
2 parents b1bf087 + 44d7654 commit 4bbaae2
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 42 deletions.
3 changes: 3 additions & 0 deletions .cargo/config → .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[unstable]
build-std = ["core", "compiler_builtins"]

[build]
target = "x86_64-blog_os.json"

Expand Down
111 changes: 72 additions & 39 deletions .github/workflows/build-code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,59 +12,92 @@ on:
pull_request:

jobs:
test:
name: "Test"

check:
name: Check
strategy:
matrix:
platform: [
ubuntu-latest,
macos-latest,
windows-latest
]

runs-on: ${{ matrix.platform }}
timeout-minutes: 15

steps:
- name: "Checkout Repository"
uses: actions/checkout@v1

- name: Install Rustup
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain nightly
echo ::add-path::$HOME/.cargo/bin
if: runner.os == 'macOS'

- name: "Print Rust Version"
run: |
rustc -Vv
cargo -Vv
- name: "Install Rustup Components"
run: rustup component add rust-src llvm-tools-preview
- name: "Install cargo-xbuild"
run: cargo install cargo-xbuild --debug
- name: "Install bootimage"
run: cargo install bootimage --debug

- name: "Run cargo xbuild"
run: cargo xbuild
- name: "Create Bootimage"
run: cargo bootimage
- name: Checkout Repository
uses: actions/checkout@v2
- name: Install Rust Toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
- name: Install `rust-src` Rustup Component
run: rustup component add rust-src
- name: Run `cargo check`
uses: actions-rs/cargo@v1
with:
command: check

test:
name: Test
strategy:
matrix:
platform: [
ubuntu-latest,
macos-latest,
windows-latest
]
runs-on: ${{ matrix.platform }}
steps:
- name: Install Rust Toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
- name: Install bootimage
run: cargo install bootimage --debug
- name: Checkout Repository
uses: actions/checkout@v2
- name: Install Rustup Components
run: rustup component add rust-src llvm-tools-preview
- name: Run `cargo bootimage`
uses: actions-rs/cargo@v1
with:
command: bootimage

check_formatting:
name: "Check Formatting"
name: Check Formatting
runs-on: ubuntu-latest
timeout-minutes: 2
steps:
- uses: actions/checkout@v1
- name: "Use the latest Rust nightly with rustfmt"
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
- name: Checkout Repository
uses: actions/checkout@v2
- name: Install Rust Toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
components: rustfmt
override: true
- run: cargo fmt -- --check
- name: Run `cargo fmt`
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check

clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Install Rust Toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
components: clippy, rust-src
override: true
- name: Run `cargo clippy`
uses: actions-rs/cargo@v1
with:
command: clippy
args: -- -D warnings
11 changes: 9 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ authors = ["Philipp Oppermann <[email protected]>"]
edition = "2018"

[dependencies]
bootloader = "0.9.3"
bootloader = "0.9.8"
rlibc = "1.0.0"
2 changes: 2 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#![no_std]
#![no_main]

extern crate rlibc;

use core::panic::PanicInfo;

static HELLO: &[u8] = b"Hello World!";
Expand Down

0 comments on commit 4bbaae2

Please sign in to comment.