ci: fix ci
This commit is contained in:
1 parent
dfa7c463ac
commit
f15ee0a413
1 file changed
+46
-52
@@ -1,101 +1,95 @@
|
||||
name: Rust CI
|
||||
name: Rust CI (Native Install + Cache)
|
||||
on: [push, pull_request]
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
|
||||
jobs:
|
||||
check:
|
||||
build_and_check:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install Rust
|
||||
run: |
|
||||
if ! command -v rustc &> /dev/null; then
|
||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal
|
||||
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
|
||||
true
|
||||
fi
|
||||
|
||||
- name: Verify Rust installation
|
||||
- name: Cache Cargo
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/registry
|
||||
~/.cargo/git
|
||||
target
|
||||
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
||||
restore-keys: ${{ runner.os }}-cargo-
|
||||
|
||||
- name: Cargo Check & Build
|
||||
run: |
|
||||
rustc --version
|
||||
cargo --version
|
||||
|
||||
- name: Build
|
||||
run: cargo check --verbose
|
||||
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install Rust
|
||||
run: |
|
||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal
|
||||
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
|
||||
|
||||
- name: Verify Rust installation
|
||||
run: |
|
||||
rustc --version
|
||||
cargo --version
|
||||
|
||||
- name: Build
|
||||
run: cargo build --verbose
|
||||
cargo check --verbose
|
||||
cargo build --verbose
|
||||
|
||||
test:
|
||||
needs: build
|
||||
needs: build_and_check
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install Rust
|
||||
run: |
|
||||
if ! command -v rustc &> /dev/null; then
|
||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal
|
||||
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
|
||||
fi
|
||||
|
||||
- name: Verify Rust installation
|
||||
run: |
|
||||
rustc --version
|
||||
cargo --version
|
||||
- name: Cache Cargo
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/registry
|
||||
~/.cargo/git
|
||||
target
|
||||
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
||||
|
||||
- name: Test
|
||||
- name: Run Tests
|
||||
run: cargo test --verbose
|
||||
|
||||
docs:
|
||||
needs: build
|
||||
needs: build_and_check
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install Rust
|
||||
run: |
|
||||
if ! command -v rustc &> /dev/null; then
|
||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal
|
||||
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
|
||||
fi
|
||||
|
||||
- name: Verify Rust installation
|
||||
- name: Cache Cargo
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/registry
|
||||
~/.cargo/git
|
||||
target
|
||||
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
||||
|
||||
- name: Build docs
|
||||
run: |
|
||||
rustc --version
|
||||
cargo --version
|
||||
cargo doc --no-deps --document-private-items
|
||||
mkdir -p ./docs-output && cp -r target/doc/* ./docs-output/
|
||||
|
||||
- name: Build documentation
|
||||
run: cargo doc --no-deps --document-private-items
|
||||
|
||||
- name: Create docs directory
|
||||
run: mkdir -p ./docs-output && cp -r target/doc/* ./docs-output/
|
||||
|
||||
- name: Upload documentation as artifact
|
||||
- name: Upload Artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: rust-documentation
|
||||
path: ./docs-output/
|
||||
retention-days: 30
|
||||
if-no-files-found: error
|
||||
|
||||
retention-days: 7
|
||||
Reference in new issue
Block a user