mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-08-06 05:24:42 -04:00
Optimize GitHub workflow file
1. Use rust-toolchain file toml syntax By using the toml syntax, we can specify all required components directly there and don't have to explicitly install the toolchain. 2. Use v2 of cache action The newer version comes with zstd compression which allows for faster saves and restores. 3. Run cache action in MacOS The issue with MacOS having faulty caches has been fixed in a recent release. 4. Bundle the registry cache together with the target directory The v2 cache action can handle multiple paths. 5. Install tomlfmt based on cache hit If we hit the cache, tomlfmt should be there. Otherwise we install it.
This commit is contained in:
parent
4d8e801c1e
commit
009e194790
2 changed files with 21 additions and 44 deletions
60
.github/workflows/ci.yml
vendored
60
.github/workflows/ci.yml
vendored
|
@ -15,21 +15,16 @@ jobs:
|
|||
- name: Checkout sources
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Install Rust
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
override: true
|
||||
components: rustfmt, clippy
|
||||
|
||||
- name: Cache ~/.cargo/bin directory
|
||||
uses: actions/cache@v1
|
||||
id: cache-cargo-bin
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/.cargo/bin
|
||||
key: ubuntu-rust-${{ env.RUST_TOOLCHAIN }}-cargo-bin-directory-v1
|
||||
key: ubuntu-rust-${{ hashFiles('rust-toolchain') }}-cargo-bin-directory-v1
|
||||
|
||||
- name: Install tomlfmt
|
||||
run: which cargo-tomlfmt || cargo install cargo-tomlfmt
|
||||
if: steps.cache-cargo-bin.outputs.cache-hit != 'true'
|
||||
run: cargo install cargo-tomlfmt
|
||||
|
||||
- name: Check Cargo.toml formatting
|
||||
run: |
|
||||
|
@ -64,24 +59,13 @@ jobs:
|
|||
- name: Checkout sources
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Install Rust toolchain
|
||||
uses: actions-rs/toolchain@v1
|
||||
- name: Cache target directory and cargo registry
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
profile: minimal
|
||||
override: true
|
||||
|
||||
- name: Cache target directory
|
||||
uses: actions/cache@v1
|
||||
if: matrix.os == 'ubuntu-latest'
|
||||
with:
|
||||
path: target
|
||||
key: rust-${{ matrix.target }}-target-directory-${{ hashFiles('Cargo.lock') }}-v1
|
||||
|
||||
- name: Cache ~/.cargo/registry directory
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: ~/.cargo/registry
|
||||
key: rust-${{ matrix.target }}-cargo-registry-directory-${{ hashFiles('Cargo.lock') }}-v1
|
||||
path: |
|
||||
target
|
||||
~/.cargo/registry
|
||||
key: rust-${{ matrix.target }}-target-directory-${{ hashFiles('Cargo.lock') }}-${{ hashFiles('rust-toolchain') }}-v1
|
||||
|
||||
- name: Cargo check release code with default features
|
||||
run: cargo check --workspace
|
||||
|
@ -127,23 +111,13 @@ jobs:
|
|||
- name: Checkout sources
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Install Rust toolchain
|
||||
uses: actions-rs/toolchain@v1
|
||||
- name: Cache target directory and cargo registry
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
profile: minimal
|
||||
override: true
|
||||
|
||||
- name: Cache target directory
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: target
|
||||
key: rust-${{ env.TARGET }}-target-directory-${{ hashFiles('Cargo.lock') }}-v1
|
||||
|
||||
- name: Cache ~/.cargo/registry directory
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: ~/.cargo/registry
|
||||
key: rust-${{ env.TARGET }}-cargo-registry-directory-${{ hashFiles('Cargo.lock') }}-v1
|
||||
path: |
|
||||
target
|
||||
~/.cargo/registry
|
||||
key: rust-${{ matrix.target }}-target-directory-${{ hashFiles('Cargo.lock') }}-${{ hashFiles('rust-toolchain') }}-v1
|
||||
|
||||
- name: Run test ${{ matrix.test_name }}
|
||||
run: cargo test --package swap --all-features --test ${{ matrix.test_name }} ""
|
||||
|
|
|
@ -1 +1,4 @@
|
|||
nightly-2021-01-31
|
||||
[toolchain]
|
||||
channel = "nightly-2021-01-31"
|
||||
components = ["rustfmt", "clippy"]
|
||||
targets = [ ]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue