Skip to content
Closed
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: 3 additions & 3 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[alias]
clarinet-install = "install --path components/clarinet-cli --locked --force"
tst = "nextest run --workspace --no-fail-fast --locked --exclude clarinet-sdk-wasm --exclude clarity-jupyter-kernel"
cov = "llvm-cov nextest --workspace --locked --exclude clarinet-sdk-wasm --exclude clarity-jupyter-kernel --lcov --output-path lcov.info"
cov-dev = "llvm-cov nextest --workspace --locked --exclude clarinet-sdk-wasm --exclude clarity-jupyter-kernel --html"
tst = "nextest run --workspace --no-fail-fast --locked --exclude clarinet-sdk-wasm"
cov = "llvm-cov nextest --workspace --locked --exclude clarinet-sdk-wasm --lcov --output-path lcov.info"
cov-dev = "llvm-cov nextest --workspace --locked --exclude clarinet-sdk-wasm --html"
50 changes: 50 additions & 0 deletions .github/workflows/audit-and-format.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Audit, Format, Clippy
on:
pull_request:
push:
branches:
- main

concurrency:
group: "${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}"
cancel-in-progress: true

env:
RUSTFLAGS: "-Dwarnings"

jobs:
audit:
name: Audit, format, clippy
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Cache cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
~/.cargo/config
Cargo.lock
key: ${{ runner.os }}-cargo-audit-${{ env.RUST_VERSION_HASH }}-${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('**/*.rs') }}
restore-keys: |
${{ runner.os }}-cargo-audit-${{ env.RUST_VERSION_HASH }}-
${{ runner.os }}-cargo-audit-
${{ runner.os }}-

- name: Install cargo-audit
run: cargo install cargo-audit || true

- name: Run audit
run: cargo audit --ignore RUSTSEC-2024-0344 --ignore RUSTSEC-2022-0028

- name: Run rustfmt
run: cargo fmt --all -- --check

- name: Run clippy
run: cargo clippy --workspace --exclude clarinet-sdk-wasm
52 changes: 0 additions & 52 deletions .github/workflows/audit-format.yaml

This file was deleted.

6 changes: 3 additions & 3 deletions .github/workflows/ci-cli.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ jobs:
echo "RUST_VERSION_HASH=$(rustc --version | sha256sum | awk '{print $1}')" >> $GITHUB_ENV

- name: Cache cargo
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
~/.cargo/
Expand Down Expand Up @@ -168,7 +168,7 @@ jobs:
run: echo "RUST_VERSION_HASH=$(rustc --version | sha256sum | awk '{print $1}')" >> $GITHUB_ENV

- name: Cache cargo
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
~/.cargo/
Expand Down Expand Up @@ -275,7 +275,7 @@ jobs:
# can't easily run mac-arm64 tests in GH without native runners for that arch
# and we already ran tests on x86_64-unknown-linux-gnu in the Code Coverage job, so skip
if: matrix.target != 'aarch64-apple-darwin' && matrix.target != 'x86_64-unknown-linux-gnu'
run: cargo test --workspace --release --locked --exclude clarinet-sdk-wasm --exclude clarity-jupyter-kernel --target ${{ matrix.target }}
run: cargo test --workspace --release --locked --exclude clarinet-sdk-wasm --target ${{ matrix.target }}

docker_images:
name: Create Clarinet Docker Image
Expand Down
136 changes: 30 additions & 106 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,14 @@ on:

workflow_dispatch:

jobs:
pre_run:
name: Cancel previous runs
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@ad6cb1b847ffb509a69b745b6ee2f1d14dfe14b8
with:
access_token: ${{ github.token }}
persist-credentials: false
concurrency:
group: "${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}"
cancel-in-progress: true

jobs:
get_release_info:
name: Get Release Info
runs-on: ubuntu-latest
needs: pre_run
outputs:
tag: ${{ steps.new_release_tag.outputs.TAG }}
steps:
Expand Down Expand Up @@ -60,36 +53,6 @@ jobs:
echo "::warning::Will not create a release"
fi

