Skip to content

Commit

Permalink
Cargo tweaks for CI (#2527)
Browse files Browse the repository at this point in the history
* Disable cargo incremental builds on CI

* Add cargo cache

* Reduce debug to 1

* Cache only direct builds, move incremental

* Set lintchecks
  • Loading branch information
prasannavl authored Oct 4, 2023
1 parent 2a66c0f commit b1394b4
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 7 deletions.
3 changes: 3 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ rustflags = [
# "-C", "force-unwind-tables=y",
]

[profile.dev]
debug = 1

[target.x86_64-apple-darwin]
rustflags = [
"-C", "link-arg=-undefined",
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,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 depends and configure
run: ./make.sh build-deps && ./make.sh build-conf

Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/tests-ethlibs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,18 @@ 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 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
Expand All @@ -57,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
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/tests-frontier.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,18 @@ 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 binaries
run: ./make.sh build

- name: Upload binaries
uses: actions/upload-artifact@v3
with:
name: defibins
name: defi-bins
path: |
build/src/defid
Expand All @@ -50,7 +55,7 @@ jobs:
- name: Download binaries
uses: actions/download-artifact@v3
with:
name: defibins
name: defi-bins

- name: Setup permissions
run: |
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/tests-sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,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' }}

# 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
Expand All @@ -45,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
Expand Down Expand Up @@ -123,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
Expand Down
12 changes: 11 additions & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ on:
concurrency:
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}

jobs:
e2e-tests:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -43,6 +43,11 @@ jobs:
- 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

Expand All @@ -65,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

Expand Down
2 changes: 2 additions & 0 deletions make.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1070,11 +1070,13 @@ _nproc() {
# CI
# ---

# shellcheck disable=SC2129
ci_export_vars() {
if [[ -n "${GITHUB_ACTIONS-}" ]]; then
# GitHub Actions
echo "BUILD_VERSION=${IMAGE_VERSION}" >> "$GITHUB_ENV"
echo "PATH=$HOME/.cargo/bin:$PATH" >> "$GITHUB_ENV"
echo "CARGO_INCREMENTAL=0" >> "$GITHUB_ENV"
fi
}

Expand Down

0 comments on commit b1394b4

Please sign in to comment.