name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
schedule:
- cron: "58 7 * * 3"
jobs:
lint-nightly:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Rust
uses: ./.github/actions/setup-rust
with:
toolchain: nightly
components: rustfmt,rust-docs
- run: cargo fmt --all -- --check
- run: RUSTDOCFLAGS="-D warnings --cfg docsrs" cargo doc --package utcnow --all-features --no-deps
lint-stable:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Rust
uses: ./.github/actions/setup-rust
with:
toolchain: nightly
components: clippy
- run: cargo clippy --package utcnow --all-targets -- -D clippy::pedantic
- run: cargo package --package utcnow
check:
strategy:
fail-fast: false
matrix:
toolchain:
- "1.48"
- "1.56"
- "1.58"
- stable
- nightly
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Rust
uses: ./.github/actions/setup-rust
with:
toolchain: ${{ matrix.toolchain }}
components: clippy
- run: cargo check --package utcnow --all-targets
- run: cargo clippy --package utcnow --all-targets -- -D warnings
test:
strategy:
fail-fast: false
matrix:
toolchain:
- "1.48"
- "1.56"
- "1.58"
- stable
- nightly
platform:
- ubuntu-20.04
- windows-2022
- macos-12
versions:
- ""
- "-Zminimal-versions"
runs-on: ${{ matrix.platform }}
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: maxim-lobanov/setup-xcode@v1
if: matrix.platform == 'macos-12' && matrix.toolchain == '1.48'
with:
xcode-version: "13.4.1"
- name: Setup Rust
uses: ./.github/actions/setup-rust
with:
toolchain: ${{ matrix.toolchain }}
components: clippy
- name: Update lockfile
run: cargo generate-lockfile ${{ matrix.versions }}
env:
RUSTC_BOOTSTRAP: 1
- run: cargo test --workspace -- --show-output
- run: cargo test --workspace --no-default-features -- --show-output
- run: cargo run --example minimal && date +%s.%9N
- run: cargo run --example minimal --no-default-features && date +%s.%9N
test-wasm:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Rust
uses: ./.github/actions/setup-rust
with:
toolchain: stable
target: wasm32-unknown-unknown
components: clippy
- name: Install Node
uses: actions/setup-node@v3
with:
node-version: 14
- run: which wasm-pack || cargo install wasm-pack
- run: wasm-pack test --node && date +%s.%9N
- run: cargo clippy --target wasm32-unknown-unknown --package utcnow --all-targets -- -D warnings
- run: cargo clippy --target wasm32-unknown-unknown --package utcnow --all-targets -- -D clippy::pedantic
run-wasi:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Rust
uses: ./.github/actions/setup-rust
with:
toolchain: stable
target: wasm32-wasi
components: clippy
- run: cargo clippy --target wasm32-wasi --package utcnow --all-targets -- -D warnings
- run: cargo clippy --target wasm32-wasi --package utcnow --all-targets -- -D clippy::pedantic
- run: curl https://wasmtime.dev/install.sh -sSf | bash
- run: cargo build --target wasm32-wasi --example minimal
- run: ~/.wasmtime/bin/wasmtime target/wasm32-wasi/debug/examples/minimal.wasm && date +%s.%9N
cross-run-test:
strategy:
fail-fast: false
matrix:
target:
- wasm32-unknown-emscripten
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust
id: actions-rs
uses: ./.github/actions/setup-rust
with:
toolchain: stable
target: ${{ matrix.target }}
components: clippy
- run: curl --location --silent --show-error --fail https://github.com/cargo-bins/cargo-quickinstall/releases/download/cross-0.2.5-x86_64-unknown-linux-gnu/cross-0.2.5-x86_64-unknown-linux-gnu.tar.gz | tar -xzvvf - -C $HOME/.cargo/bin
- run: chmod +x $HOME/.cargo/bin/cross
- run: cross clippy --target ${{ matrix.target }} --package utcnow --all-targets -- -D warnings
- run: cross clippy --target ${{ matrix.target }} --package utcnow --all-targets -- -D clippy::pedantic
- run: cross test --target ${{ matrix.target }} --workspace -- --show-output
- run: cross test --target ${{ matrix.target }} --workspace --no-default-features -- --show-output
cross-execute:
strategy:
fail-fast: false
matrix:
target:
- i686-unknown-linux-musl
- x86_64-unknown-linux-musl
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust
id: actions-rs
uses: ./.github/actions/setup-rust
with:
toolchain: stable
target: ${{ matrix.target }}
components: clippy
- run: curl --location --silent --show-error --fail https://github.com/cargo-bins/cargo-quickinstall/releases/download/cross-0.2.5-x86_64-unknown-linux-gnu/cross-0.2.5-x86_64-unknown-linux-gnu.tar.gz | tar -xzvvf - -C $HOME/.cargo/bin
- run: chmod +x $HOME/.cargo/bin/cross
- run: cross clippy --target ${{ matrix.target }} --package utcnow --all-targets -- -D warnings
- run: cross clippy --target ${{ matrix.target }} --package utcnow --all-targets -- -D clippy::pedantic
- run: cross test --target ${{ matrix.target }} --workspace -- --show-output
- run: cross test --target ${{ matrix.target }} --workspace --no-default-features -- --show-output
- run: cross run --target ${{ matrix.target }} --example minimal && date +%s.%9N
- run: cross run --target ${{ matrix.target }} --example minimal --no-default-features && date +%s.%9N
cross-no-execute:
strategy:
fail-fast: false
matrix:
target:
- thumbv7neon-linux-androideabi
- x86_64-linux-android
- x86_64-pc-solaris
- x86_64-unknown-freebsd
- x86_64-unknown-fuchsia
- x86_64-unknown-illumos
- x86_64-unknown-netbsd
- x86_64-unknown-redox
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust
id: actions-rs
uses: ./.github/actions/setup-rust
with:
toolchain: stable
components: clippy
- run: rustup target add ${{ matrix.target }}
- run: curl --location --silent --show-error --fail https://github.com/cargo-bins/cargo-quickinstall/releases/download/cross-0.2.5-x86_64-unknown-linux-gnu/cross-0.2.5-x86_64-unknown-linux-gnu.tar.gz | tar -xzvvf - -C $HOME/.cargo/bin
- run: chmod +x $HOME/.cargo/bin/cross
- run: cross clippy --target ${{ matrix.target }} --package utcnow --all-targets -- -D warnings
- run: cross clippy --target ${{ matrix.target }} --package utcnow --all-targets -- -D clippy::pedantic
- run: cross build --target ${{ matrix.target }} --package utcnow --lib
- run: cross build --target ${{ matrix.target }} --package utcnow --lib --no-default-features
cross-ios:
strategy:
fail-fast: false
matrix:
target:
- aarch64-apple-ios
- aarch64-apple-ios-sim
- x86_64-apple-darwin
- x86_64-apple-ios
runs-on: macos-12
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust
id: actions-rs
uses: ./.github/actions/setup-rust
with:
toolchain: stable
target: ${{ matrix.target }}
components: clippy
- run: curl --location --silent --show-error --fail https://github.com/cargo-bins/cargo-quickinstall/releases/download/cross-0.2.5/cross-0.2.5-x86_64-apple-darwin.tar.gz | tar -xzvvf - -C $HOME/.cargo/bin
- run: chmod +x $HOME/.cargo/bin/cross
- run: cross clippy --target ${{ matrix.target }} --package utcnow --all-targets -- -D warnings
- run: cross clippy --target ${{ matrix.target }} --package utcnow --all-targets -- -D clippy::pedantic
- run: cross build --target ${{ matrix.target }} --examples
- run: cross build --target ${{ matrix.target }} --examples --no-default-features
audit:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Rust
uses: ./.github/actions/setup-rust
- name: Audit
uses: actions-rs/audit-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
devskim:
runs-on: ubuntu-20.04
permissions:
actions: read
contents: read
security-events: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Run DevSkim scanner
uses: microsoft/DevSkim-Action@v1
- name: Upload DevSkim scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: devskim-results.sarif
powerset:
strategy:
fail-fast: false
matrix:
versions:
- ""
- "-Zminimal-versions"
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Rust
uses: ./.github/actions/setup-rust
- run: cargo hack --version || cargo install cargo-hack --force
- run: cargo generate-lockfile ${{ matrix.versions }}
env:
RUSTC_BOOTSTRAP: 1
- run: cargo hack test --feature-powerset --include-features arbitrary,proptest,quickcheck,rkyv,serde
deny:
strategy:
fail-fast: false
matrix:
versions:
- ""
- "-Zminimal-versions"
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Rust
uses: ./.github/actions/setup-rust
- run: cargo deny --version || cargo install cargo-deny --force
- run: cargo generate-lockfile ${{ matrix.versions }}
env:
RUSTC_BOOTSTRAP: 1
- run: cargo deny check all