Skip to content

Commit

Permalink
multi-platform build
Browse files Browse the repository at this point in the history
Signed-off-by: William Casarin <[email protected]>
  • Loading branch information
jb55 committed Nov 28, 2024
1 parent 9906cb0 commit aac7143
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 14 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Build & Test

on:
workflow_call:
inputs:
os:
required: true
type: string
additional-setup:
required: false
type: string

jobs:
run:
runs-on: ${{ inputs.os }}
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
submodules: recursive

- name: Rust toolchain
uses: dtolnay/rust-toolchain@stable

- name: Rust cache
uses: Swatinem/rust-cache@v2

- name: Additional Setup (if specified)
if: ${{ inputs.additional-setup != '' }}
run: ${{ inputs.additional-setup }}

- name: Run Tests
run: cargo test --release

- name: Build
run: cargo build --release
51 changes: 37 additions & 14 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,47 @@
name: Rust

on:
push:
branches: [ "master", "ci" ]
pull_request:
branches: [ "master" ]
on: [pull_request]

env:
CARGO_TERM_COLOR: always

jobs:
build:

fmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- run: cargo fmt --all -- --check

clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Initialize Submodules
run: git submodule update --init --recursive
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- run: cargo clippy -- -D warnings

linux-build-test:
name: Build and Test (Linux)
uses: ./.github/workflows/build-and-test.yml
with:
os: ubuntu-latest

macos-build-test:
name: Build and Test (macOS)
uses: ./.github/workflows/build-and-test.yml
with:
os: macos-latest

windows-build-test:
name: Build and Test (Windows)
uses: ./.github/workflows/build-and-test.yml
with:
os: windows-latest

0 comments on commit aac7143

Please sign in to comment.