Skip to content
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

Simplifies project setup and task runner #104

Merged
merged 1 commit into from
Jun 23, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
6 changes: 1 addition & 5 deletions .github/actions/setup-rust/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ runs:
- name: Install asdf
uses: asdf-vm/actions/setup@05e0d2ed97b598bfce82fd30daf324ae0c4570e6 # v3.0.2

- name: Install local required tools
shell: bash
run: ./scripts/install-requirements.sh

- name: Install additional tools (Mac-only)
if: runner.os == 'macOS'
shell: bash
Expand All @@ -31,4 +27,4 @@ runs:

- name: Setup Rust and Cargo plugins
shell: bash
run: just setup
run: ./krabby.sh setup
62 changes: 5 additions & 57 deletions .github/renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,64 +44,12 @@
},
{
"customType": "regex",
"depNameTemplate": "cargo-nextest",
"packageNameTemplate": "nextest-rs/nextest",
"datasourceTemplate": "github-releases",
"extractVersionTemplate": "^cargo-nextest-(?<version>.*)$",
"fileMatch": [
"(^|/)cargo-plugins\\.toml"
],
"matchStrings": [
"cargo-nextest\\s*=\\s*\"(?<currentValue>\\d+\\.\\d+(\\.\\d+)?)\""
]
},
{
"customType": "regex",
"depNameTemplate": "cargo-cyclonedx",
"packageNameTemplate": "CycloneDX/cyclonedx-rust-cargo",
"datasourceTemplate": "github-releases",
"extractVersionTemplate": "^cargo-cyclonedx-(?<version>.*)$",
"fileMatch": [
"(^|/)cargo-plugins\\.toml"
],
"matchStrings": [
"cargo-cyclonedx\\s*=\\s*\"(?<currentValue>\\d+\\.\\d+(\\.\\d+)?)\""
]
},
{
"customType": "regex",
"depNameTemplate": "cargo-msrv",
"packageNameTemplate": "foresterre/cargo-msrv",
"datasourceTemplate": "github-releases",
"fileMatch": [
"(^|/)cargo-plugins\\.toml"
],
"matchStrings": [
"cargo-msrv\\s*=\\s*\"(?<currentValue>\\d+\\.\\d+(\\.\\d+)?)\""
]
},
{
"customType": "regex",
"depNameTemplate": "cargo-deny",
"packageNameTemplate": "EmbarkStudios/cargo-deny",
"datasourceTemplate": "github-releases",
"fileMatch": [
"(^|/)cargo-plugins\\.toml"
],
"matchStrings": [
"cargo-deny\\s*=\\s*\"(?<currentValue>\\d+\\.\\d+(\\.\\d+)?)\""
]
},
{
"customType": "regex",
"depNameTemplate": "cargo-get",
"packageNameTemplate": "nicolaiunrein/cargo-get",
"datasourceTemplate": "github-releases",
"fileMatch": [
"(^|/)cargo-plugins\\.toml"
],
"datasourceTemplate": "git-refs",
"currentValueTemplate": "main",
"packageNameTemplate": "https://github.com/dotanuki-labs/callinectes",
"fileMatch": ["(^|/)krabby\\.sh$"],
"matchStrings": [
"cargo-get\\s*=\\s*\"(?<currentValue>\\d+\\.\\d+(\\.\\d+)?)\""
"readonly callinectes=\"ghcr.io/dotanuki-labs/callinectes:(?<currentDigest>.*?)\""
]
}
]
Expand Down
11 changes: 5 additions & 6 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
uses: ./.github/actions/setup-rust

- name: Cross-compilation supported targets
run: just assemble
run: ./krabby.sh assemble

- name: Archive binaries
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
Expand All @@ -36,14 +36,11 @@ jobs:
- name: Project Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: Setup CI
uses: ./.github/actions/setup-rust

- name: Publish on crates.io
run: cargo publish --token ${{ secrets.CRATESIO_PUBLISH_TOKEN }}

- name: Check supply-chain issues
run: just security
run: ./krabby.sh security

- name: Fetch executable from previous build
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
Expand All @@ -52,7 +49,9 @@ jobs:

