CI with Github Actions.
This commit is contained in:
parent
1fc4f0bc64
commit
a31f813f46
|
@ -1,118 +0,0 @@
|
||||||
version: 2.1
|
|
||||||
|
|
||||||
executors:
|
|
||||||
default:
|
|
||||||
description: Executor environment for building Rust crates.
|
|
||||||
docker:
|
|
||||||
- image: circleci/rust:1
|
|
||||||
|
|
||||||
commands:
|
|
||||||
update_toolchain:
|
|
||||||
description: Update the Rust toolchain to use for building.
|
|
||||||
parameters:
|
|
||||||
toolchain:
|
|
||||||
description: Rust toolchain to use. Overrides the default toolchain (stable) or any toolchain specified in the project via `rust-toolchain`.
|
|
||||||
type: string
|
|
||||||
default: ""
|
|
||||||
steps:
|
|
||||||
- run:
|
|
||||||
name: Update toolchain
|
|
||||||
command: |
|
|
||||||
test -z "<<parameters.toolchain>>" || echo "<<parameters.toolchain>>" >rust-toolchain
|
|
||||||
rustup show active-toolchain
|
|
||||||
- run:
|
|
||||||
name: Version information
|
|
||||||
command: |
|
|
||||||
rustup --version
|
|
||||||
rustc --version
|
|
||||||
cargo --version
|
|
||||||
|
|
||||||
build:
|
|
||||||
description: Build all targets of a Rust crate.
|
|
||||||
steps:
|
|
||||||
- run:
|
|
||||||
name: Calculate dependencies
|
|
||||||
command: |
|
|
||||||
rustc --version >rust-version
|
|
||||||
test -e Cargo.lock || cargo generate-lockfile
|
|
||||||
- restore_cache:
|
|
||||||
keys:
|
|
||||||
- v6-cargo-cache-{{arch}}-{{checksum "rust-version"}}-{{checksum "Cargo.lock"}}
|
|
||||||
- run:
|
|
||||||
name: Build all targets
|
|
||||||
command: cargo build --tests --all-features
|
|
||||||
- save_cache:
|
|
||||||
paths:
|
|
||||||
- /usr/local/cargo/registry
|
|
||||||
- target
|
|
||||||
key: v6-cargo-cache-{{arch}}-{{checksum "rust-version"}}-{{checksum "Cargo.lock"}}
|
|
||||||
|
|
||||||
check:
|
|
||||||
description: Check all targets of a Rust crate.
|
|
||||||
steps:
|
|
||||||
- run:
|
|
||||||
name: Calculate dependencies
|
|
||||||
command: test -e Cargo.lock || cargo generate-lockfile
|
|
||||||
- run:
|
|
||||||
name: Check all targets
|
|
||||||
command: |
|
|
||||||
if rustup component add clippy; then
|
|
||||||
cargo clippy --all --all-targets --all-features -- -Dwarnings
|
|
||||||
else
|
|
||||||
echo Skipping clippy
|
|
||||||
fi
|
|
||||||
|
|
||||||
test:
|
|
||||||
description: Run all tests of a Rust crate. Make sure to build first.
|
|
||||||
parameters:
|
|
||||||
release:
|
|
||||||
description: By default, the crate is build in debug mode without optimizations. Set this to true to compile in release mode.
|
|
||||||
type: boolean
|
|
||||||
default: false
|
|
||||||
steps:
|
|
||||||
- run:
|
|
||||||
name: Run all tests
|
|
||||||
command: cargo test --all-features
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
check:
|
|
||||||
description: Check a Rust crate.
|
|
||||||
parameters:
|
|
||||||
toolchain:
|
|
||||||
description: Rust toolchain to use. Overrides the default toolchain (stable) or any toolchain specified in the project via `rust-toolchain`.
|
|
||||||
type: string
|
|
||||||
default: ""
|
|
||||||
executor: default
|
|
||||||
steps:
|
|
||||||
- checkout
|
|
||||||
- update_toolchain:
|
|
||||||
toolchain: <<parameters.toolchain>>
|
|
||||||
- check
|
|
||||||
|
|
||||||
test:
|
|
||||||
description: Builds a Rust crate and runs all tests.
|
|
||||||
parameters:
|
|
||||||
toolchain:
|
|
||||||
description: Rust toolchain to use. Overrides the default toolchain (stable) or any toolchain specified in the project via `rust-toolchain`.
|
|
||||||
type: string
|
|
||||||
default: ""
|
|
||||||
executor: default
|
|
||||||
steps:
|
|
||||||
- checkout
|
|
||||||
- update_toolchain:
|
|
||||||
toolchain: <<parameters.toolchain>>
|
|
||||||
- build
|
|
||||||
- test
|
|
||||||
|
|
||||||
workflows:
|
|
||||||
Project:
|
|
||||||
jobs:
|
|
||||||
- test:
|
|
||||||
name: cargo test (stable)
|
|
||||||
toolchain: stable
|
|
||||||
- test:
|
|
||||||
name: cargo test (beta)
|
|
||||||
toolchain: beta
|
|
||||||
- test:
|
|
||||||
name: cargo test (nightly)
|
|
||||||
toolchain: nightly
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
name: Continuous Integration
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
pull_request:
|
||||||
|
schedule:
|
||||||
|
- cron: "0 0 1,15 * *"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest, windows-latest, macOS-latest]
|
||||||
|
rust: [stable, beta, nightly]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: hecrj/setup-rust-action@v1
|
||||||
|
with:
|
||||||
|
rust-version: ${{ matrix.rust }}
|
||||||
|
- uses: actions/checkout@v1
|
||||||
|
- name: Run tests
|
||||||
|
run: cargo test --all-features
|
||||||
|
|
||||||
|
clippy:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: hecrj/setup-rust-action@v1
|
||||||
|
with:
|
||||||
|
rust-version: stable
|
||||||
|
components: clippy
|
||||||
|
- uses: actions/checkout@v1
|
||||||
|
- name: Clippy
|
||||||
|
run: cargo clippy -- -D warnings
|
Loading…
Reference in New Issue