devel #57
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: devel | |
on: | |
pull_request: | |
paths: | |
- .github/workflows/devel.yml | |
- .cargo/config.toml | |
- Cargo.lock | |
- Cargo.toml | |
- src/** | |
push: | |
branches: | |
- master | |
- staging | |
- trying | |
paths: | |
- .github/workflows/devel.yml | |
- Cargo.lock | |
- Cargo.toml | |
- src/** | |
schedule: | |
- cron: '15 01 * * *' # Every day at 01:15 UTC | |
jobs: | |
test: | |
name: test | |
runs-on: ${{ matrix.os }} | |
env: | |
# Cargo binary | |
CARGO_BIN: cargo | |
# When CARGO_BIN is set to CROSS, this is set to `--target matrix.target` | |
TARGET_FLAGS: "" | |
# When CARGO_BIN is set to CROSS, TARGET_DIR includes matrix.target | |
TARGET_DIR: ./target | |
# Emit backtraces on panics | |
RUST_BACKTRACE: 1 | |
# Skip tests | |
SKIP_TESTS: "" | |
strategy: | |
matrix: | |
build: | |
- pinned | |
- linux-musl | |
- linux-gnu | |
- macos | |
- windows-msvc | |
include: | |
# Specific Rust channels. | |
# We test against the latest and minimum Rust stable version. | |
- build: pinned | |
os: ubuntu-22.04 | |
rust: 1.70.0 | |
# Some of our release builds are generated by a nightly compiler to take | |
# advantage of the latest optimizations/compile time improvements. | |
- build: linux-musl | |
os: ubuntu-22.04 | |
rust: stable | |
target: x86_64-unknown-linux-musl | |
- build: linux-gnu | |
os: ubuntu-22.04 | |
rust: stable | |
target: x86_64-unknown-linux-gnu | |
- build: macos | |
os: macos-12 | |
rust: stable | |
target: x86_64-apple-darwin | |
- build: windows-msvc | |
os: windows-2022 | |
rust: stable | |
target: x86_64-pc-windows-msvc | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: ${{ matrix.rust }} | |
target: ${{ matrix.target }} | |
- name: Set up Cross | |
if: ${{ !contains(matrix.os, 'windows') && matrix.target != '' }} | |
shell: bash | |
run: | | |
target='' | |
case "${{ matrix.os }}" in | |
*macos*) | |
target=x86_64-apple-darwin | |
;; | |
*) | |
target=x86_64-unknown-linux-musl | |
;; | |
esac | |
echo "Installing cross..." | |
curl -sSL \ | |
"https://github.com/cross-rs/cross/releases/download/v0.2.5/cross-$target.tar.gz" \ | |
| sudo tar zxf - -C /usr/local/bin/ cross cross-util | |
cross -V | |
echo "CARGO_BIN=/usr/local/bin/cross" >> $GITHUB_ENV | |
- name: Setup Cargo | |
shell: bash | |
run: | | |
if [[ "${{ matrix.target }}" != "" ]]; then | |
echo "TARGET_FLAGS=--target=${{ matrix.target }}" >> $GITHUB_ENV | |
echo "TARGET_DIR=./target/${{ matrix.target }}" >> $GITHUB_ENV | |
fi | |
echo "cargo command is: ${{ env.CARGO_BIN }}" | |
echo "target flag is: ${{ env.TARGET_FLAGS }}" | |
echo "target dir is: ${{ env.TARGET_DIR }}" | |
- name: Run tests | |
shell: bash | |
run: | | |
${{ env.CARGO_BIN }} test --verbose ${{ env.TARGET_FLAGS }} ${{ env.SKIP_TESTS }} | |
- name: Run build | |
shell: bash | |
run: | | |
${{ env.CARGO_BIN }} build --example server --verbose ${{ env.TARGET_FLAGS }} | |
checks: | |
name: checks | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
- name: Install stable toolchain | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: stable | |
components: rustfmt, clippy | |
- name: Check formatting | |
run: | | |
cargo fmt --all -- --check | |
- name: Check via Clippy | |
run: | | |
cargo clippy --all-features -- -D warnings | |
- name: Check crate docs | |
run: | | |
cargo doc --lib --no-deps |