Skip to content

feat: implement missing CLI commands and adapters #204

feat: implement missing CLI commands and adapters

feat: implement missing CLI commands and adapters #204

Workflow file for this run

name: CI
on:
push:
branches: [master, develop]
pull_request:
branches: [master, develop]
# Allow manual workflow runs
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
# Disable incremental compilation for CI builds (faster clean builds)
CARGO_INCREMENTAL: 0
# Enable full backtraces for tests
RUST_BACKTRACE: full
jobs:
check:
name: Check
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v9
- name: Check Rust formatting
run: nix develop -c cargo fmt --all -- --check
- name: Check code with cargo check
run: nix develop -c just check
- name: Run clippy lints
run: nix develop -c just clippy
- name: Check for typos
run: nix develop -c just typos
# Continue on failure for typos (informational)
continue-on-error: true
test:
name: Test
runs-on: ubuntu-latest
# Prevent concurrent test runs to avoid conflicts
concurrency:
group: test-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v9
- name: Build project
run: nix develop -c just build
- name: Run unit tests
run: nix develop -c cargo test --lib
timeout-minutes: 5
- name: Run workspace tests (excluding network integration crate)
# Run tests sequentially with --test-threads=1 to prevent conflicts
run: nix develop -c cargo test --workspace --tests --exclude nostrweet-integration-tests -- --test-threads=1
timeout-minutes: 10
- name: Run doc tests
run: nix develop -c cargo test --doc
timeout-minutes: 5
# Integration tests moved to separate workflow: .github/workflows/integration-tests.yml
# They run on push, PR, schedule, and manual trigger
build:
name: Build
runs-on: ubuntu-latest
strategy:
matrix:
target:
- x86_64-unknown-linux-gnu
- x86_64-unknown-linux-musl
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v9
- name: Build for ${{ matrix.target }}
run: |
if [ "${{ matrix.target }}" = "x86_64-unknown-linux-musl" ]; then
nix develop -c cargo build --release --target ${{ matrix.target }}
else
nix develop -c cargo build --release --target ${{ matrix.target }}
fi
- name: Upload binary artifact
uses: actions/upload-artifact@v4
with:
name: nostrweet-${{ matrix.target }}
path: target/${{ matrix.target }}/release/nostrweet
retention-days: 7
final-check:
name: Final Check
runs-on: ubuntu-latest
# Only run after all other jobs pass
needs: [check, test, build]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v9
- name: Run final checks (lint + clippy + tests)
run: nix develop -c just final-check
# Security audit job
audit:
name: Security Audit
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v9
- name: Install cargo-audit
run: nix develop -c cargo install --locked cargo-audit
- name: Run security audit
run: nix develop -c cargo audit
# Continue on failure for security audit (informational)
continue-on-error: true
# Release build job (only on tags)
release:
name: Release Build
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
needs: [check, test, build]
strategy:
matrix:
target:
- x86_64-unknown-linux-gnu
- x86_64-unknown-linux-musl
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v9
- name: Build release binary
run: nix develop -c cargo build --release --target ${{ matrix.target }}
- name: Strip binary (for musl targets)
if: matrix.target == 'x86_64-unknown-linux-musl'
run: nix develop -c strip target/${{ matrix.target }}/release/nostrweet
- name: Create release archive
run: |
cd target/${{ matrix.target }}/release
tar -czf nostrweet-${{ github.ref_name }}-${{ matrix.target }}.tar.gz nostrweet
mv nostrweet-${{ github.ref_name }}-${{ matrix.target }}.tar.gz ../../../
- name: Upload release artifact
uses: actions/upload-artifact@v4
with:
name: nostrweet-${{ github.ref_name }}-${{ matrix.target }}
path: nostrweet-${{ github.ref_name }}-${{ matrix.target }}.tar.gz
retention-days: 30
- name: Create GitHub Release
if: matrix.target == 'x86_64-unknown-linux-musl' # Only create release once
uses: softprops/action-gh-release@v1
with:
files: |
nostrweet-${{ github.ref_name }}-x86_64-unknown-linux-gnu.tar.gz
nostrweet-${{ github.ref_name }}-x86_64-unknown-linux-musl.tar.gz
generate_release_notes: true
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}