Update deps and other files #5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Rust Build and Test | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
workflow_dispatch: | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
deps: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Create Folders | |
run: | | |
mkdir -p ~/.cargo/registry/index | |
mkdir -p ~/.cargo/registry/cache | |
mkdir -p ~/.cargo/git/db | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/registry/index | |
~/.cargo/registry/cache | |
~/.cargo/git/db | |
key: ${{ runner.os }}-deps-cache-${{ hashFiles('**/Cargo.toml') }} | |
- name: Update Rust | |
run: rustup update | |
- name: Rust Version | |
run: rustc --version | |
- name: Download Deps | |
run: cargo fetch --verbose | |
- name: Bundle Deps | |
run: | | |
mkdir -p .cargo-store/.cargo-store/registry | |
mkdir -p .cargo-store/.cargo-store/git | |
cp -r ~/.cargo/registry/index ./.cargo-store/.cargo-store/registry/index | |
cp -r ~/.cargo/registry/cache ./.cargo-store/.cargo-store/registry/cache | |
cp -r ~/.cargo/git/db ./.cargo-store/.cargo-store/git/db | |
- name: Store Crate Deps | |
uses: actions/upload-artifact@v3 | |
with: | |
name: crate-deps | |
path: .cargo-store | |
retention-days: 1 | |
x86_64-unknown-linux-gnu: | |
runs-on: ubuntu-latest | |
needs: [ deps ] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Download Deps | |
uses: actions/download-artifact@v3 | |
with: | |
name: crate-deps | |
- name: Move Deps | |
run: | | |
mv ./.cargo-store/* ~/.cargo | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
target | |
key: ${{ runner.os }}-x86_64-unknown-linux-gnu-${{ hashFiles('**/Cargo.toml') }} | |
- name: Update Rust | |
run: rustup update | |
- name: Rust Version | |
run: rustc --version | |
- name: Run tests | |
run: cargo test --verbose --workspace --all-features | |
- name: Build | |
run: cargo build --verbose --workspace | |
x86_64-apple-darwin: | |
runs-on: macos-12 | |
needs: [ deps ] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Download Deps | |
uses: actions/download-artifact@v3 | |
with: | |
name: crate-deps | |
- name: Move Deps | |
run: | | |
mv ./.cargo-store/* ~/.cargo | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
target | |
key: ${{ runner.os }}-x86_64-apple-darwin-${{ hashFiles('**/Cargo.toml') }} | |
- name: Update Rust | |
run: rustup update | |
- name: Rust Version | |
run: rustc --version | |
- name: Run tests | |
run: cargo test --verbose --workspace --all-features | |
- name: Build | |
run: cargo build --verbose --workspace | |
aarch64-apple-darwin: | |
runs-on: macos-12 | |
needs: [ deps ] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Download Deps | |
uses: actions/download-artifact@v3 | |
with: | |
name: crate-deps | |
- name: Move Deps | |
run: | | |
mv ./.cargo-store/* ~/.cargo | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
target | |
key: ${{ runner.os }}-aarch64-apple-darwin-${{ hashFiles('**/Cargo.toml') }} | |
- name: Update Rust | |
run: rustup update | |
- name: Rust Version | |
run: rustc --version | |
- name: Add Rust target | |
run: rustup target add aarch64-apple-darwin | |
- name: Build | |
run: cargo build --verbose --workspace --target aarch64-apple-darwin | |
x86_64-pc-windows-msvc: | |
runs-on: windows-latest | |
needs: [ deps ] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Download Deps | |
uses: actions/download-artifact@v3 | |
with: | |
name: crate-deps | |
- name: Move Deps | |
run: | | |
mv ./.cargo-store/* ~/.cargo | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
target | |
key: ${{ runner.os }}-x86_64-pc-windows-msvc-${{ hashFiles('**/Cargo.toml') }} | |
- name: Update Rust | |
run: rustup update | |
- name: Rust Version | |
run: rustc --version | |
- name: Run tests | |
run: cargo test --verbose --workspace --all-features | |
- name: Build | |
run: cargo build --verbose --workspace | |
i686-pc-windows-msvc: | |
runs-on: windows-latest | |
needs: [ deps ] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Download Deps | |
uses: actions/download-artifact@v3 | |
with: | |
name: crate-deps | |
- name: Move Deps | |
run: | | |
mv ./.cargo-store/* ~/.cargo | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
target | |
key: ${{ runner.os }}-i686-pc-windows-msvc-${{ hashFiles('**/Cargo.toml') }} | |
- name: Update Rust | |
run: rustup update | |
- name: Rust Version | |
run: rustc --version | |
- name: Add Rust target | |
run: rustup target add i686-pc-windows-msvc | |
- name: Run tests | |
run: cargo test --verbose --workspace --all-features --target i686-pc-windows-msvc | |
- name: Build | |
run: cargo build --verbose --workspace --target i686-pc-windows-msvc | |
cross: | |
strategy: | |
fail-fast: false | |
matrix: | |
target: | |
- x86_64-unknown-linux-musl | |
- aarch64-unknown-linux-gnu | |
- aarch64-unknown-linux-musl | |
- riscv64gc-unknown-linux-gnu | |
- s390x-unknown-linux-gnu | |
- armv7-unknown-linux-gnueabihf | |
- armv7-unknown-linux-musleabihf | |
runs-on: ubuntu-latest | |
needs: [ deps ] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Download Deps | |
uses: actions/download-artifact@v3 | |
with: | |
name: crate-deps | |
- name: Move Deps | |
run: | | |
mv ./.cargo-store/* ~/.cargo | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
target | |
key: ${{ runner.os }}-${{ matrix.target }}-${{ hashFiles('**/Cargo.toml') }} | |
- name: Update Rust | |
run: rustup update | |
- name: Rust Version | |
run: rustc --version | |
- uses: taiki-e/install-action@v2 | |
with: | |
tool: cross | |
- name: Build | |
run: cross build --verbose --workspace --target ${{ matrix.target }} |