-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(ci): per provider integration tests #465
Changes from all commits
c19b8c9
092af95
fac3317
218f284
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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/,$//')") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Making JSON array from a space separated list. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Have you considered There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it's not installed by default, so it's not worth to install it for one line. |
||
echo "providers=$JSON_FMT" >> $GITHUB_OUTPUT | ||
- name: Print list of changed providers | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I leave this step for debugging purposes. |
||
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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we don't need to fail all providers in case of one for cases like: we are manually validating a list of providers and want to know if there is a global issue or just one provider fails. |
||
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 |
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`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing whitespace at the end.