x #105
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: push | |
jobs: | |
check: | |
name: Check | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install stable toolchain | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
components: clippy, rustfmt | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
- name: Check | |
run: cargo check | |
- name: Clippy | |
run: cargo clippy | |
- name: Format | |
run: cargo fmt --check | |
test: | |
name: Test | |
needs: check | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install stable toolchain | |
uses: dtolnay/rust-toolchain@stable | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
- name: Unit tests | |
run: cargo test --workspace | |
fuzz: | |
name: Fuzz | |
needs: check | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install nightly toolchain | |
uses: dtolnay/rust-toolchain@nightly | |
- name: Install cargo-fuzz | |
run: cargo install cargo-fuzz | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
- name: Fuzz | |
run: | | |
for target in $(cargo fuzz list); do | |
cargo fuzz run "$target" -- -runs=1000 | |
done | |
build: | |
name: Build ${{ matrix.target }} | |
needs: [test, fuzz] | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-latest | |
target: x86_64-unknown-linux-gnu | |
- os: macos-latest | |
target: x86_64-apple-darwin | |
- os: macos-latest | |
target: aarch64-apple-darwin | |
- os: windows-latest | |
target: x86_64-pc-windows-msvc | |
suffix: .exe | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install stable toolchain | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
target: ${{ matrix.target }} | |
- name: Build | |
run: cargo build --release --target "${{ matrix.target }}" | |
- name: Package | |
run: | | |
mkdir dist | |
cp "target/${{ matrix.target }}/release/xotpad${{ matrix.suffix }}" dist | |
cp README.md dist | |
cp LICENSE dist | |
- name: Upload | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.target }} | |
path: dist/* |