mirror of
https://github.com/phil-opp/blog_os.git
synced 2025-12-16 14:27:49 +00:00
81 lines
1.9 KiB
YAML
81 lines
1.9 KiB
YAML
name: Build Code
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- '*'
|
|
- '!staging.tmp'
|
|
tags:
|
|
- '*'
|
|
schedule:
|
|
- cron: '40 3 * * *' # every day at 3:40
|
|
pull_request:
|
|
|
|
jobs:
|
|
test:
|
|
name: "Test"
|
|
|
|
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: "Add thumbv7em-none-eabihf Target"
|
|
run: rustup target add thumbv7em-none-eabihf
|
|
|
|
- name: "Build for thumbv7em-none-eabihf"
|
|
run: cargo build --target thumbv7em-none-eabihf
|
|
|
|
- name: "Build for Linux"
|
|
if: runner.os == 'Linux'
|
|
run: cargo rustc -- -C link-arg=-nostartfiles
|
|
|
|
- name: "Build for macOS"
|
|
if: runner.os == 'macOS'
|
|
run: cargo rustc -- -C link-args="-e __start -static -nostartfiles"
|
|
|
|
- name: "Build for Windows"
|
|
if: runner.os == 'Windows'
|
|
run: cargo rustc -- -C link-args="/ENTRY:_start /SUBSYSTEM:console"
|
|
|
|
|
|
check_formatting:
|
|
name: "Check Formatting"
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 2
|
|
steps:
|
|
- uses: actions/checkout@v1
|
|
- name: "Find latest Nightly with rustfmt"
|
|
id: component
|
|
uses: actions-rs/components-nightly@v1
|
|
with:
|
|
component: rustfmt
|
|
- name: "Add a rustup override for rustfmt nightly"
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: ${{ steps.component.outputs.toolchain }}
|
|
override: true
|
|
- run: rustup component add rustfmt
|
|
- run: cargo fmt -- --check
|