-
Notifications
You must be signed in to change notification settings - Fork 182
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor Makefile.toml and use it as the source of truth for (almost)…
… all CI (#783) * Split Makefile into smaller files * Add a tidy task for non-fmt/lint checks * Move test-ffi into tests.toml * Move all CI jobs to Makefile.toml, refactor Makefile.toml * build -> check * install cargo make in ci * Fix error * fix CONTRIBUTING * tyop * Fix makefile * fix * fix wasm, dirs * switch to duckscript * Cache cargo-make * fix duckscript * Fix syntax * cache cargo-readme too * better action name * don't double-install * improve cargo tidy * include exes * syntax * fix npm duckscript * rm tidy-minus-fmt
- Loading branch information
1 parent
d8af2a9
commit 17385b2
Showing
9 changed files
with
764 additions
and
565 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 ] | ||
|
@@ -15,17 +22,38 @@ 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: Get cargo-make version | ||
id: cargo-make-version | ||
run: | | ||
echo "::set-output name=hash::$(cargo search cargo-make | grep '^cargo-make =' | md5sum)" | ||
shell: bash | ||
- name: Attempt to load cached cargo-make | ||
uses: actions/cache@v2 | ||
id: cargo-make-cache | ||
with: | ||
path: | | ||
~/.cargo/bin/cargo-make | ||
~/.cargo/bin/cargo-make.exe | ||
key: ${{ runner.os }}-${{ steps.cargo-make-version.outputs.hash }} | ||
- name: Install cargo-make | ||
if: steps.cargo-make-cache.outputs.cache-hit != 'true' | ||
uses: actions-rs/[email protected] | ||
with: | ||
crate: cargo-make | ||
version: latest | ||
|
||
- name: Check | ||
uses: actions-rs/[email protected] | ||
with: | ||
command: check | ||
args: --all-targets --all-features | ||
command: make | ||
args: ci-job-check | ||
|
||
# Test job - runs all "cargo make" testing commands | ||
test: | ||
|
@@ -39,26 +67,43 @@ jobs: | |
- uses: actions/checkout@v2 | ||
- name: Load the default Rust toolchain via the rust-toolchain file. | ||
run: rustup show | ||
|
||
- name: Get cargo-make version | ||
id: cargo-make-version | ||
run: | | ||
echo "::set-output name=hash::$(cargo search cargo-make | grep '^cargo-make =' | md5sum)" | ||
shell: bash | ||
- name: Attempt to load cached cargo-make | ||
uses: actions/cache@v2 | ||
id: cargo-make-cache | ||
with: | ||
path: | | ||
~/.cargo/bin/cargo-make | ||
~/.cargo/bin/cargo-make.exe | ||
key: ${{ runner.os }}-${{ steps.cargo-make-version.outputs.hash }} | ||
- name: Install cargo-make | ||
if: steps.cargo-make-cache.outputs.cache-hit != 'true' | ||
uses: actions-rs/[email protected] | ||
with: | ||
crate: cargo-make | ||
version: latest | ||
|
||
- name: Build | ||
uses: actions-rs/[email protected] | ||
with: | ||
command: build | ||
args: --all-targets --all-features | ||
- name: Test All Targets | ||
uses: actions-rs/[email protected] | ||
with: | ||
command: test-all | ||
- name: Test Docs | ||
- name: Run `cargo make ci-job-test` | ||
uses: actions-rs/[email protected] | ||
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. | ||
|
@@ -68,19 +113,37 @@ jobs: | |
with: | ||
command: install | ||
args: cargo-all-features --version "^1.4" | ||
- name: Test Docs with Default Features | ||
uses: actions-rs/[email protected] | ||
|
||
- name: Get cargo-make version | ||
id: cargo-make-version | ||
run: | | ||
echo "::set-output name=hash::$(cargo search cargo-make | grep '^cargo-make =' | md5sum)" | ||
shell: bash | ||
- name: Attempt to load cached cargo-make | ||
uses: actions/cache@v2 | ||
id: cargo-make-cache | ||
with: | ||
path: | | ||
~/.cargo/bin/cargo-make | ||
~/.cargo/bin/cargo-make.exe | ||
key: ${{ runner.os }}-${{ steps.cargo-make-version.outputs.hash }} | ||
- name: Install cargo-make | ||
if: steps.cargo-make-cache.outputs.cache-hit != 'true' | ||
uses: actions-rs/[email protected] | ||
with: | ||
command: test-docs-defaults | ||
crate: cargo-make | ||
version: latest | ||
|
||
- name: Build All Feature Permutations | ||
uses: actions-rs/[email protected] | ||
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 | ||
|
@@ -92,11 +155,27 @@ jobs: | |
run: | | ||
sudo apt-get install wabt binaryen | ||
cargo install twiggy | ||
- name: Get cargo-make version | ||
id: cargo-make-version | ||
run: | | ||
echo "::set-output name=hash::$(cargo search cargo-make | grep '^cargo-make =' | md5sum)" | ||
shell: bash | ||
- name: Attempt to load cached cargo-make | ||
uses: actions/cache@v2 | ||
id: cargo-make-cache | ||
with: | ||
path: | | ||
~/.cargo/bin/cargo-make | ||
~/.cargo/bin/cargo-make.exe | ||
key: ${{ runner.os }}-${{ steps.cargo-make-version.outputs.hash }} | ||
- name: Install cargo-make | ||
if: steps.cargo-make-cache.outputs.cache-hit != 'true' | ||
uses: actions-rs/[email protected] | ||
with: | ||
crate: cargo-make | ||
version: latest | ||
|
||
- name: Build | ||
uses: actions-rs/[email protected] | ||
with: | ||
|
@@ -106,14 +185,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/[email protected] | ||
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 | ||
|
@@ -124,60 +203,91 @@ jobs: | |
- name: Install rustfmt | ||
run: rustup component add rustfmt | ||
|
||
|
||
- name: Get cargo-make version | ||
id: cargo-make-version | ||
run: | | ||
echo "::set-output name=hash::$(cargo search cargo-make | grep '^cargo-make =' | md5sum)" | ||
shell: bash | ||
- name: Attempt to load cached cargo-make | ||
uses: actions/cache@v2 | ||
id: cargo-make-cache | ||
with: | ||
path: | | ||
~/.cargo/bin/cargo-make | ||
~/.cargo/bin/cargo-make.exe | ||
key: ${{ runner.os }}-${{ steps.cargo-make-version.outputs.hash }} | ||
- name: Install cargo-make | ||
if: steps.cargo-make-cache.outputs.cache-hit != 'true' | ||
uses: actions-rs/[email protected] | ||
with: | ||
crate: cargo-make | ||
version: latest | ||
|
||
- name: Install cargo-readme | ||
uses: actions-rs/[email protected] | ||
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/[email protected] | ||
with: | ||
command: fmt-check | ||
|
||
- name: Check License Headers | ||
uses: actions-rs/[email protected] | ||
with: | ||
command: license-check | ||
command: make | ||
args: ci-job-fmt | ||
|
||
- name: Check Generated README.md | ||
uses: actions-rs/[email protected] | ||
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: Get cargo-make version | ||
id: cargo-make-version | ||
run: | | ||
echo "::set-output name=hash::$(cargo search cargo-make | grep '^cargo-make =' | md5sum)" | ||
shell: bash | ||
- name: Attempt to load cached cargo-make | ||
uses: actions/cache@v2 | ||
id: cargo-make-cache | ||
with: | ||
path: | | ||
~/.cargo/bin/cargo-make | ||
~/.cargo/bin/cargo-make.exe | ||
key: ${{ runner.os }}-${{ steps.cargo-make-version.outputs.hash }} | ||
- name: Install cargo-make | ||
if: steps.cargo-make-cache.outputs.cache-hit != 'true' | ||
uses: actions-rs/[email protected] | ||
with: | ||
crate: cargo-make | ||
version: latest | ||
|
||
- name: Get cargo-readme version | ||
id: cargo-readme-version | ||
run: | | ||
echo "::set-output name=hash::$(cargo search cargo-readme | grep '^cargo-readme =' | md5sum)" | ||
shell: bash | ||
- name: Attempt to load cached cargo-readme | ||
uses: actions/cache@v2 | ||
id: cargo-readme-cache | ||
with: | ||
path: | | ||
~/.cargo/bin/cargo-readme | ||
~/.cargo/bin/cargo-readme.exe | ||
key: ${{ runner.os }}-${{ steps.cargo-readme-version.outputs.hash }} | ||
- name: Install cargo-readme | ||
if: steps.cargo-readme-cache.outputs.cache-hit != 'true' | ||
uses: actions-rs/[email protected] | ||
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/[email protected] | ||
with: | ||
command: bincode-gen-testdata | ||
command: make | ||
args: ci-job-tidy | ||
|
||
# Clippy job (cargo-clippy) - completes and puts warnings inline in PR | ||
clippy: | ||
|
@@ -223,7 +333,7 @@ jobs: | |
|
||
runs-on: ubuntu-latest | ||
|
||
needs: [build] | ||
needs: [check] | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
@@ -354,7 +464,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 | ||
|
@@ -451,7 +561,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. | ||
|
Oops, something went wrong.