From e2838ef8b7ffd2bcb0962691258c7512f42d9770 Mon Sep 17 00:00:00 2001 From: Prasanna Loganathar Date: Tue, 3 Oct 2023 21:39:05 +0800 Subject: [PATCH 1/5] Disable cargo incremental builds on CI --- .github/workflows/build-dev.yaml | 2 ++ .github/workflows/build-release.yaml | 2 ++ .github/workflows/build-staging.yaml | 2 ++ .github/workflows/lint.yaml | 2 ++ .github/workflows/tests-ethlibs.yaml | 4 +++- .github/workflows/tests-frontier.yml | 4 ++++ .github/workflows/tests-jellyfish.yml | 2 ++ .github/workflows/tests-sync.yml | 4 ++++ .github/workflows/tests.yaml | 6 +++++- 9 files changed, 26 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-dev.yaml b/.github/workflows/build-dev.yaml index b1ee4d61da..6669c77931 100644 --- a/.github/workflows/build-dev.yaml +++ b/.github/workflows/build-dev.yaml @@ -23,6 +23,8 @@ env: # make.sh still defaults to debug for local builds MAKE_DEBUG: 0 GIT_VERSION: 1 + # Disable incremental build + CARGO_INCREMENTAL: 0 jobs: linux-x64: diff --git a/.github/workflows/build-release.yaml b/.github/workflows/build-release.yaml index 69bea3660d..0437f8781f 100644 --- a/.github/workflows/build-release.yaml +++ b/.github/workflows/build-release.yaml @@ -10,6 +10,8 @@ env: DOCKER_HUB_USER: defi MAKE_DEBUG: 0 GIT_VERSION: 1 + # Disable incremental build + CARGO_INCREMENTAL: 0 jobs: linux-x64: diff --git a/.github/workflows/build-staging.yaml b/.github/workflows/build-staging.yaml index d04e4d3994..74151fae98 100644 --- a/.github/workflows/build-staging.yaml +++ b/.github/workflows/build-staging.yaml @@ -6,6 +6,8 @@ on: env: MAKE_DEBUG: 0 GIT_VERSION: 1 + # Disable incremental build + CARGO_INCREMENTAL: 0 jobs: linux-x64: diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 798215be79..ce36338efc 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -18,6 +18,8 @@ concurrency: env: TARGET: x86_64-pc-linux-gnu MAKE_DEBUG: 0 + # Disable incremental build + CARGO_INCREMENTAL: 0 jobs: generic: diff --git a/.github/workflows/tests-ethlibs.yaml b/.github/workflows/tests-ethlibs.yaml index ea873682a2..d46358347a 100644 --- a/.github/workflows/tests-ethlibs.yaml +++ b/.github/workflows/tests-ethlibs.yaml @@ -15,7 +15,9 @@ concurrency: env: NODE_URL: "http://127.0.0.1:19551/" - + # Disable incremental build + CARGO_INCREMENTAL: 0 + jobs: build: runs-on: ubuntu-latest diff --git a/.github/workflows/tests-frontier.yml b/.github/workflows/tests-frontier.yml index 11981fbbd4..d45194eef2 100644 --- a/.github/workflows/tests-frontier.yml +++ b/.github/workflows/tests-frontier.yml @@ -10,6 +10,10 @@ concurrency: group: ${{ github.workflow }}-${{ github.ref || github.run_id }} cancel-in-progress: ${{ github.ref != 'refs/heads/master' }} +env: + # Disable incremental build + CARGO_INCREMENTAL: 0 + jobs: build: runs-on: ubuntu-latest diff --git a/.github/workflows/tests-jellyfish.yml b/.github/workflows/tests-jellyfish.yml index 235d6f337f..7bf8ab3f99 100644 --- a/.github/workflows/tests-jellyfish.yml +++ b/.github/workflows/tests-jellyfish.yml @@ -12,6 +12,8 @@ concurrency: env: BUILD_VERSION: latest # Computed + # Disable incremental build + CARGO_INCREMENTAL: 0 jobs: test: diff --git a/.github/workflows/tests-sync.yml b/.github/workflows/tests-sync.yml index 4c9777bfcf..46fe1d2169 100644 --- a/.github/workflows/tests-sync.yml +++ b/.github/workflows/tests-sync.yml @@ -21,6 +21,10 @@ concurrency: run-name: ${{ inputs.name || github.event.pull_request.title || github.ref_name }} +env: + # Disable incremental build + CARGO_INCREMENTAL: 0 + jobs: build: if: contains(github.event.pull_request.labels.*.name, 'ci/sync') || github.event_name == 'workflow_dispatch' diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index ec39772947..66e3372f77 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -14,7 +14,11 @@ on: concurrency: group: ${{ github.workflow }}-${{ github.ref || github.run_id }} cancel-in-progress: ${{ github.ref != 'refs/heads/master' }} - + +env: + # Disable incremental build + CARGO_INCREMENTAL: 0 + jobs: e2e-tests: runs-on: ubuntu-latest From dc30bd1f6a125d727908911e264b0b135c49fe4b Mon Sep 17 00:00:00 2001 From: Prasanna Loganathar Date: Tue, 3 Oct 2023 21:58:32 +0800 Subject: [PATCH 2/5] Add cargo cache --- .github/workflows/build-dev.yaml | 4 ++++ .github/workflows/lint.yaml | 4 ++++ .github/workflows/tests-ethlibs.yaml | 4 ++++ .github/workflows/tests-frontier.yml | 4 ++++ .github/workflows/tests-jellyfish.yml | 4 ++++ .github/workflows/tests-sync.yml | 4 ++++ .github/workflows/tests.yaml | 4 ++++ 7 files changed, 28 insertions(+) diff --git a/.github/workflows/build-dev.yaml b/.github/workflows/build-dev.yaml index 6669c77931..a17631d9b5 100644 --- a/.github/workflows/build-dev.yaml +++ b/.github/workflows/build-dev.yaml @@ -38,6 +38,10 @@ jobs: - name: Populate environment run: ./make.sh ci-export-vars + - uses: Swatinem/rust-cache@v2 + with: + workspaces: lib -> ../build/lib/target + - name: Build and package run: ./make.sh docker-release diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index ce36338efc..5cc3e376b4 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -51,6 +51,10 @@ jobs: - name: Populate environment run: ./make.sh ci-export-vars + - uses: Swatinem/rust-cache@v2 + with: + workspaces: lib -> ../build/lib/target + - name: Setup dependencies run: ./make.sh ci-setup-deps diff --git a/.github/workflows/tests-ethlibs.yaml b/.github/workflows/tests-ethlibs.yaml index d46358347a..5ae09a1c6d 100644 --- a/.github/workflows/tests-ethlibs.yaml +++ b/.github/workflows/tests-ethlibs.yaml @@ -28,6 +28,10 @@ jobs: - name: Populate environment run: ./make.sh ci-export-vars + - uses: Swatinem/rust-cache@v2 + with: + workspaces: lib -> ../build/lib/target + - name: Setup dependencies run: ./make.sh ci-setup-deps diff --git a/.github/workflows/tests-frontier.yml b/.github/workflows/tests-frontier.yml index d45194eef2..b8578f1c71 100644 --- a/.github/workflows/tests-frontier.yml +++ b/.github/workflows/tests-frontier.yml @@ -23,6 +23,10 @@ jobs: - name: Populate environment run: ./make.sh ci-export-vars + - uses: Swatinem/rust-cache@v2 + with: + workspaces: lib -> ../build/lib/target + - name: Setup dependencies run: sudo ./make.sh ci-setup-deps diff --git a/.github/workflows/tests-jellyfish.yml b/.github/workflows/tests-jellyfish.yml index 7bf8ab3f99..0d598cba36 100644 --- a/.github/workflows/tests-jellyfish.yml +++ b/.github/workflows/tests-jellyfish.yml @@ -36,6 +36,10 @@ jobs: - name: Populate environment run: cd defichain && GIT_VERSION=1 ./make.sh ci-export-vars + - uses: Swatinem/rust-cache@v2 + with: + workspaces: defichain/lib -> ../build/lib/target + - name: Build and setup run: "cd defichain && docker build -t test-build-container -f ./contrib/dockerfiles/x86_64-pc-linux-gnu.dockerfile ." diff --git a/.github/workflows/tests-sync.yml b/.github/workflows/tests-sync.yml index 46fe1d2169..c98dbf0a81 100644 --- a/.github/workflows/tests-sync.yml +++ b/.github/workflows/tests-sync.yml @@ -35,6 +35,10 @@ jobs: - name: Populate environment run: ./make.sh ci-export-vars + - uses: Swatinem/rust-cache@v2 + with: + workspaces: lib -> ../build/lib/target + - name: Setup dependencies run: sudo ./make.sh ci-setup-deps diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 66e3372f77..4fffd905df 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -41,6 +41,10 @@ jobs: - name: Populate environment run: ./make.sh ci-export-vars + - uses: Swatinem/rust-cache@v2 + with: + workspaces: lib -> ../build/lib/target + - name: Install dependencies run: ./make.sh ci-setup-deps From b954b6d71a2ec50aaf0b4c5aecc0574cbdda5c25 Mon Sep 17 00:00:00 2001 From: Prasanna Loganathar Date: Tue, 3 Oct 2023 22:11:25 +0800 Subject: [PATCH 3/5] Reduce debug to 1 --- .cargo/config.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.cargo/config.toml b/.cargo/config.toml index 1d679e25fc..4792853988 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -12,6 +12,9 @@ rustflags = [ # "-C", "force-unwind-tables=y", ] +[profile.dev] +debug = 1 + [target.x86_64-apple-darwin] rustflags = [ "-C", "link-arg=-undefined", From 2a4b5136551b6b388b81f235b4d54c49784e1f56 Mon Sep 17 00:00:00 2001 From: Prasanna Loganathar Date: Wed, 4 Oct 2023 04:23:45 +0800 Subject: [PATCH 4/5] Cache only direct builds, move incremental --- .github/workflows/build-dev.yaml | 6 ------ .github/workflows/build-release.yaml | 2 -- .github/workflows/build-staging.yaml | 2 -- .github/workflows/lint.yaml | 11 +++++------ .github/workflows/tests-ethlibs.yaml | 17 ++++++++--------- .github/workflows/tests-frontier.yml | 17 +++++++---------- .github/workflows/tests-jellyfish.yml | 6 ------ .github/workflows/tests-sync.yml | 17 +++++++---------- .github/workflows/tests.yaml | 18 ++++++++++-------- make.sh | 1 + 10 files changed, 38 insertions(+), 59 deletions(-) diff --git a/.github/workflows/build-dev.yaml b/.github/workflows/build-dev.yaml index a17631d9b5..b1ee4d61da 100644 --- a/.github/workflows/build-dev.yaml +++ b/.github/workflows/build-dev.yaml @@ -23,8 +23,6 @@ env: # make.sh still defaults to debug for local builds MAKE_DEBUG: 0 GIT_VERSION: 1 - # Disable incremental build - CARGO_INCREMENTAL: 0 jobs: linux-x64: @@ -38,10 +36,6 @@ jobs: - name: Populate environment run: ./make.sh ci-export-vars - - uses: Swatinem/rust-cache@v2 - with: - workspaces: lib -> ../build/lib/target - - name: Build and package run: ./make.sh docker-release diff --git a/.github/workflows/build-release.yaml b/.github/workflows/build-release.yaml index 0437f8781f..69bea3660d 100644 --- a/.github/workflows/build-release.yaml +++ b/.github/workflows/build-release.yaml @@ -10,8 +10,6 @@ env: DOCKER_HUB_USER: defi MAKE_DEBUG: 0 GIT_VERSION: 1 - # Disable incremental build - CARGO_INCREMENTAL: 0 jobs: linux-x64: diff --git a/.github/workflows/build-staging.yaml b/.github/workflows/build-staging.yaml index 74151fae98..d04e4d3994 100644 --- a/.github/workflows/build-staging.yaml +++ b/.github/workflows/build-staging.yaml @@ -6,8 +6,6 @@ on: env: MAKE_DEBUG: 0 GIT_VERSION: 1 - # Disable incremental build - CARGO_INCREMENTAL: 0 jobs: linux-x64: diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 5cc3e376b4..2fe3913456 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -18,8 +18,6 @@ concurrency: env: TARGET: x86_64-pc-linux-gnu MAKE_DEBUG: 0 - # Disable incremental build - CARGO_INCREMENTAL: 0 jobs: generic: @@ -51,16 +49,17 @@ jobs: - name: Populate environment run: ./make.sh ci-export-vars - - uses: Swatinem/rust-cache@v2 - with: - workspaces: lib -> ../build/lib/target - - name: Setup dependencies run: ./make.sh ci-setup-deps - name: Setup dependencies for target run: ./make.sh ci-setup-deps-target + - uses: Swatinem/rust-cache@v2 + with: + workspaces: lib -> ../build/lib/target + save-if: ${{ github.ref == 'refs/heads/master' }} + - name: Build depends and configure run: ./make.sh build-deps && ./make.sh build-conf diff --git a/.github/workflows/tests-ethlibs.yaml b/.github/workflows/tests-ethlibs.yaml index 5ae09a1c6d..ca3ce37b28 100644 --- a/.github/workflows/tests-ethlibs.yaml +++ b/.github/workflows/tests-ethlibs.yaml @@ -15,9 +15,7 @@ concurrency: env: NODE_URL: "http://127.0.0.1:19551/" - # Disable incremental build - CARGO_INCREMENTAL: 0 - + jobs: build: runs-on: ubuntu-latest @@ -28,23 +26,24 @@ jobs: - name: Populate environment run: ./make.sh ci-export-vars - - uses: Swatinem/rust-cache@v2 - with: - workspaces: lib -> ../build/lib/target - - name: Setup dependencies run: ./make.sh ci-setup-deps - name: Setup dependencies for target run: ./make.sh ci-setup-deps-target + - uses: Swatinem/rust-cache@v2 + with: + workspaces: lib -> ../build/lib/target + save-if: ${{ github.ref == 'refs/heads/master' }} + - name: Build binaries run: ./make.sh build - name: Upload binaries uses: actions/upload-artifact@v3 with: - name: defibins + name: defi-bins path: | build/src/defid build/src/defi-cli @@ -63,7 +62,7 @@ jobs: - name: Download binaries uses: actions/download-artifact@v3 with: - name: defibins + name: defi-bins - name: Download shell commands uses: actions/download-artifact@v3 diff --git a/.github/workflows/tests-frontier.yml b/.github/workflows/tests-frontier.yml index b8578f1c71..42cef9f74a 100644 --- a/.github/workflows/tests-frontier.yml +++ b/.github/workflows/tests-frontier.yml @@ -10,10 +10,6 @@ concurrency: group: ${{ github.workflow }}-${{ github.ref || github.run_id }} cancel-in-progress: ${{ github.ref != 'refs/heads/master' }} -env: - # Disable incremental build - CARGO_INCREMENTAL: 0 - jobs: build: runs-on: ubuntu-latest @@ -23,23 +19,24 @@ jobs: - name: Populate environment run: ./make.sh ci-export-vars - - uses: Swatinem/rust-cache@v2 - with: - workspaces: lib -> ../build/lib/target - - name: Setup dependencies run: sudo ./make.sh ci-setup-deps - name: Setup dependencies for target run: ./make.sh ci-setup-deps-target + - uses: Swatinem/rust-cache@v2 + with: + workspaces: lib -> ../build/lib/target + save-if: ${{ github.ref == 'refs/heads/master' }} + - name: Build binaries run: ./make.sh build - name: Upload binaries uses: actions/upload-artifact@v3 with: - name: defibins + name: defi-bins path: | build/src/defid @@ -58,7 +55,7 @@ jobs: - name: Download binaries uses: actions/download-artifact@v3 with: - name: defibins + name: defi-bins - name: Setup permissions run: | diff --git a/.github/workflows/tests-jellyfish.yml b/.github/workflows/tests-jellyfish.yml index 0d598cba36..235d6f337f 100644 --- a/.github/workflows/tests-jellyfish.yml +++ b/.github/workflows/tests-jellyfish.yml @@ -12,8 +12,6 @@ concurrency: env: BUILD_VERSION: latest # Computed - # Disable incremental build - CARGO_INCREMENTAL: 0 jobs: test: @@ -36,10 +34,6 @@ jobs: - name: Populate environment run: cd defichain && GIT_VERSION=1 ./make.sh ci-export-vars - - uses: Swatinem/rust-cache@v2 - with: - workspaces: defichain/lib -> ../build/lib/target - - name: Build and setup run: "cd defichain && docker build -t test-build-container -f ./contrib/dockerfiles/x86_64-pc-linux-gnu.dockerfile ." diff --git a/.github/workflows/tests-sync.yml b/.github/workflows/tests-sync.yml index c98dbf0a81..55e53c329a 100644 --- a/.github/workflows/tests-sync.yml +++ b/.github/workflows/tests-sync.yml @@ -21,10 +21,6 @@ concurrency: run-name: ${{ inputs.name || github.event.pull_request.title || github.ref_name }} -env: - # Disable incremental build - CARGO_INCREMENTAL: 0 - jobs: build: if: contains(github.event.pull_request.labels.*.name, 'ci/sync') || github.event_name == 'workflow_dispatch' @@ -35,16 +31,17 @@ jobs: - name: Populate environment run: ./make.sh ci-export-vars - - uses: Swatinem/rust-cache@v2 - with: - workspaces: lib -> ../build/lib/target - - name: Setup dependencies run: sudo ./make.sh ci-setup-deps - name: Setup dependencies for target run: ./make.sh ci-setup-deps-target + - uses: Swatinem/rust-cache@v2 + with: + workspaces: lib -> ../build/lib/target + save-if: ${{ github.ref == 'refs/heads/master' }} + # TODO: Switch this to a docker build later and this builds on the native # VM toolchain and loses disparity with the CI release builds - name: Build binaries @@ -53,7 +50,7 @@ jobs: - name: Upload binaries uses: actions/upload-artifact@v3 with: - name: defibins + name: defi-bins path: | build/src/defid build/src/defi-cli @@ -131,7 +128,7 @@ jobs: - name: Download Binaries uses: actions/download-artifact@v3 with: - name: defibins + name: defi-bins - name: Download Shell Commands uses: actions/download-artifact@v3 diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 4fffd905df..cd5c95dc57 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -15,10 +15,6 @@ concurrency: group: ${{ github.workflow }}-${{ github.ref || github.run_id }} cancel-in-progress: ${{ github.ref != 'refs/heads/master' }} -env: - # Disable incremental build - CARGO_INCREMENTAL: 0 - jobs: e2e-tests: runs-on: ubuntu-latest @@ -41,16 +37,17 @@ jobs: - name: Populate environment run: ./make.sh ci-export-vars - - uses: Swatinem/rust-cache@v2 - with: - workspaces: lib -> ../build/lib/target - - name: Install dependencies run: ./make.sh ci-setup-deps - name: Install dependencies for target run: ./make.sh ci-setup-deps-target + - uses: Swatinem/rust-cache@v2 + with: + workspaces: lib -> ../build/lib/target + save-if: ${{ github.ref == 'refs/heads/master' }} + - name: Build deps and configure run: ./make.sh build @@ -73,6 +70,11 @@ jobs: - name: Setup dependencies for target run: ./make.sh ci-setup-deps-target + - uses: Swatinem/rust-cache@v2 + with: + workspaces: lib -> ../build/lib/target + save-if: ${{ github.ref == 'refs/heads/master' }} + - name: Build deps and configure run: ./make.sh build-deps && ./make.sh build-conf diff --git a/make.sh b/make.sh index 105943c725..e9adbedd52 100755 --- a/make.sh +++ b/make.sh @@ -1075,6 +1075,7 @@ ci_export_vars() { # GitHub Actions echo "BUILD_VERSION=${IMAGE_VERSION}" >> "$GITHUB_ENV" echo "PATH=$HOME/.cargo/bin:$PATH" >> "$GITHUB_ENV" + echo "CARGO_INCREMENTAL=0" >> "$GITHUB_ENV" fi } From 184b88fc866d61944d6f0873957c3ba61e0a2085 Mon Sep 17 00:00:00 2001 From: Prasanna Loganathar Date: Wed, 4 Oct 2023 04:31:23 +0800 Subject: [PATCH 5/5] Set lintchecks --- make.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/make.sh b/make.sh index e9adbedd52..ecbcca3699 100755 --- a/make.sh +++ b/make.sh @@ -1070,6 +1070,7 @@ _nproc() { # CI # --- +# shellcheck disable=SC2129 ci_export_vars() { if [[ -n "${GITHUB_ACTIONS-}" ]]; then # GitHub Actions