Skip to content

Commit

Permalink
chore(ci): cache axon bin
Browse files Browse the repository at this point in the history
  • Loading branch information
jjyr committed Aug 25, 2023
1 parent 8be66b5 commit f5d3a1e
Showing 1 changed file with 33 additions and 12 deletions.
45 changes: 33 additions & 12 deletions .github/workflows/ibc-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,46 +48,67 @@ jobs:
with:
toolchain: stable
override: true

- name: Create source folder
run: mkdir -p $SRC_DIR
- uses: Swatinem/rust-cache@v2
with:
workspaces: ".\n${{env.SRC_DIR}}/axon"

- name: Set Node.js 16.x
uses: actions/setup-node@v3
with:
node-version: 16.x

- name: Install yarn
run: npm install --global yarn

- name: Prepare CKB
run: |
if [ ! -f "/tmp/ckb.tar.gz" ]; then
curl -L https://github.com/nervosnetwork/ckb/releases/download/v0.107.0/ckb_v0.107.0_x86_64-unknown-linux-gnu.tar.gz -o /tmp/ckb.tar.gz
fi
tar -zxf /tmp/ckb.tar.gz -C /tmp
echo "/tmp/ckb_v0.107.0_x86_64-unknown-linux-gnu" >> $GITHUB_PATH
- name: Prepare Axon source
run: git clone --recursive https://github.com/axonweb3/axon.git $SRC_DIR/axon && cd $SRC_DIR/axon && git checkout $AXON_COMMIT
- name: Install Axon

- name: Rust cache
uses: Swatinem/rust-cache@v2
with:
workspaces: ".\n${{env.SRC_DIR}}/axon"

- name: Cache axon bin
id: cache-axon-bin
uses: actions/cache@v3
env:
cache-name: cache-axon-bin
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ${{env.SRC_DIR}}/axon/target/release/axon
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.AXON_COMMIT }}

- name: Build Axon
if: ${{ steps.cache-axon-bin.outputs.cache-hit != 'true' }}
uses: actions-rs/cargo@v1
with:
command: install
args: --path ${{env.SRC_DIR}}/axon
command: build
args: --release --manifest-path ${{env.SRC_DIR}}/axon/Cargo.toml

- name: Add axon bin to path
run: echo "${{env.SRC_DIR}}/axon/target/release/" >> $GITHUB_PATH

- name: Prepare IBC contracts
run: git clone --recursive https://github.com/synapseweb3/ibc-solidity-contract.git $SRC_DIR/ibc-solidity-contract && cd $SRC_DIR/ibc-solidity-contract && git checkout $IBC_CONTRACT_COMMIT

- name: Compile IBC contracts
working-directory: ${{env.SRC_DIR}}/ibc-solidity-contract
run: yarn install && yarn compile
- name: Compile packages
uses: actions-rs/cargo@v1
with:
command: build
args: -p ibc-relayer

- name: Compile tests
uses: actions-rs/cargo@v1
with:
command: build
args: -p ibc-test --all-features --tests --jobs=4
args: -p ibc-test -tests --jobs=4

- name: Run IBC tests
uses: actions-rs/cargo@v1
env:
Expand Down

0 comments on commit f5d3a1e

Please sign in to comment.