diff --git a/.github/actions/cargo-cache/action.yml b/.github/actions/cargo-cache/action.yml new file mode 100644 index 0000000000..89069e7797 --- /dev/null +++ b/.github/actions/cargo-cache/action.yml @@ -0,0 +1,20 @@ +name: 'Set up cargo cache' +description: 'Sets up the cargo cache for the workflow' +runs: + using: 'composite' + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Set up cargo cache + uses: actions/cache@v3 + continue-on-error: false + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + restore-keys: ${{ runner.os }}-cargo- diff --git a/.github/workflows/adex-cli.yml b/.github/workflows/adex-cli.yml index 02390e203a..859471e956 100644 --- a/.github/workflows/adex-cli.yml +++ b/.github/workflows/adex-cli.yml @@ -33,6 +33,9 @@ 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: Start checking code format and lint run: | cargo fmt --manifest-path ./mm2src/adex_cli/Cargo.toml --all -- --check @@ -62,6 +65,9 @@ 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: Start testing run: | cargo test --manifest-path ./mm2src/adex_cli/Cargo.toml @@ -90,6 +96,9 @@ 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: Start building run: | cargo build --manifest-path ./mm2src/adex_cli/Cargo.toml diff --git a/.github/workflows/dev-build.yml b/.github/workflows/dev-build.yml index d7a4c2f959..b045d26fa9 100644 --- a/.github/workflows/dev-build.yml +++ b/.github/workflows/dev-build.yml @@ -41,6 +41,9 @@ 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 run: | rm -f ./MM_VERSION @@ -100,6 +103,9 @@ 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 run: | rm -f ./MM_VERSION @@ -147,6 +153,9 @@ 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 run: | if (test-path "./MM_VERSION") { @@ -196,6 +205,9 @@ 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 run: | rm -f ./MM_VERSION @@ -257,6 +269,9 @@ 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 run: | rm -f ./MM_VERSION @@ -305,6 +320,9 @@ 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 run: | rm -f ./MM_VERSION @@ -366,6 +384,9 @@ 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 run: | rm -f ./MM_VERSION @@ -429,6 +450,9 @@ 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 run: | rm -f ./MM_VERSION diff --git a/.github/workflows/fmt-and-lint.yml b/.github/workflows/fmt-and-lint.yml index b00adec115..093cdb823b 100644 --- a/.github/workflows/fmt-and-lint.yml +++ b/.github/workflows/fmt-and-lint.yml @@ -25,6 +25,9 @@ jobs: sudo apt-get -y install libudev-dev if: matrix.os == 'ubuntu-latest' + - name: Cargo cache + uses: ./.github/actions/cargo-cache + - name: fmt check run: cargo fmt -- --check @@ -42,5 +45,8 @@ jobs: rustup default nightly-2022-10-29 rustup target add wasm32-unknown-unknown + - name: Cargo cache + uses: ./.github/actions/cargo-cache + - name: wasm code lint run: cargo clippy --target wasm32-unknown-unknown -- --D warnings diff --git a/.github/workflows/release-build.yml b/.github/workflows/release-build.yml index 381b51fc08..a3b4657dab 100644 --- a/.github/workflows/release-build.yml +++ b/.github/workflows/release-build.yml @@ -41,6 +41,9 @@ 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 run: | rm -f ./MM_VERSION @@ -92,6 +95,9 @@ 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 run: | rm -f ./MM_VERSION @@ -133,6 +139,9 @@ 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 run: | if (test-path "./MM_VERSION") { @@ -176,6 +185,9 @@ 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 run: | rm -f ./MM_VERSION @@ -231,6 +243,9 @@ 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 run: | rm -f ./MM_VERSION @@ -273,6 +288,9 @@ 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 run: | rm -f ./MM_VERSION @@ -328,6 +346,9 @@ 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 run: | rm -f ./MM_VERSION @@ -385,6 +406,9 @@ 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 run: | rm -f ./MM_VERSION diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0101ea30cc..03041241d5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -25,6 +25,9 @@ jobs: rustup toolchain install nightly-2022-10-29 --no-self-update --profile=minimal rustup default nightly-2022-10-29 + - name: Cargo cache + uses: ./.github/actions/cargo-cache + - name: Test run: | # wget -O - https://raw.githubusercontent.com/KomodoPlatform/komodo/master/zcutil/fetch-params-alt.sh | bash @@ -47,6 +50,9 @@ jobs: rustup default nightly-2022-10-29 rustup target add x86_64-apple-darwin + - name: Cargo cache + uses: ./.github/actions/cargo-cache + - name: Test run: | # wget -O - https://raw.githubusercontent.com/KomodoPlatform/komodo/master/zcutil/fetch-params-alt.sh | bash @@ -68,6 +74,9 @@ jobs: rustup toolchain install nightly-2022-10-29 --no-self-update --profile=minimal rustup default nightly-2022-10-29 + - name: Cargo cache + uses: ./.github/actions/cargo-cache + - name: Test run: | # Invoke-WebRequest -Uri https://github.com/KomodoPlatform/komodo/raw/d456be35acd1f8584e1e4f971aea27bd0644d5c5/zcutil/wget64.exe -OutFile \wget64.exe @@ -104,6 +113,9 @@ jobs: rustup toolchain install nightly-2022-10-29 --no-self-update --profile=minimal rustup default nightly-2022-10-29 + - name: Cargo cache + uses: ./.github/actions/cargo-cache + - name: Test run: cargo test --test 'mm2_tests_main' @@ -145,6 +157,9 @@ jobs: rustup toolchain install nightly-2022-10-29 --no-self-update --profile=minimal rustup default nightly-2022-10-29 + - name: Cargo cache + uses: ./.github/actions/cargo-cache + - name: Test run: cargo test --test 'mm2_tests_main' @@ -164,6 +179,9 @@ jobs: rustup toolchain install nightly-2022-10-29 --no-self-update --profile=minimal rustup default nightly-2022-10-29 + - name: Cargo cache + uses: ./.github/actions/cargo-cache + - name: Test run: | wget -O - https://raw.githubusercontent.com/KomodoPlatform/komodo/master/zcutil/fetch-params-alt.sh | bash @@ -197,5 +215,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: Test run: WASM_BINDGEN_TEST_TIMEOUT=360 GECKODRIVER=/bin/geckodriver wasm-pack test --firefox --headless mm2src/mm2_main