## Description

Completely re-written the ci build script for more parallelization and
speed.

## Test Plan

1. make/merge a pr
2. watch ci go wroom
3. ?
4. profit
This commit is contained in:
AviiNL 2023-04-29 03:06:05 +02:00 committed by GitHub
parent d3ed3123ca
commit 1d2d8f888e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,53 +1,110 @@
name: Rust name: Rust
on: on:
push:
branches: ["main"]
pull_request: pull_request:
branches: ["main"] push: # Run CI on the main branch after every merge. This is important to fill the GitHub Actions cache in a way that pull requests can see it
branches:
- main
env: env:
CARGO_TERM_COLOR: always CARGO_TERM_COLOR: always
jobs: jobs:
build: valence-fmt-clippy:
strategy: strategy:
fail-fast: false fail-fast: true
matrix: matrix:
os: [ubuntu-latest, windows-latest, macos-11] platform: [windows-latest, macos-latest, ubuntu-latest]
style: [default]
rust:
- stable
include:
- style: default
flags: ""
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.platform }}
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- name: Setup Rust toolchain and cache
uses: actions-rust-lang/setup-rust-toolchain@v1.4.4
with: with:
components: clippy, rustfmt toolchain: "stable"
- run: cp tools/playground/src/playground.template.rs tools/playground/src/playground.rs components: "clippy, rustfmt"
- name: Set up cargo cache
uses: actions/cache@v3 - name: "Copy playground"
continue-on-error: false run: cp tools/playground/src/playground.template.rs tools/playground/src/playground.rs
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-target-${{ hashFiles('**/Cargo.toml') }}
restore-keys: |
${{ runner.os }}-cargo-target-${{ hashFiles('**/Cargo.toml') }}
${{ runner.os }}-cargo-target
- name: Install Dependencies (Linux) - name: Install Dependencies (Linux)
run: sudo apt-get update && sudo apt-get install -y libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libxkbcommon-dev libssl-dev libclang-dev libgtk-3-dev run: sudo apt-get update && sudo apt-get install -y libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libxkbcommon-dev libssl-dev libclang-dev libgtk-3-dev
if: matrix.os == 'ubuntu-latest' if: matrix.platform == 'ubuntu-latest'
- name: Validate formatting
- name: cargo fmt
run: cargo fmt --all -- --check run: cargo fmt --all -- --check
- name: Validate documentation
run: cargo doc --workspace --no-deps --all-features --document-private-items - name: Clippy
- name: Run clippy lints run: cargo clippy --workspace ${{ matrix.flags }}--no-deps --all-features --all-targets -- -D warnings
run: cargo clippy --workspace --no-deps --all-features --all-targets -- -D warnings
valence-tests:
strategy:
fail-fast: true
matrix:
platform: [windows-latest, macos-latest, ubuntu-latest]
style: [default]
rust:
- stable
include:
- style: default
flags: ""
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v3
- name: Setup Rust toolchain and cache
uses: actions-rust-lang/setup-rust-toolchain@v1.4.4
- name: "Copy playground"
run: cp tools/playground/src/playground.template.rs tools/playground/src/playground.rs
- name: Install Dependencies (Linux)
run: sudo apt-get update && sudo apt-get install -y libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libxkbcommon-dev libssl-dev libclang-dev libgtk-3-dev
if: matrix.platform == 'ubuntu-latest'
- name: Run tests - name: Run tests
run: cargo test --workspace --all-features --all-targets run: cargo test --workspace ${{ matrix.flags }}--all-features --all-targets
- name: Run valence_nbt tests without preserve_order feature - name: Run valence_nbt tests without preserve_order feature
run: cargo test -p valence_nbt --all-targets run: cargo test -p valence_nbt --all-targets
valence-docs:
strategy:
fail-fast: true
matrix:
platform: [windows-latest, macos-latest, ubuntu-latest]
style: [default]
rust:
- stable
include:
- style: default
flags: ""
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v3
- name: Setup Rust toolchain and cache
uses: actions-rust-lang/setup-rust-toolchain@v1.4.4
- name: "Copy playground"
run: cp tools/playground/src/playground.template.rs tools/playground/src/playground.rs
- name: Install Dependencies (Linux)
run: sudo apt-get update && sudo apt-get install -y libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libxkbcommon-dev libssl-dev libclang-dev libgtk-3-dev
if: matrix.platform == 'ubuntu-latest'
- name: Validate documentation
run: cargo doc --workspace ${{ matrix.flags }}--no-deps --all-features --document-private-items