Skip to content

Commit

Permalink
Add environment setup and builds caching
Browse files Browse the repository at this point in the history
  • Loading branch information
kisialiou committed Jan 28, 2025
1 parent 888c707 commit 558752b
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 4 deletions.
69 changes: 67 additions & 2 deletions .github/e2e-setup/action.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,104 @@
name: E2E Setup
description: Setup environment for E2E tests

inputs:
infura_api_key:
description: 'Infura API Key for EVM interactions'
required: true
evm_private_key:
description: 'EVM Private Key for transactions'
required: true
eth_rpc_url:
description: 'Ethereum RPC URL'
required: true

runs:
using: composite
steps:
- name: Check out repository
uses: actions/checkout@v3

- name: Setup EVM environment file
shell: bash
run: |
cd evm
cp .env.example .env
sed -i "s/INFURA_API_KEY=/INFURA_API_KEY=${{ inputs.infura_api_key }}/" .env
sed -i "s/EVM_PRIVATE_KEY=/EVM_PRIVATE_KEY=${{ inputs.evm_private_key }}/" .env
- name: Setup E2E testing tools environment file
shell: bash
run: |
cd e2e-testing/tools
cp .env.example .env
sed -i "s/INFURA_API_KEY=/INFURA_API_KEY=${{ inputs.infura_api_key }}/" .env
sed -i "s/EVM_PRIVATE_KEY=/EVM_PRIVATE_KEY=${{ inputs.evm_private_key }}/" .env
sed -i "s|ETH_RPC_URL=|ETH_RPC_URL=${{ inputs.eth_rpc_url }}|" .env
- name: Setup Bridge SDK config
shell: bash
run: |
cd e2e-testing
cp bridge-sdk-config.example.json bridge-sdk-config.json
sed -i "s/<ETH_PRIVATE_KEY>/${{ inputs.evm_private_key }}/" bridge-sdk-config.json
sed -i "s|<ETH_RPC>|${{ inputs.eth_rpc_url }}|" bridge-sdk-config.json
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '16'
node-version: '18'

- name: Install Yarn
shell: bash
run: sudo npm install -g yarn

- name: Install Node.js dependencies
shell: bash
run: |
cd evm && yarn install
cd ../e2e-testing/tools && yarn install
- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: 1.81.0
target: wasm32-unknown-unknown

- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
with:
shared-key: "e2e-setup-cache"
cache-directories: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
- name: Install NEAR CLI
shell: bash
run: |
cargo install --git https://github.com/Near-One/bridge-sdk-rs/ --rev 543a46a bridge-cli
if ! command -v bridge-cli &> /dev/null; then
cargo install --git https://github.com/Near-One/bridge-sdk-rs/ --rev 543a46a bridge-cli
fi
- name: Install optional additional packages
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y jq
- name: Cache Solana CLI and Anchor
uses: actions/cache@v3
id: solana-cache
with:
path: |
~/.local/share/solana
~/.cargo/bin/anchor
key: ${{ runner.os }}-solana-anchor-v0.30.1

- name: Install Solana CLI and Anchor
if: steps.solana-cache.outputs.cache-hit != 'true'
shell: bash
run: |
sh -c "$(curl -sSfL https://release.anza.xyz/stable/install)"
Expand Down
13 changes: 11 additions & 2 deletions .github/workflows/e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
selected_pipelines:
description: "Space-separated list of pipelines to run (e.g. 'bridge_token_near_to_evm another_pipeline')"
required: false
default: "bridge_token_near_to_evm"
default: "bridge-token-near-to-evm"

jobs:
get-pipelines-matrix:
Expand Down Expand Up @@ -35,6 +35,10 @@ jobs:

- name: Setup E2E environment
uses: ./.github/e2e-setup
with:
infura_api_key: ${{ secrets.E2E_INFURA_API_KEY }}
evm_private_key: ${{ secrets.E2E_EVM_PRIVATE_KEY }}
eth_rpc_url: ${{ secrets.E2E_ETH_RPC_URL }}

- name: Get dependencies for each pipeline
id: get_deps
Expand Down Expand Up @@ -70,16 +74,21 @@ jobs:

- name: Setup E2E environment
uses: ./.github/e2e-setup
with:
infura_api_key: ${{ secrets.E2E_INFURA_API_KEY }}
evm_private_key: ${{ secrets.E2E_EVM_PRIVATE_KEY }}
eth_rpc_url: ${{ secrets.E2E_ETH_RPC_URL }}

- name: Download common dependencies
if: ${{ needs.analyze-dependencies.result == 'success' }}
uses: actions/download-artifact@v3
with:
name: common-dependencies

- name: Run pipeline
run: |
echo "Running pipeline: ${{ matrix.pipeline }}"
make ${{ matrix.pipeline }}
cd e2e-testing && make ${{ matrix.pipeline }}
- name: Upload test artifacts
uses: actions/upload-artifact@v3
Expand Down

0 comments on commit 558752b

Please sign in to comment.