Skip to content
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
21 changes: 21 additions & 0 deletions .commitlintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
extends:
- '@commitlint/config-conventional'

rules:
# Allow slightly longer subjects; we have descriptive messages.
header-max-length: [2, always, 100]
# Enforce lowercase type (feat, fix, ...) and allow common scopes.
type-enum:
- 2
- always
- - build
- chore
- ci
- docs
- feat
- fix
- perf
- refactor
- revert
- style
- test
68 changes: 50 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,60 @@ on:
- main
- subspaces

env:
CARGO_TERM_COLOR: always

jobs:
run-tests:
test:
name: Test
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- run: cargo test --verbose

- name: Set up Rust
uses: actions-rs/toolchain@v1
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
profile: minimal
override: true
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
- run: cargo fmt --all -- --check
- run: cargo clippy --all-targets --all-features -- -D warnings

- name: Cache cargo registry
uses: actions/cache@v3
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-registry-
docs:
name: Docs
runs-on: ubuntu-latest
env:
RUSTDOCFLAGS: -D warnings
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- run: cargo doc --no-deps --all-features

msrv:
name: MSRV (1.88)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@1.88.0
- uses: Swatinem/rust-cache@v2
- run: cargo check --all-features

- name: Run tests
run: cargo test
no-std:
name: no_std build (${{ matrix.crate }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
crate: [borsh_utils, spaces_protocol, spaces_nums, sip7]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- run: cargo check -p ${{ matrix.crate }} --no-default-features
16 changes: 16 additions & 0 deletions .github/workflows/commitlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Commitlint

on:
pull_request:
types: [opened, reopened, edited, synchronize]

jobs:
commitlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: wagoid/commitlint-github-action@v6
with:
configFile: .commitlintrc.yml
49 changes: 49 additions & 0 deletions .github/workflows/release-plz.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Release-plz

permissions:
pull-requests: write
contents: write

on:
push:
branches: [subspaces]

jobs:
# Opens / updates the "release PR" that bumps versions and edits the CHANGELOG.
release-plz-pr:
name: Release-plz PR
runs-on: ubuntu-latest
if: ${{ github.repository_owner == 'buffrr' }}
concurrency:
group: release-plz-${{ github.ref }}
cancel-in-progress: false
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: dtolnay/rust-toolchain@stable
- name: Run release-plz
uses: release-plz/action@v0.5
with:
command: release-pr
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

# Tags + publishes to crates.io when a release commit lands on main.
release-plz-release:
name: Release-plz publish
runs-on: ubuntu-latest
if: ${{ github.repository_owner == 'buffrr' }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: dtolnay/rust-toolchain@stable
- name: Run release-plz
uses: release-plz/action@v0.5
with:
command: release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
37 changes: 16 additions & 21 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: Build binaries and create release
name: Build binaries and upload to release

on:
push:
tags:
- 'v*.*.*'
- 'spaces_client-v*'

jobs:
release:
Expand All @@ -24,10 +24,12 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

- name: Get the tag name
- name: Extract version from tag
id: get_tag
run: |
run: |
# tag format: spaces_client-v0.1.0 → VERSION=0.1.0, TAG=<original>
echo "TAG=${GITHUB_REF##*/}" >> $GITHUB_ENV
echo "VERSION=${GITHUB_REF##*-v}" >> $GITHUB_ENV

- name: Set up Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
Expand All @@ -44,7 +46,7 @@ jobs:
env:
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
run: |
cargo build --release --target ${{ matrix.target }}
cargo build --release --target ${{ matrix.target }} -p spaces_client

- name: Get OS and architecture
run: |
Expand All @@ -53,23 +55,16 @@ jobs:

- name: Create release archive
run: |
mkdir -p spaces-${{ env.TAG }}-${{ env.OS }}-${{ env.ARCH }}
cp target/${{ matrix.target }}/release/spaced spaces-${{ env.TAG }}-${{ env.OS }}-${{ env.ARCH }}/spaced
cp target/${{ matrix.target }}/release/space-cli spaces-${{ env.TAG }}-${{ env.OS }}-${{ env.ARCH }}/space-cli
tar -czf spaces-${{ env.TAG }}-${{ env.OS }}-${{ env.ARCH }}.tar.gz spaces-${{ env.TAG }}-${{ env.OS }}-${{ env.ARCH }}
mkdir -p spaces-v${{ env.VERSION }}-${{ env.OS }}-${{ env.ARCH }}
cp target/${{ matrix.target }}/release/spaced spaces-v${{ env.VERSION }}-${{ env.OS }}-${{ env.ARCH }}/spaced
cp target/${{ matrix.target }}/release/space-cli spaces-v${{ env.VERSION }}-${{ env.OS }}-${{ env.ARCH }}/space-cli
tar -czf spaces-v${{ env.VERSION }}-${{ env.OS }}-${{ env.ARCH }}.tar.gz spaces-v${{ env.VERSION }}-${{ env.OS }}-${{ env.ARCH }}

- name: Create GitHub Release
id: create_release
- name: Upload artifacts to existing release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ env.TAG }} # Dynamically use the pushed tag
name: Release ${{ env.TAG }} # Use the tag for the release name
body: |
Spaces release of version ${{ env.TAG }}.
draft: false
prerelease: false
files: |
spaces-${{ env.TAG }}-${{ env.OS }}-${{ env.ARCH }}.tar.gz
make_latest: true
tag_name: ${{ env.TAG }}
files: |
spaces-v${{ env.VERSION }}-${{ env.OS }}-${{ env.ARCH }}.tar.gz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Loading
Loading