Skip to content

Commit

Permalink
improvement(CI): switch to proper rust caching (#2303)
Browse files Browse the repository at this point in the history
* switch to proper rust caching

Signed-off-by: onur-ozkan <[email protected]>

* fix linting

Signed-off-by: onur-ozkan <[email protected]>

* rename cargo-cache to build-cache

Signed-off-by: onur-ozkan <[email protected]>

* try caching

Signed-off-by: onur-ozkan <[email protected]>

* switch to rust-cache

Signed-off-by: onur-ozkan <[email protected]>

---------

Signed-off-by: onur-ozkan <[email protected]>
  • Loading branch information
onur-ozkan authored Dec 26, 2024
1 parent c5f544c commit 7c4bc27
Show file tree
Hide file tree
Showing 9 changed files with 69 additions and 79 deletions.
10 changes: 10 additions & 0 deletions .github/actions/build-cache/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: 'Set up build cache'
description: 'Sets up caching for KDF builds'
runs:
using: 'composite'
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up rust-cache
uses: Swatinem/rust-cache@v2
20 changes: 0 additions & 20 deletions .github/actions/cargo-cache/action.yml

This file was deleted.

36 changes: 18 additions & 18 deletions .github/workflows/dev-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ jobs:
if: github.event_name != 'pull_request'
run: echo "COMMIT_HASH=$(git rev-parse --short=7 HEAD)" >> $GITHUB_ENV

- name: Cargo cache
uses: ./.github/actions/cargo-cache
- name: Build cache
uses: ./.github/actions/build-cache

- name: Build
run: |
Expand Down Expand Up @@ -119,8 +119,8 @@ jobs:
if: github.event_name != 'pull_request'
run: echo "COMMIT_HASH=$(git rev-parse --short=7 HEAD)" >> $GITHUB_ENV

- name: Cargo cache
uses: ./.github/actions/cargo-cache
- name: Build cache
uses: ./.github/actions/build-cache

- name: Build
run: |
Expand Down Expand Up @@ -180,8 +180,8 @@ jobs:
if: github.event_name != 'pull_request'
run: echo "COMMIT_HASH=$(git rev-parse --short=7 HEAD)" >> $GITHUB_ENV

- name: Cargo cache
uses: ./.github/actions/cargo-cache
- name: Build cache
uses: ./.github/actions/build-cache

- name: Build
run: |
Expand Down Expand Up @@ -240,8 +240,8 @@ jobs:
if: github.event_name != 'pull_request'
run: echo "COMMIT_HASH=$(git rev-parse --short=7 HEAD)" >> $Env:GITHUB_ENV

- name: Cargo cache
uses: ./.github/actions/cargo-cache
- name: Build cache
uses: ./.github/actions/build-cache

- name: Build
run: |
Expand Down Expand Up @@ -303,8 +303,8 @@ jobs:
if: github.event_name != 'pull_request'
run: echo "COMMIT_HASH=$(git rev-parse --short=7 HEAD)" >> $GITHUB_ENV

- name: Cargo cache
uses: ./.github/actions/cargo-cache
- name: Build cache
uses: ./.github/actions/build-cache

- name: Build
run: |
Expand Down Expand Up @@ -378,8 +378,8 @@ jobs:
if: github.event_name != 'pull_request'
run: echo "COMMIT_HASH=$(git rev-parse --short=7 HEAD)" >> $GITHUB_ENV

- name: Cargo cache
uses: ./.github/actions/cargo-cache
- name: Build cache
uses: ./.github/actions/build-cache

- name: Build
run: |
Expand Down Expand Up @@ -430,8 +430,8 @@ jobs:
if: github.event_name != 'pull_request'
run: echo "COMMIT_HASH=$(git rev-parse --short=7 HEAD)" >> $GITHUB_ENV

- name: Cargo cache
uses: ./.github/actions/cargo-cache
- name: Build cache
uses: ./.github/actions/build-cache

- name: Build
run: |
Expand Down Expand Up @@ -505,8 +505,8 @@ jobs:
if: github.event_name != 'pull_request'
run: echo "COMMIT_HASH=$(git rev-parse --short=7 HEAD)" >> $GITHUB_ENV

- name: Cargo cache
uses: ./.github/actions/cargo-cache
- name: Build cache
uses: ./.github/actions/build-cache

- name: Build
run: |
Expand Down Expand Up @@ -582,8 +582,8 @@ jobs:
if: github.event_name != 'pull_request'
run: echo "COMMIT_HASH=$(git rev-parse --short=7 HEAD)" >> $GITHUB_ENV

- name: Cargo cache
uses: ./.github/actions/cargo-cache
- name: Build cache
uses: ./.github/actions/build-cache

- name: Build
run: |
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/fmt-and-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ jobs:
with:
deps: ('protoc' 'libudev-dev')

- name: Cargo cache
uses: ./.github/actions/cargo-cache
- name: Build cache
uses: ./.github/actions/build-cache

- name: fmt check
# Format checks aren't OS dependant.
Expand All @@ -54,8 +54,8 @@ jobs:
with:
deps: ('protoc')

- name: Cargo cache
uses: ./.github/actions/cargo-cache
- name: Build cache
uses: ./.github/actions/build-cache

- name: clippy lint
run: cargo clippy --target wasm32-unknown-unknown -- --D warnings
36 changes: 18 additions & 18 deletions .github/workflows/release-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ jobs:
if: github.event_name != 'pull_request'
run: echo "COMMIT_HASH=$(git rev-parse --short=7 HEAD)" >> $GITHUB_ENV

- name: Cargo cache
uses: ./.github/actions/cargo-cache
- name: Build cache
uses: ./.github/actions/build-cache

- name: Build
run: |
Expand Down Expand Up @@ -110,8 +110,8 @@ jobs:
if: github.event_name != 'pull_request'
run: echo "COMMIT_HASH=$(git rev-parse --short=7 HEAD)" >> $GITHUB_ENV

- name: Cargo cache
uses: ./.github/actions/cargo-cache
- name: Build cache
uses: ./.github/actions/build-cache

- name: Build
run: |
Expand Down Expand Up @@ -165,8 +165,8 @@ jobs:
if: github.event_name != 'pull_request'
run: echo "COMMIT_HASH=$(git rev-parse --short=7 HEAD)" >> $GITHUB_ENV

- name: Cargo cache
uses: ./.github/actions/cargo-cache
- name: Build cache
uses: ./.github/actions/build-cache

- name: Build
run: |
Expand Down Expand Up @@ -219,8 +219,8 @@ jobs:
if: github.event_name != 'pull_request'
run: echo "COMMIT_HASH=$(git rev-parse --short=7 HEAD)" >> $Env:GITHUB_ENV

- name: Cargo cache
uses: ./.github/actions/cargo-cache
- name: Build cache
uses: ./.github/actions/build-cache

- name: Build
run: |
Expand Down Expand Up @@ -275,8 +275,8 @@ jobs:
if: github.event_name != 'pull_request'
run: echo "COMMIT_HASH=$(git rev-parse --short=7 HEAD)" >> $GITHUB_ENV

- name: Cargo cache
uses: ./.github/actions/cargo-cache
- name: Build cache
uses: ./.github/actions/build-cache

- name: Build
run: |
Expand Down Expand Up @@ -344,8 +344,8 @@ jobs:
if: github.event_name != 'pull_request'
run: echo "COMMIT_HASH=$(git rev-parse --short=7 HEAD)" >> $GITHUB_ENV

- name: Cargo cache
uses: ./.github/actions/cargo-cache
- name: Build cache
uses: ./.github/actions/build-cache

- name: Build
run: |
Expand Down Expand Up @@ -393,8 +393,8 @@ jobs:
if: github.event_name != 'pull_request'
run: echo "COMMIT_HASH=$(git rev-parse --short=7 HEAD)" >> $GITHUB_ENV

- name: Cargo cache
uses: ./.github/actions/cargo-cache
- name: Build cache
uses: ./.github/actions/build-cache

- name: Build
run: |
Expand Down Expand Up @@ -462,8 +462,8 @@ jobs:
if: github.event_name != 'pull_request'
run: echo "COMMIT_HASH=$(git rev-parse --short=7 HEAD)" >> $GITHUB_ENV

- name: Cargo cache
uses: ./.github/actions/cargo-cache
- name: Build cache
uses: ./.github/actions/build-cache

- name: Build
run: |
Expand Down Expand Up @@ -533,8 +533,8 @@ jobs:
if: github.event_name != 'pull_request'
run: echo "COMMIT_HASH=$(git rev-parse --short=7 HEAD)" >> $GITHUB_ENV

- name: Cargo cache
uses: ./.github/actions/cargo-cache
- name: Build cache
uses: ./.github/actions/build-cache

- name: Build
run: |
Expand Down
32 changes: 16 additions & 16 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ jobs:
with:
deps: ('protoc')

- name: Cargo cache
uses: ./.github/actions/cargo-cache
- name: Build cache
uses: ./.github/actions/build-cache

- name: Test
run: |
Expand All @@ -61,8 +61,8 @@ jobs:
with:
deps: ('protoc')

- name: Cargo cache
uses: ./.github/actions/cargo-cache
- name: Build cache
uses: ./.github/actions/build-cache

- name: Test
run: |
Expand All @@ -89,8 +89,8 @@ jobs:
with:
deps: ('protoc')

- name: Cargo cache
uses: ./.github/actions/cargo-cache
- name: Build cache
uses: ./.github/actions/build-cache

- name: Test
run: |
Expand All @@ -117,8 +117,8 @@ jobs:
with:
deps: ('protoc')

- name: Cargo cache
uses: ./.github/actions/cargo-cache
- name: Build cache
uses: ./.github/actions/build-cache

- name: Test
run: |
Expand Down Expand Up @@ -149,8 +149,8 @@ jobs:
- name: Set loopback address
run: ./scripts/ci/lo0_config.sh

- name: Cargo cache
uses: ./.github/actions/cargo-cache
- name: Build cache
uses: ./.github/actions/build-cache

- name: Test
run: |
Expand Down Expand Up @@ -178,8 +178,8 @@ jobs:
with:
deps: ('protoc')

- name: Cargo cache
uses: ./.github/actions/cargo-cache
- name: Build cache
uses: ./.github/actions/build-cache

- name: Download wget64
uses: ./.github/actions/download-and-verify
Expand Down Expand Up @@ -214,8 +214,8 @@ jobs:
with:
deps: ('protoc')

- name: Cargo cache
uses: ./.github/actions/cargo-cache
- name: Build cache
uses: ./.github/actions/build-cache

- name: Test
run: |
Expand Down Expand Up @@ -264,8 +264,8 @@ jobs:
sudo tar -xzvf geckodriver-v0.32.2-linux64.tar.gz -C /bin
sudo chmod +x /bin/geckodriver
- name: Cargo cache
uses: ./.github/actions/cargo-cache
- name: Build cache
uses: ./.github/actions/build-cache

- name: Test
run: WASM_BINDGEN_TEST_TIMEOUT=480 GECKODRIVER=/bin/geckodriver wasm-pack test --firefox --headless mm2src/mm2_main
2 changes: 1 addition & 1 deletion mm2src/coins/eth/eth_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1045,5 +1045,5 @@ fn test_gas_limit_conf() {
fn test_h256_to_str() {
let h = H256::from_str("5136701f11060010841c9708c3eb26f6606a070b8ae43f4b98b6d7b10a545258").unwrap();
let b: BytesJson = h.0.to_vec().into();
println!("H256={}", format!("0x{:02x}", b));
println!("H256=0x{:02x}", b);
}
2 changes: 1 addition & 1 deletion mm2src/trading_api/src/one_inch_api/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ impl<'a> UrlBuilder<'a> {
let url = self
.base_url
.join(self.endpoint)?
.join(&format!("{}/", self.chain_id.to_string()))?
.join(&format!("{}/", self.chain_id))?
.join(self.method_name.as_str())?;
Ok(Url::parse_with_params(
url.as_str(),
Expand Down
2 changes: 1 addition & 1 deletion mm2src/trading_api/src/one_inch_api/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ impl NativeError {
match serde_json::from_value(body) {
Ok(err) => Self::HttpError400(err),
Err(err) => Self::ParseError {
error_msg: format!("could not parse error response: {}", err.to_string()),
error_msg: format!("could not parse error response: {}", err),
},
}
} else {
Expand Down

0 comments on commit 7c4bc27

Please sign in to comment.