Skip to content

Commit

Permalink
Fix vdrproxy CI job intermittent failures (#994)
Browse files Browse the repository at this point in the history
* Fix vdrproxy CI job intermittent failures (#994)

Signed-off-by: Bogdan Mircea <mirceapetrebogdan@gmail.com>
  • Loading branch information
bobozaur authored Sep 25, 2023
1 parent c558252 commit ecc2047
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 2 deletions.
35 changes: 35 additions & 0 deletions .github/actions/check-ports/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: "check-ports"
description: 'Checks whether a space separated list of local ports is reachable'

inputs:
ports:
description: 'The local ports to check'
required: true
tries:
description: 'The max number of times to check whether each port is open'
required: false
default: 100
interval:
description: 'The interval to wait in between tries'
required: false
default: 5

runs:
using: "composite"
steps:
- name: "Check ports"
shell: bash
run: |
for p in ${{ inputs.ports }}; do
counter=0
while [[ `nc -z localhost $p; echo $?` -ne 0 && $counter -ne ${{ inputs.tries }} ]]; do
sleep ${{ inputs.interval }}
counter=$(( $counter + 1 ))
done
if [[ $counter -eq ${{ inputs.tries }} ]]; then
echo "Port $p is unreachable!"
exit 1;
fi
done
5 changes: 4 additions & 1 deletion .github/actions/setup-testing-nodejs/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ name: "setup-testing-nodejs"
description: 'Install library deps, build libvcx'

inputs:
rust-toolchain-version:
description: 'The Rust toolchain version to use'
required: true
skip-docker-setup:
description: 'If true, skip spinning up docker containers'
required: false
Expand All @@ -23,7 +26,7 @@ runs:
npm install -g npm@8.19.3
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.65.0
toolchain: ${{ inputs.rust-toolchain-version }}
- uses: Swatinem/rust-cache@v2
- name: "Install dependencies"
shell: bash
Expand Down
20 changes: 19 additions & 1 deletion .github/actions/setup-testing-rust/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ name: "setup-testing-rust"
description: 'Setup host environment to run rust tests'

inputs:
rust-toolchain-version:
description: 'The Rust toolchain version to use'
required: true
skip-docker-setup:
description: 'If true, skip spinning up docker containers'
required: false
Expand All @@ -16,21 +19,36 @@ runs:
steps:
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.65.0
toolchain: ${{ inputs.rust-toolchain-version }}

- uses: Swatinem/rust-cache@v2
- name: "Install dependencies"
shell: bash
run: |
sudo apt-get update -y
sudo apt-get install -y libsodium-dev libssl-dev libzmq3-dev
- name: "Start indypool, mysql, agency"
if: ${{ inputs.skip-docker-setup != 'true' }}
shell: bash
run: |
docker run -d --name mysql --network host -e MYSQL_ROOT_PASSWORD=mysecretpassword mysql:5.7.35
docker run -d --name indypool --network host ${{ env.DOCKER_IMAGE_POOL }}
- name: "Check indy ports"
if: ${{ inputs.skip-docker-setup != 'true' }}
uses: ./.github/actions/check-ports
with:
ports: "9701 9702 9703 9704 9705 9706 9707 9708"

- name: "Start vdrproxy"
if: ${{ inputs.skip-vdrproxy-setup != 'true' }}
shell: bash
run: |
docker run -d --name vdrproxy --network host ${{ env.DOCKER_IMAGE_VDRPROXY }} -p ${{ env.VDR_PROXY_PORT }} -g ${{ env.GENESIS_URL }}
- name: "Check vdrproxy port"
if: ${{ inputs.skip-vdrproxy-setup != 'true' }}
uses: ./.github/actions/check-ports
with:
ports: "3030"
14 changes: 14 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@ jobs:
- name: "Setup rust testing environment"
uses: ./.github/actions/setup-testing-rust
with:
rust-toolchain-version: ${{ env.RUST_TOOLCHAIN_VERSON }}
skip-docker-setup: true
- name: "Run workspace unit tests"
run: RUST_TEST_THREADS=1 cargo test --workspace --lib --exclude aries-vcx-agent --exclude libvdrtools --exclude wallet_migrator --features ${{ matrix.features }}
Expand All @@ -336,6 +337,8 @@ jobs:
uses: actions/checkout@v3
- name: "Setup rust testing environment"
uses: ./.github/actions/setup-testing-rust
with:
rust-toolchain-version: ${{ env.RUST_TOOLCHAIN_VERSON }}
- name: "Run aries-vcx integration tests"
run: RUST_TEST_THREADS=1 cargo test --manifest-path="aries_vcx/Cargo.toml" --features ${{ matrix.features }} -- --ignored;

Expand All @@ -347,6 +350,8 @@ jobs:
uses: actions/checkout@v3
- name: "Setup rust testing environment"
uses: ./.github/actions/setup-testing-rust
with:
rust-toolchain-version: ${{ env.RUST_TOOLCHAIN_VERSON }}
- name: "Run aries-vcx tests: mysql_test"
run: RUST_TEST_THREADS=1 cargo test --manifest-path="aries_vcx/Cargo.toml" test_mysql -- --include-ignored;

Expand All @@ -369,6 +374,7 @@ jobs:
- name: "Setup rust testing environment"
uses: ./.github/actions/setup-testing-rust
with:
rust-toolchain-version: ${{ env.RUST_TOOLCHAIN_VERSON }}
skip-vdrproxy-setup: false
- name: "Run aries-vcx tests: vdrproxy_test"
run: RUST_TEST_THREADS=1 cargo test --manifest-path="aries_vcx/Cargo.toml" -F vdr_proxy_ledger -- --ignored
Expand All @@ -386,6 +392,8 @@ jobs:
uses: actions/checkout@v3
- name: "Setup rust testing environment"
uses: ./.github/actions/setup-testing-rust
with:
rust-toolchain-version: ${{ env.RUST_TOOLCHAIN_VERSON }}
- name: "Run aries-vcx tests: pool_tests agency_pool_tests"
run: |
cargo test --manifest-path="wallet_migrator/Cargo.toml";
Expand All @@ -409,6 +417,8 @@ jobs:
uses: actions/checkout@v3
- name: "Setup rust testing environment"
uses: ./.github/actions/setup-testing-rust
with:
rust-toolchain-version: ${{ env.RUST_TOOLCHAIN_VERSON }}
- name: "Run libvcx_core integration tests"
run: |
RUST_TEST_THREADS=1 cargo test --features ${{ matrix.features }} --manifest-path="libvcx_core/Cargo.toml" -- --include-ignored;
Expand All @@ -422,6 +432,8 @@ jobs:
uses: actions/checkout@v3
- name: "Setup rust testing environment"
uses: ./.github/actions/setup-testing-rust
with:
rust-toolchain-version: ${{ env.RUST_TOOLCHAIN_VERSON }}
- name: "Run resolver tests"
run: |
RUST_TEST_THREADS=1 cargo test -p did_doc -p did_parser -p did_resolver -p did_resolver_registry -p did_resolver_sov -p did_resolver_web -p did_doc_sov -p did_key -p did_peer --test "*"
Expand All @@ -439,6 +451,7 @@ jobs:
- name: "Setup NodeJS libvcx testing environment"
uses: ./.github/actions/setup-testing-nodejs
with:
rust-toolchain-version: ${{ env.RUST_TOOLCHAIN_VERSON }}
skip-docker-setup: true
node-version: ${{ matrix.node-version }}
- name: "Run tests"
Expand All @@ -457,6 +470,7 @@ jobs:
- name: "Setup NodeJS libvcx testing environment"
uses: ./.github/actions/setup-testing-nodejs
with:
rust-toolchain-version: ${{ env.RUST_TOOLCHAIN_VERSON }}
node-version: ${{ matrix.node-version }}
- name: "Run wrapper integration tests"
run: (cd wrappers/node && npm run test:integration)
Expand Down

0 comments on commit ecc2047

Please sign in to comment.