Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
CAGS295 committed Oct 18, 2023
1 parent a10f6a3 commit 36a52ba
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 75 deletions.
87 changes: 43 additions & 44 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ name: Pull Request
on:
pull_request:
branches: "main"
paths-ignore: ['**.md']
paths-ignore: ["**.md"]
push:
branches: "main"
paths-ignore: ['**.md']
paths-ignore: ["**.md"]

env:
CARGO_TERM_COLOR: always
Expand All @@ -15,62 +15,62 @@ jobs:
generate-lockfile:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build
run: cargo generate-lockfile -v
- uses: actions/upload-artifact@v3
with:
name: Cargo.lock
path: Cargo.lock
- uses: actions/checkout@v3
- name: Build
run: cargo generate-lockfile -v
- uses: actions/upload-artifact@v3
with:
name: Cargo.lock
path: Cargo.lock

linter:
needs: generate-lockfile
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: Cargo.lock
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: Cargo.lock

- uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true
components: rustfmt, clippy
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true
components: rustfmt, clippy

- uses: davidB/rust-cargo-make@v1
with:
version: "0.36.13"
- uses: davidB/rust-cargo-make@v1
with:
version: "0.36.13"

- name: Lint
run: cargo make --profile github-actions format
- name: Lint
run: cargo make --profile github-actions format

coverage:
needs: clarinet
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: Cargo.lock
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: Cargo.lock

- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true

- uses: davidB/rust-cargo-make@v1
with:
version: "0.36.13"
- uses: davidB/rust-cargo-make@v1
with:
version: "0.36.13"

- name: Coverage
run: cargo make --profile github-actions coverage-lcov
- name: Coverage
run: cargo make --profile github-actions coverage-lcov

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
files: ./coverage/lcov.info
fail_ci_if_error: true
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
files: ./coverage/lcov.info
fail_ci_if_error: true

clarinet:
needs: linter
Expand Down Expand Up @@ -139,11 +139,10 @@ jobs:
- name: Use Node
uses: actions/setup-node@v3
with:
node-version: '20'
cache: 'npm'
node-version: "20"
cache: "npm"
cache-dependency-path: ./romeo/asset-contract/package-lock.json
- run: npm ci
working-directory: ./romeo/asset-contract
- run: npm run test
working-directory: ./romeo/asset-contract

64 changes: 33 additions & 31 deletions Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,24 @@ TEST_FRAMEWORK = "nextest"
[tasks._install-test-framework]
private = true
condition = { env = { "TEST_FRAMEWORK" = "nextest" } }
install_crate = { crate_name = "cargo-nextest", version = "0.9.57", binary = "cargo", "test_arg" = ["nextest" , "--help"]}
install_crate = { crate_name = "cargo-nextest", version = "0.9.57", binary = "cargo", "test_arg" = [
"nextest",
"--help",
] }

[tasks._install-llvm-cov]
private = true
install_crate = { crate_name = "cargo-llvm-cov", version = "0.5.25", binary = "cargo", "test_arg" = ["llvm-cov" , "--help"]}
install_crate = { crate_name = "cargo-llvm-cov", version = "0.5.25", binary = "cargo", "test_arg" = [
"llvm-cov",
"--help",
] }

[tasks._install-audit]
private = true
install_crate = { crate_name = "cargo-audit", version = "0.18.1", binary = "cargo", "test_arg" = ["audit" , "--help"]}
install_crate = { crate_name = "cargo-audit", version = "0.18.1", binary = "cargo", "test_arg" = [
"audit",
"--help",
] }

[tasks.install]
dependencies = [
Expand All @@ -49,14 +58,24 @@ dependencies = [
# -----------

[tasks.format-fmt]
install_crate = "rustfmt" # uses the stable version.
# uses the stable version.
install_crate = "rustfmt"
command = "cargo"
args = ["fmt", "--check", "--verbose"]

[tasks.format-clippy]
install_crate = "clippy" # uses the stable version.
command = "cargo"
args = ["clippy","--all-features", "--all-targets", "--", "-D", "warnings", "-W", "clippy::all"]
args = [
"clippy",
"--all-features",
"--all-targets",
"--",
"-D",
"warnings",
"-W",
"clippy::all",
]

[tasks.format]
dependencies = ["format-clippy", "format-fmt"]
Expand All @@ -77,10 +96,7 @@ args = ["-p", "${COVERAGE_DIRECTORY}"]

[tasks._calculate-coverage]
private = true
dependencies = [
"_install-llvm-cov",
"_install-test-framework",
]
dependencies = ["_install-llvm-cov", "_install-test-framework"]
command = "cargo"
args = [
"llvm-cov",
Expand All @@ -99,37 +115,27 @@ args = ["llvm-cov", "clean"]
# Public tasks ----------------------------------------------------------------
[tasks.coverage-clean]
workspace = false
dependencies = [ "_calculated-coverage-clean", "_coverage-output-clean" ]
dependencies = ["_calculated-coverage-clean", "_coverage-output-clean"]

[tasks.coverage-lcov]
workspace = false
dependencies = [
"_install-llvm-cov",
"_calculate-coverage",
"_make-coverage-output-directory"
"_make-coverage-output-directory",
]
command = "cargo"
args = [
"llvm-cov",
"report",
"--output-path=${COVERAGE_LCOV}",
"--lcov",
]
args = ["llvm-cov", "report", "--output-path=${COVERAGE_LCOV}", "--lcov"]

[tasks.coverage-html]
workspace = false
dependencies = [
"_install-llvm-cov",
"_calculate-coverage",
"_make-coverage-output-directory"
"_make-coverage-output-directory",
]
command = "cargo"
args = [
"llvm-cov",
"report",
"--output-dir=${COVERAGE_HTML_DIR}",
"--html",
]
args = ["llvm-cov", "report", "--output-dir=${COVERAGE_HTML_DIR}", "--html"]

[tasks.coverage-all]
workspace = false
Expand Down Expand Up @@ -164,7 +170,8 @@ args = ["doc"]
# ------

[tasks.audit]
workspace = false # Audit must run in workspace root.
# Audit must run in workspace root.
workspace = false
dependencies = ["_install-audit"]
command = "cargo"
args = ["audit", "-D", "warnings"]
Expand All @@ -176,12 +183,7 @@ args = ["audit", "-D", "warnings"]
dependencies = ["coverage-clean", "cargo-clean"]

[tasks.pr-validation]
dependencies = [
"clean",
"format",
"coverage",
"release",
]
dependencies = ["clean", "format", "coverage", "release"]

[tasks.default]
run_task = "pr-validation"

0 comments on commit 36a52ba

Please sign in to comment.