audit:
name: Audit and format
runs-on: ubuntu-latest
needs: pre_run
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Rust toolchain
run: |
rustup toolchain install stable --profile minimal --component rustfmt
echo "RUST_VERSION_HASH=$(rustc --version | sha256sum | awk '{print $1}')" >> $GITHUB_ENV

- name: Cache cargo
uses: actions/cache@v3
with:
path: |
~/.cargo/
./target/debug/build/
key: ${{ runner.os }}-rust-${{ env.RUST_VERSION_HASH }}-${{ hashFiles('./Cargo.lock') }}

- name: Install dependencies
run: cargo install cargo-audit

- name: Run audit
run: cargo audit --ignore RUSTSEC-2024-0344 --ignore RUSTSEC-2022-0028 --ignore RUSTSEC-2024-0399

- name: Run rustfmt
run: cargo fmt --all -- --check

test_coverage_cargo:
name: Generate test coverage
runs-on: ubuntu-latest
Expand All @@ -103,12 +66,17 @@ jobs:
echo "RUST_VERSION_HASH=$(rustc --version | sha256sum | awk '{print $1}')" >> $GITHUB_ENV

- name: Cache cargo
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
~/.cargo/
./target/debug/build/
key: ${{ runner.os }}-rust-${{ env.RUST_VERSION_HASH }}-${{ hashFiles('./Cargo.lock') }}
./target/debug/deps/
./target/debug/.fingerprint/
key: ${{ runner.os }}-cargo-nextest-${{ env.RUST_VERSION_HASH }}-${{ hashFiles('./Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-nextest-${{ env.RUST_VERSION_HASH }}-
${{ runner.os }}-cargo-nextest-

- name: install dependencies
uses: taiki-e/install-action@v2
Expand All @@ -127,7 +95,6 @@ jobs:
dist_clarinet:
name: Build Clarinet Distributions
runs-on: ${{ matrix.os }}
needs: pre_run

strategy:
fail-fast: false
Expand Down Expand Up @@ -174,12 +141,16 @@ jobs:
run: echo "RUST_VERSION_HASH=$(rustc --version | sha256sum | awk '{print $1}')" >> $GITHUB_ENV

- name: Cache cargo
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
~/.cargo/
./target/${{ matrix.target }}/release/
key: ${{ runner.os }}-rust-${{ env.RUST_VERSION_HASH }}-cargo-${{ hashFiles('./Cargo.lock') }}
./target/${{ matrix.target }}/debug/
key: ${{ runner.os }}-cargo-build-${{ env.RUST_VERSION_HASH }}-${{ hashFiles('./Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-build-${{ env.RUST_VERSION_HASH }}-
${{ runner.os }}-cargo-build-

- name: Install wix (Windows)
if: matrix.os == 'windows-latest' && steps.cache-cargo.outputs.cache-hit != 'true'
Expand Down Expand Up @@ -317,13 +288,12 @@ jobs:
- name: Unit Tests - Cargo
# can't easily run mac-arm64 tests in GH without native runners for that arch
if: matrix.target != 'aarch64-apple-darwin'
run: cargo test --workspace --release --locked --exclude clarinet-sdk-wasm --exclude clarity-jupyter-kernel --target ${{ matrix.target }}
run: cargo test --workspace --release --locked --exclude clarinet-sdk-wasm --target ${{ matrix.target }}

dist_stacks_devnet_js:
name: Build Stacks Devnet JS Distributions
runs-on: ${{ matrix.os }}
needs:
- pre_run
- get_release_info

strategy:
Expand All @@ -335,6 +305,11 @@ jobs:
target: x86_64-unknown-linux-gnu
architecture: x64
libc: glibc
- os: ubuntu-latest
platform: linux
target: x86_64-unknown-linux-musl
architecture: x64
libc: musl
- os: windows-latest
platform: windows
target: x86_64-pc-windows-msvc
Expand All @@ -347,11 +322,6 @@ jobs:
platform: darwin
target: aarch64-apple-darwin
architecture: arm64
- os: ubuntu-latest
platform: linux
target: x86_64-unknown-linux-musl
architecture: x64
libc: musl

steps:
- name: Configure git to use LF (Windows)
Expand Down Expand Up @@ -387,12 +357,17 @@ jobs:
cache-dependency-path: components/stacks-devnet-js/package-lock.json

- name: Cache cargo
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
~/.cargo/
./target/${{ matrix.target }}/release/
key: ${{ runner.os }}-rust-${{ env.RUST_VERSION_HASH }}-cargo-${{ hashFiles('./Cargo.lock') }}
./target/${{ matrix.target }}/debug/
./target/${{ matrix.target }}/build/
key: ${{ runner.os }}-build-stacksdevnetjs-${{ env.RUST_VERSION_HASH }}-${{ hashFiles('./Cargo.lock') }}
restore-keys: |
${{ runner.os }}-build-stacksdevnetjs-${{ env.RUST_VERSION_HASH }}-
${{ runner.os }}-build-stacksdevnetjs-

# Set environment variables required from cross compiling from macos-x86_64 to macos-arm64
- name: Configure macos-arm64 cross compile config
Expand Down Expand Up @@ -460,55 +435,6 @@ jobs:
greater-version-only: true
token: ${{ secrets.NPM_TOKEN }}

dist_clarity_repl:
name: Build Clarity REPL Distribution
runs-on: ubuntu-latest
needs: pre_run
defaults:
run:
working-directory: components/clarity-repl

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Rust toolchain
run: |
rustup toolchain install stable --profile minimal
echo "RUST_VERSION_HASH=$(rustc --version | sha256sum | awk '{print $1}')" >> $GITHUB_ENV

- name: Cache cargo
uses: actions/cache@v3
with:
path: |
~/.cargo/
./target/x86_64-unknown-linux-gnu/release/
key: ${{ runner.os }}-rust-${{ env.RUST_VERSION_HASH }}-cargo-${{ hashFiles('./Cargo.lock') }}

- name: Configure artifact names
run: |
echo "SHORT_TARGET_NAME=linux-x64-glibc" >> $GITHUB_ENV
echo "PRE_GYP_TARGET_NAME=linux-x64-glibc" >> $GITHUB_ENV

- name: Build - Cargo
run: cargo build --release --locked --target x86_64-unknown-linux-gnu

- name: Compress cargo artifact
working-directory: "."
run: tar -C target/x86_64-unknown-linux-gnu/release -zcvf clarity-repl-${{ env.SHORT_TARGET_NAME }}.tar.gz clarity-repl

- name: Upload cargo artifact
uses: actions/upload-artifact@v4
with:
name: clarity-repl-${{ env.SHORT_TARGET_NAME }}
path: clarity-repl-${{ env.SHORT_TARGET_NAME }}.tar.gz

- name: Publish clarity-repl to crates.io
if: startsWith(github.ref, 'refs/heads/main') && needs.get_release_info.outputs.tag != ''
run: 4
cargo login ${{ secrets.CARGO_CRATES_IO_API_KEY }}
cargo publish

docker_images:
name: Create ${{ matrix.name }} Docker Image
runs-on: ubuntu-latest
Expand Down Expand Up @@ -574,10 +500,8 @@ jobs:
if: startsWith(github.ref, 'refs/heads/main') && needs.get_release_info.outputs.tag != ''
needs:
- get_release_info
- audit
- test_coverage_cargo
- dist_stacks_devnet_js
- dist_clarity_repl
- docker_images
permissions:
actions: write
Expand Down
3 changes: 1 addition & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"rust-analyzer.check.workspace": false,
"rust-analyzer.check.extraArgs": [
"--workspace",
"--exclude=clarinet-sdk-wasm",
"--exclude=clarity-jupyter-kernel"
"--exclude=clarinet-sdk-wasm"
]
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: "Checkout code"
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: "Check contract syntax"
uses: docker://hirosystems/clarinet:latest
with:
Expand Down
Loading