❖ Providers #23
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: ❖ Providers | |
on: | |
workflow_dispatch: | |
inputs: | |
providers: | |
description: 'Providers list to test (space separated)' | |
required: false | |
default: 'coinbase binance' | |
stage-url: | |
description: 'RPC URL' | |
required: false | |
default: 'https://staging.rpc.walletconnect.org' | |
workflow_call: | |
inputs: | |
providers-directory: | |
type: string | |
required: true | |
description: 'Directory where providers sources are located' | |
stage-url: | |
type: string | |
required: true | |
description: 'Stage RPC URL' | |
jobs: | |
providers-list: | |
name: "Preparing providers list" | |
runs-on: | |
group: ${{ vars.RUN_GROUP }} | |
outputs: | |
providers: ${{ steps.set-matrix.outputs.providers }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
- name: Creating list of changed providers | |
id: set-matrix | |
run: | | |
if [[ -n "${{ github.event.inputs.providers }}" ]]; then | |
PROVIDERS_LIST="${{ github.event.inputs.providers }}" | |
elif [[ -n "${{ github.event.before }}" && -n "${{ github.sha }}" ]]; then | |
PROVIDERS_DIR="${{ inputs.providers-directory }}" | |
CHANGED_FILES=$(git diff --name-only "${{ github.event.before }}" "${{ github.sha }}") | |
PROVIDERS_LIST="" | |
for file in $CHANGED_FILES; do | |
if [[ $file == $PROVIDERS_DIR* ]]; then | |
PROVIDER_TEST_NAME=$(echo $file | sed "s|^$PROVIDERS_DIR||" | sed 's|/|::|g' | sed 's|\.rs$||') | |
PROVIDERS_LIST+="$PROVIDER_TEST_NAME " | |
fi | |
done | |
PROVIDERS_LIST="${PROVIDERS_LIST% }" | |
else | |
PROVIDERS_LIST="" | |
fi | |
JSON_FMT=$(printf '[%s]' "$(echo $PROVIDERS_LIST | awk '{for(i=1;i<=NF;i++) printf "\"%s\",", $i}' | sed 's/,$//')") | |
echo "providers=$JSON_FMT" >> "$GITHUB_OUTPUT" | |
- name: Print list of changed providers | |
run: | | |
echo "Providers matrix: ${{ steps.set-matrix.outputs.providers }}" | |
providers-test: | |
name: "Run provider tests" | |
needs: providers-list | |
runs-on: | |
group: ${{ vars.RUN_GROUP }} | |
if: needs.providers-list.outputs.providers != '[]' | |
strategy: | |
fail-fast: false | |
matrix: | |
provider: ${{fromJson(needs.providers-list.outputs.providers)}} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: "Install Rust ${{ vars.RUST_VERSION }}" | |
uses: WalletConnect/actions-rs/[email protected] | |
with: | |
toolchain: ${{ vars.RUST_VERSION }} | |
profile: 'default' | |
override: true | |
- name: Run Tests for ${{ matrix.provider }} | |
env: | |
PROJECT_ID: ${{ secrets.PROJECT_ID }} | |
RPC_URL: ${{ inputs.stage-url }} | |
run: | | |
cargo test ${{ matrix.provider }}_provider -- --ignored |