- name: Prepare to release
id: prepare-release
run: ./scripts/prepare-release.sh
run: |
version=$(grep 'version' Cargo.toml | head -1 | sed "s/version[[:space:]]=[[:space:]]//g" | tr -d '"')
echo "version=$version" >>"$GITHUB_OUTPUT"

- name: Publish draft release on Github
uses: softprops/action-gh-release@a74c6b72af54cfa997e81df42d94703d6313a2d0 # v2.0.6
Expand Down
22 changes: 5 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,8 @@ jobs:
- name: Lint Bash scripts
uses: dotanuki-labs/github-actions/quality/bash@main

- name: Setup CI
uses: ./.github/actions/setup-rust

- name: Lint project
run: just lint

- name: Check MSRV
run: just msrv
run: ./krabby.sh lint

tests:
runs-on: ubuntu-22.04
Expand All @@ -59,14 +53,11 @@ jobs:
- name: Project Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: Lint Bash scripts
uses: dotanuki-labs/github-actions/quality/bash@main

- name: Setup CI
uses: ./.github/actions/setup-rust

- name: Run tests
run: just tests
- name: Run Rust tests
run: ./krabby.sh tests

build:
needs: check-docs
Expand All @@ -83,7 +74,7 @@ jobs:
uses: ./.github/actions/setup-rust

- name: Cross-compilation against some targets
run: just assemble
run: ./krabby.sh assemble

- name: Archive binaries
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
Expand All @@ -99,11 +90,8 @@ jobs:
- name: Project Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: Setup CI
uses: ./.github/actions/setup-rust

- name: Check supply-chain issues
run: just security
run: ./krabby.sh security

- name: Archive SBOM
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
Expand Down
1 change: 0 additions & 1 deletion .tool-versions

This file was deleted.

4 changes: 2 additions & 2 deletions docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ Please check them out.
- Ensure you have a proper running environment for your fork, e.g. running unit tests locally

```bash
just tests
./krabby.sh tests
```

- Code your changes 🔥
- Use our `just` recipes to verify [what we execute on CI](https://github.com/dotanuki-labs/gradle-wrapper-validator/blob/main/.github/workflows/ci.yml)
- Use our `krabby` tasks to verify [what we execute on CI](https://github.com/dotanuki-labs/gradle-wrapper-validator/blob/main/.github/workflows/ci.yml)
- Raise your Pull Request 🚀
- Fill the description with our [pull request template](https://github.com/dotanuki-labs/.github/blob/main/.github/PULL_REQUEST_TEMPLATE.md)
- Ensure you've your PR [linked with a proper issue](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword)
Expand Down
36 changes: 12 additions & 24 deletions docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,37 +14,25 @@ Please ensure you have those installed on your system.

## Project setup

To get started, install additional required tools with `asdf`:

```bash
./scripts/install-requirements.sh
```

which will install
[just](https://just.systems)
for your user.

This project uses `just` as a task runner and
This project uses the `krabby.sh` as a task runner and
defines a few recipes to make things straightforward. You can check them by running:

```bash
just

Available recipes:
setup # Setups Rust toolchain and Cargo extensions
msrv # Checks minimum supported Rust toolchain version
lint # Checks code formatting and smells
compile # Quick compiles this project and catches errors
tests # Runs project tests
assemble # Builds release binaries for all supported compilation targets
security # Runs supply-chain checks and generates SecOps artifacts
./krabby.sh

Available tasks:
setup # Setups Rust toolchain and Cargo extensions
lint # Check code formatting and smells
tests # Run tests for Rust modules and integration tests
assemble # Builds binaries according to the environment (local or CI)
security # Run security checks and generates supply-chain artifacts
```

We definitely recommend getting started by setting up the latest version of Rust along with
all required Cargo subcommands by running:
by running:

```bash
just setup
./krabby.sh setup
```

## Code Style
Expand Down Expand Up @@ -84,7 +72,7 @@ and all required status checks must pass.

This project adopts
[GiHub Actions](https://github.com/dotanuki-labs/gradle-wrapper-validator/actions)
as it CI system. Most of the verifications we'll run on CI are provided by the `just` recipes,
as it CI system. Most of the verifications we'll run on CI are provided by `krabby.sh` tasks,
as previously mentioned.

In addition to that, we also run a specific `Job` to enforce code quality standards for docs,
Expand Down
61 changes: 0 additions & 61 deletions justfile

This file was deleted.

Loading