build(github CI): add cargo cache (#109)

This commit is contained in:
HAOYUatHZ 2022-11-23 00:45:14 +08:00 committed by GitHub
parent 81c2d6ddd7
commit f74724763c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 57 additions and 0 deletions

View File

@ -20,6 +20,15 @@ jobs:
- name: install target
run: rustup target add aarch64-apple-darwin
- name: cargo cache artifacts
uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-${{ runner.arch }}-cargo-build-target-${{ hashFiles('Cargo.lock') }}
- name: build
run: cargo build --package cli --release --target aarch64-apple-darwin
@ -57,6 +66,15 @@ jobs:
- name: install target
run: rustup target add x86_64-apple-darwin
- name: cargo cache artifacts
uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-${{ runner.arch }}-cargo-build-target-${{ hashFiles('Cargo.lock') }}
- name: build
run: cargo build --package cli --release --target x86_64-apple-darwin
@ -100,6 +118,15 @@ jobs:
sudo apt-get install -y gcc-aarch64-linux-gnu
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
- name: cargo cache artifacts
uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-${{ runner.arch }}-cargo-build-target-${{ hashFiles('Cargo.lock') }}
- name: build
run: cargo build --package cli --release --target aarch64-unknown-linux-gnu
@ -137,6 +164,15 @@ jobs:
- name: install target
run: rustup target add x86_64-unknown-linux-gnu
- name: cargo cache artifacts
uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-${{ runner.arch }}-cargo-build-target-${{ hashFiles('Cargo.lock') }}
- name: build
run: cargo build --package cli --release --target x86_64-unknown-linux-gnu

View File

@ -17,6 +17,13 @@ jobs:
profile: minimal
toolchain: nightly
override: true
- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-${{ runner.arch }}-cargo-build-target-${{ hashFiles('Cargo.lock') }}
- uses: actions-rs/cargo@v1
with:
command: check
@ -31,6 +38,13 @@ jobs:
profile: minimal
toolchain: nightly
override: true
- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-${{ runner.arch }}-cargo-build-target-${{ hashFiles('Cargo.lock') }}
- uses: actions-rs/cargo@v1
with:
command: test
@ -47,6 +61,13 @@ jobs:
toolchain: nightly
override: true
- run: rustup component add rustfmt
- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-${{ runner.arch }}-cargo-build-target-${{ hashFiles('Cargo.lock') }}
- uses: actions-rs/cargo@v1
with:
command: fmt