-
Notifications
You must be signed in to change notification settings - Fork 213
Refactor Makefile.toml and use it as the source of truth for (almost) all CI #783
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
0d1df83
Split Makefile into smaller files
Manishearth 933e0be
Add a tidy task for non-fmt/lint checks
Manishearth 9725135
Move test-ffi into tests.toml
Manishearth cdf1355
Move all CI jobs to Makefile.toml, refactor Makefile.toml
Manishearth 66fc6ba
build -> check
Manishearth 55f9cbc
install cargo make in ci
Manishearth eb3a079
Fix error
Manishearth 5d9a32d
fix CONTRIBUTING
Manishearth 4a39bf6
tyop
Manishearth 40a9242
Fix makefile
Manishearth a5fd5f9
fix
Manishearth 26f5c8e
fix wasm, dirs
Manishearth 17dff32
switch to duckscript
Manishearth efd51c6
Cache cargo-make
Manishearth 696f573
fix duckscript
Manishearth 8ffcd49
Fix syntax
Manishearth 32e3a43
cache cargo-readme too
Manishearth 01af955
better action name
Manishearth 118ccb3
don't double-install
Manishearth 0a5e08e
improve cargo tidy
Manishearth 0963706
include exes
Manishearth 5d28850
syntax
Manishearth 612f643
fix npm duckscript
Manishearth 21eaa16
rm tidy-minus-fmt
Manishearth File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 | ||
Manishearth marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.