Skip to content

Commit

Permalink
combine cargo cache + build cache
Browse files Browse the repository at this point in the history
  • Loading branch information
aalu1418 committed Oct 1, 2024
1 parent ad6d690 commit d541644
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
13 changes: 10 additions & 3 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,19 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
- run: |
- name: Cache cargo target dir
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: contracts/target
key: ${{ runner.os }}-v2-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
- name: build cargo cache into docker container
run: |
cd ..
docker buildx build ./contracts --platform=linux/amd64 -t solana-build:local
- run: |
- name: build from cached artifacts
run: |
cd ..
docker run -v "$(pwd)/":/workdir solana-build:local bash -c "cp -R /chainlink-solana/contracts/target/. /workdir/contracts/target && cd /workdir/contracts && anchor build"
docker run -v "$(pwd)/":/workdir solana-build:local bash -c "cd /workdir/contracts && anchor build && chmod -R 755 ./target"
rust_run_anchor_tests:
name: Rust Run Anchor Tests
Expand Down
3 changes: 3 additions & 0 deletions contracts/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ FROM backpackapp/build:v0.29.0
RUN git clone https://github.com/smartcontractkit/chainlink-solana.git /chainlink-solana

RUN cd /chainlink-solana/contracts && anchor build

# only keep downloaded artifacts in /root/.cargo cached
RUN rm -rf /chainlink-solana

0 comments on commit d541644

Please sign in to comment.