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