name: Rust
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
steps:
- uses: actions/checkout@v3
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --lib --verbose
- name: Run example with RUSTFLAGS=-nostartfiles (linux)
if: matrix.os == 'ubuntu-latest'
run: |
cargo rustc --example writeln -- -C link_args="-nostartfiles" --cfg nostartfiles
target/debug/examples/writeln
- name: Run example with RUSTFLAGS=-nostartfiles (mac)
if: matrix.os == 'macOS-latest'
run: |
cargo rustc --example writeln -- -C link_args="-e __start -nostartfiles" --cfg nostartfiles
target/debug/examples/writeln
- name: Run example with RUSTFLAGS=-nostartfiles (windows)
if: matrix.os == 'windows-latest'
shell: bash
run: |
cargo rustc --example writeln -- \
--cfg nostartfiles \
-C link-args="/ENTRY:_start /SUBSYSTEM:console /DEFAULTLIB:msvcrt /DEFAULTLIB:ucrt /DEFAULTLIB:vcruntime"
target/debug/examples/writeln