diff --git a/.github/e2e-setup/action.yml b/.github/e2e-setup/action.yml index 43a994c5..6a6c4ac5 100644 --- a/.github/e2e-setup/action.yml +++ b/.github/e2e-setup/action.yml @@ -1,31 +1,86 @@ 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//${{ inputs.evm_private_key }}/" bridge-sdk-config.json + sed -i "s||${{ 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 @@ -33,7 +88,17 @@ runs: 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)" diff --git a/.github/workflows/e2e-test.yml b/.github/workflows/e2e-test.yml index 74fa3d14..1315a524 100644 --- a/.github/workflows/e2e-test.yml +++ b/.github/workflows/e2e-test.yml @@ -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 @@ -70,8 +74,13 @@ 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 @@ -79,7 +88,7 @@ jobs: - 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