Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 2 additions & 30 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,43 +4,15 @@

[alias]

### INDIVIDUAL TEST AND LINT TASKS ###

# Build and run all code paths except docs
test-all = "test --all-features --all-targets"

# Build and run all docs tests
test-docs = "test --all-features --doc"

# Build and run docs tests with default features
test-docs-defaults = "test --doc"

# Check for formatting on all code
fmt-check = "fmt -- --check"

# Check for license headers
license-check = "make license-header-check"

# Check for generated README.md
readme-check = "make generated-readme-check"
quick = "make quick"
tidy = "make tidy"

# Run Clippy on all code paths
# Keep args in sync with `clippy` job in .github/workflows/build-test.yml
# unknown-clippy-lints: to allow us to work with nightly clippy lints that we don't CI
# field-reassign-with-default: https://github.com/rust-lang/rust-clippy/issues/6559 (fixed in nightly but not stable)
clippy-all = "clippy --all-features --all-targets -- -D warnings -Aclippy::field-reassign-with-default"

### META TASKS ###

# Run quick version of all lints and tests
quick = "make quick"

# Run all lints and tests
ci = "make ci"
Comment thread
Manishearth marked this conversation as resolved.

# Run all lints and tests
bincode-gen-testdata = "make bincode-gen-testdata"

### WASM TASKS ###

# Re-build standard library with panic=abort.
Expand Down
107 changes: 58 additions & 49 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ name: Build and Test

# TODO(#234) re-include cache steps, also using Rust version in cache key

# Note: Each of these jobs, except for the clippy job and the optional benchmarking/coverage
# jobs, maps to a `ci-job-foo` entry in Makefile.toml. If adding further CI jobs, please add them
# as makefile targets as well, and list them under `ci-all`.
#
# Clippy is special because we're using actions-rs/clippy-check which is able to surface clippy failures on
# PR bodies

on:
push:
branches: [ main ]
Expand All @@ -15,17 +22,22 @@ on:
jobs:

# Build job - basic smoke test
build:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Load the default Rust toolchain via the rust-toolchain file.
run: rustup show
- name: Install cargo-make
uses: actions-rs/install@v0.1.2
with:
crate: cargo-make
version: latest
- name: Check
Comment thread
Manishearth marked this conversation as resolved.
uses: actions-rs/cargo@v1.0.1
with:
command: check
args: --all-targets --all-features
command: make
args: ci-job-check

# Test job - runs all "cargo make" testing commands
test:
Expand All @@ -39,26 +51,27 @@ jobs:
- uses: actions/checkout@v2
- name: Load the default Rust toolchain via the rust-toolchain file.
run: rustup show
- name: Install cargo-make
uses: actions-rs/install@v0.1.2
with:
crate: cargo-make
version: latest
- name: Build
uses: actions-rs/cargo@v1.0.1
with:
command: build
args: --all-targets --all-features
- name: Test All Targets
- name: Run `cargo make ci-job-test`
uses: actions-rs/cargo@v1.0.1
with:
command: test-all
- name: Test Docs
uses: actions-rs/cargo@v1.0.1
with:
command: test-docs
command: make
args: ci-job-test


# Feature coverage job - builds all permutations of features
features:
runs-on: ubuntu-latest
needs: [build]

needs: [check]
steps:
- uses: actions/checkout@v2
- name: Load the default Rust toolchain via the rust-toolchain file.
Expand All @@ -68,19 +81,25 @@ jobs:
with:
command: install
args: cargo-all-features --version "^1.4"
- name: Install cargo-make
uses: actions-rs/install@v0.1.2
with:
crate: cargo-make
version: latest
- name: Test Docs with Default Features
uses: actions-rs/cargo@v1.0.1
with:
command: test-docs-defaults
- name: Build All Feature Permutations
uses: actions-rs/cargo@v1.0.1
with:
command: build-all-features
command: make
args: ci-job-features

# WASM Tests - runs Node.js tests for WASM bindings
wasm:
runs-on: ubuntu-latest
needs: [build]
needs: [check]

steps:
- uses: actions/checkout@v2
Expand All @@ -106,14 +125,14 @@ jobs:
uses: actions/setup-node@v1
with:
node-version: 14.17.0
- name: Test
run: |
npm install
npm test
working-directory: ./ffi/wasm/test
- name: Build
uses: actions-rs/cargo@v1.0.1
with:
command: make
args: wasm-test-release

# Lint job - runs all "cargo make" linting commands
lint:
# Fmt job - runs cargo fmt
fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -130,54 +149,44 @@ jobs:
crate: cargo-make
version: latest

- name: Install cargo-readme
uses: actions-rs/install@v0.1.2
with:
crate: cargo-readme
version: latest

# TODO(#234) re-include cache steps, also using Rust version in cache key

- name: Check Format
uses: actions-rs/cargo@v1.0.1
with:
command: fmt-check
command: make
args: ci-job-format

- name: Check License Headers
uses: actions-rs/cargo@v1.0.1
with:
command: license-check

- name: Check Generated README.md
uses: actions-rs/cargo@v1.0.1
with:
command: readme-check

# Bincode job - Test that the bincode data provider can be generated correctly.
bincode:
# Tidy job - runs all "cargo make" tidy commands
tidy:
runs-on: ubuntu-latest
# Wait for the initial build to finish. Note that this step does not currently re-use any
# artifacts from the build step. It's only waiting on the build to minimize resource use
# in case the build fails.
needs: [build]
steps:
- uses: actions/checkout@v2

- name: Load the default Rust toolchain via the rust-toolchain file.
run: rustup show

- name: Install rustfmt
run: rustup component add rustfmt

- name: Install cargo-make
uses: actions-rs/install@v0.1.2
with:
crate: cargo-make
version: latest

- name: Install cargo-readme
uses: actions-rs/install@v0.1.2
with:
crate: cargo-readme
version: latest

# TODO(#234) re-include cache steps, also using Rust version in cache key

- name: Build the bincode
- name: Tidy
uses: actions-rs/cargo@v1.0.1
with:
command: bincode-gen-testdata
command: make
args: ci-job-tidy

# Clippy job (cargo-clippy) - completes and puts warnings inline in PR
clippy:
Expand Down Expand Up @@ -223,7 +232,7 @@ jobs:

runs-on: ubuntu-latest

needs: [build]
needs: [check]

steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -354,7 +363,7 @@ jobs:

# Only run the memory benchmark if the main build succeeded. The memory benchmark does not
# rely on any of the build artifacts.
needs: [build]
needs: [check]

steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -451,7 +460,7 @@ jobs:

runs-on: ubuntu-latest

needs: [build, lint, bincode, benchmark, memory]
needs: [check, tidy, benchmark, memory]

## Only create docs for merges/pushes to main (skip PRs).
## Multiple unfinished PRs should not clobber docs from approved code.
Expand Down
3 changes: 2 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ Each commit and pull request should follow the [style guide][style_guide] and be

Handy commands (run from the root directory):

- `cargo tidy` runs tidy-checks (not including fmt/clippy)
Comment thread
Manishearth marked this conversation as resolved.
Outdated
- `cargo quick` runs the fastest tests and lints.
- `cargo ci` runs all tests and lints.
- `cargo make ci-all` runs all tests and lints

### Structure of commits in a Pull Request

Expand Down
Loading