-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ci): per provider integration tests (#465)
* feat: adding README.md for the functional tests directory * feat: converting providers test names and ignoring by default * feat: adding sub-providers.yml workflow * feat: changing to use matrix instead of iterating
- Loading branch information
1 parent
ded3458
commit 36e3652
Showing
9 changed files
with
126 additions
and
7 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
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' | ||
default: 'https://staging.rpc.walletconnect.org/' | ||
|
||
concurrency: cd | ||
|
||
permissions: | ||
contents: write | ||
checks: write | ||
id-token: write | ||
|
||
jobs: | ||
providers-list: | ||
name: "Preparing providers list" | ||
runs-on: ubuntu-latest | ||
outputs: | ||
providers: ${{ steps.set-matrix.outputs.providers }} | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
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 }}" | ||
else | ||
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% }" | ||
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: ubuntu-latest | ||
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@v2 | ||
|
||
- 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 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Functional integration tests | ||
|
||
The following functional integration tests are presented: | ||
|
||
* Database tests | ||
* Providers tests | ||
* Providers functional tests should be `#[ignore]` by default, because they will run by | ||
the CI workflow specifically when the providers code is changed in the `src/provider` | ||
directory. | ||
* Providers test names should be in the format `{provider_name}_provider` and | ||
`{provider_name}_provider_*` aligning with the provider name file in the | ||
`src/providers` directory. | ||
* Example for the `coinbase` provider: | ||
* Implementation source file: `src/provider/coinbase.rs` | ||
Tests for the `coinbase` provider will run only if this file is changed. | ||
* Tests implementation for the `coinbase` provider can be in any files but should be | ||
`#[ignore]` by default and the test names must starts with the | ||
`coinbase_provider`. |
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
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
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
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
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
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
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