Files
pubky-core/.github/workflows/pr-check.yml
Miguel Medeiros a74dc347b4 ci: split workflows and improve CI efficiency (#75)
* feat: add parallel PR check workflow

* fix: remove branch restriction for PR check workflow

* fix: suppress clippy warnings for needless lifetimes in CI workflows

* refactor: consolidate Clippy checks and streamline test workflows

* feat: add documentation workflow and remove legacy Rust CI workflow

* feat: trigger PR check workflow on push to main branch

* fix: update test command to use CI profile in PR check workflow

* fix: enhance test command with partitioning and retries for improved performance

* fix: remove partitioning from test command in PR check workflow

* fix: update test job to use matrix strategy for multiple crates

* fix: enhance test command with additional options for better output and error handling

* fix: remove silent mode from test command for clearer output

* fix: add check for existing tests before running in PR check workflow

* fix: add missing fi statement to close if condition in PR check workflow

* fix: improve test command logic to handle no tests found scenario
2025-02-21 16:51:00 -04:00

75 lines
1.9 KiB
YAML

name: PR Check
on:
pull_request:
push:
branches: [ main ]
jobs:
fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
components: rustfmt
override: true
- name: Check formatting
run: cargo fmt --check
clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
components: clippy
override: true
- name: Cache
uses: Swatinem/rust-cache@v2
- name: Lint with Clippy
run: cargo clippy --workspace --all-features -- -D warnings -A clippy::needless_lifetimes
test:
strategy:
matrix:
crate: [pubky, pubky-common, pubky-homeserver, pubky-testnet, http-relay]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Install Nextest
uses: taiki-e/install-action@nextest
- name: Cache
uses: Swatinem/rust-cache@v2
- name: Run tests
run: |
set -e
if cargo nextest run \
-p ${{ matrix.crate }} \
--all-features \
--test-threads num-cpus \
--retries 2 \
--no-fail-fast \
--verbose; then
echo "Tests passed for ${{ matrix.crate }}"
else
if [ $? -eq 4 ]; then
echo "No tests found for ${{ matrix.crate }}"
exit 0
else
echo "Tests failed for ${{ matrix.crate }}"
exit 1
fi
fi