Skip to content

Commit

Permalink
Add Makefile and CI steps (#2)
Browse files Browse the repository at this point in the history
This commit adds our standard Cargo-Make Makefile
to the repository, adds an initial empty Cargo lockfile, and
includes CI steps.

chore: Add Makefile and CI Jobs
  • Loading branch information
RobbieMcKinstry authored Oct 17, 2024
1 parent ab17eab commit c7390ae
Show file tree
Hide file tree
Showing 3 changed files with 148 additions and 0 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Rust

on:
push:

env:
CARGO_TERM_COLOR: always

jobs:
# This job installs Cargo Make and Cargo Nextest before running
# the CI workflow using Cargo Make. Most of the time, it should
# restore Cargo Make and other dependencies from cache.
build:
name: Validate Rust Build
runs-on: ubuntu-latest
steps:
- name: Checkout the Repo
uses: actions/checkout@v4

- name: "Install Rust (Nightly)"
uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt,clippy

- name: "Install Rust (Stable)"
uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools-preview,rustfmt,clippy

- name: "Restore Rust Cache"
uses: Swatinem/rust-cache@v2

- name: "Install Cargo Tools from Binaries."
uses: "taiki-e/install-action@v2"
with:
tool: "cargo-tarpaulin,cargo-make,cargo-nextest,cargo-llvm-cov"

- name: "Install Cargo Sort"
uses: taiki-e/cache-cargo-install-action@v1
with:
tool: cargo-sort

- name: "Install Taplo CLI"
uses: taiki-e/cache-cargo-install-action@v1
with:
tool: taplo-cli

- name: "Cargo Make"
run: cargo make ci-flow
7 changes: 7 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

92 changes: 92 additions & 0 deletions Makefile.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
[config]
default_to_workspace = false

[env]
CARGO_MAKE_CLIPPY_ARGS = "-- --no-deps"
CARGO_MAKE_COVERAGE_PROVIDER = "llvm-cov"

[tasks.dev-test-flow]
dependencies = [
"pre-build",
"format-flow",
"clippy-flow",
"build",
"post-build",
"pre-docs",
"docs",
"post-docs",
"test-flow",
]

[tasks.pre-build]
dependencies = [
"sort-ci",
"format-toml-conditioned-flow",
"unused-dependencies-flow",
]

[tasks.ci-flow]
dependencies = [
"pre-ci-flow",
"print-env-flow",
"pre-build",
"check-format-flow",
"clippy-flow",
"build",
"post-build",
"pre-docs",
"docs",
"post-docs",
"test-flow",
"coverage-flow",
"post-ci-flow",
]

[tasks.test]
workspace = true
description = "Run our test suite"
command = "cargo"
args = [
"nextest",
"run",
"--locked",
"@@remove-empty(CARGO_MAKE_CARGO_VERBOSE_FLAGS)",
"@@split(CARGO_MAKE_CARGO_BUILD_TEST_FLAGS, )"
]

[tasks.help]
command = "cargo"
description = "List help text for wack executable"
category = "Development"
args = [
"run",
"@@remove-empty(CARGO_MAKE_CARGO_VERBOSE_FLAGS)",
"@@split(CARGO_MAKE_CARGO_BUILD_TEST_FLAGS, )",
"--",
"--help"
]

[tasks.fmt]
workspace = true
alias = "format"

[tasks.check-format]
workspace = true

[tasks.wc]
description = "Calculate the LoC in src. Require tokei to be installed."
category = "Development"
command = "tokei"
args = [ "." ]

[tasks.sort-ci]
description = "Assert that Cargo.toml is sorted. Requires cargo-sort to be installed."
category = "Development"
command = "cargo"
args = ["sort", "--check"]

[tasks.sort]
description = "Sort Cargo.toml. Requires cargo-sort to be installed."
category = "Development"
command = "cargo"
args = ["sort"]

0 comments on commit c7390ae

Please sign in to comment.