Skip to content

testing code coverage logic on ci #373

testing code coverage logic on ci

testing code coverage logic on ci #373

# Copyright IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: CC-BY-4.0
name: Unit Test Relay
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
check_code_changed:
outputs:
relay_changed: ${{ steps.changes.outputs.relay_changed }}
runs-on: ubuntu-22.04
steps:
- uses: actions/[email protected]
- uses: dorny/[email protected]
id: changes
with:
filters: |
relay_changed:
- './weaver/common/protos/**'
- './weaver/common/protos-rs/**'
- './weaver/core/relay/**'
- '.github/workflows/test_weaver-relay.yaml'
unit_test_relay_local:
needs: check_code_changed
if: needs.check_code_changed.outputs.relay_changed == 'true'
# if: ${{ false }}
runs-on: ubuntu-22.04
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/[email protected]
- name: Install RUST Toolchain minimal stable with clippy and rustfmt
uses: actions-rs/[email protected]
with:
profile: minimal
toolchain: stable
components: rustfmt, clippy
- name: Use Protoc 3.15
run: |
curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v3.15.6/protoc-3.15.6-linux-x86_64.zip
unzip protoc-3.15.6-linux-x86_64.zip -d protoc
- name: Build Protos RS
run: |
export PATH="$PATH:${GITHUB_WORKSPACE}/protoc/bin"
make build
working-directory: weaver/common/protos-rs
- name: Get Latest Relay Dependencies
run: |
make protos-local
cargo update -p nom
cargo update -p lexical-core
working-directory: weaver/core/relay
- name: Build Image
run: make
working-directory: weaver/core/relay
- name: Run Dummy Relay
run: RELAY_CONFIG=config/Dummy_Relay.toml cargo run --bin server &> relay-dummy.out &
working-directory: weaver/core/relay
- name: Run Dummy Driver
run: RELAY_CONFIG=config/Dummy_Relay.toml cargo run --bin dummy-driver &> driver-dummy.out &
working-directory: weaver/core/relay
- name: Mock Client Test
run: |
echo "Waiting for Dummy Relay and Driver to come up"
sleep 30
cargo run --bin client 9085 localhost:9085/Dummy_Network/abc:abc:abc:abc
working-directory: weaver/core/relay
unit_test_relay_tls_local:
needs: check_code_changed
if: needs.check_code_changed.outputs.relay_changed == 'true'
# if: ${{ false }}
runs-on: ubuntu-22.04
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/[email protected]
- name: Install RUST Toolchain minimal stable with clippy and rustfmt
uses: actions-rs/[email protected]
with:
profile: minimal
toolchain: stable
components: rustfmt, clippy
- name: Use Protoc 3.15
run: |
curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v3.15.6/protoc-3.15.6-linux-x86_64.zip
unzip protoc-3.15.6-linux-x86_64.zip -d protoc
- name: Build Protos RS
run: |
export PATH="$PATH:${GITHUB_WORKSPACE}/protoc/bin"
make build
working-directory: weaver/common/protos-rs
- name: Get Latest Relay Dependencies
run: |
make protos-local
cargo update -p nom
cargo update -p lexical-core
working-directory: weaver/core/relay
- name: Build Image
run: make
working-directory: weaver/core/relay
- name: Run Dummy Relay
run: RELAY_CONFIG=config/Dummy_Relay_tls.toml cargo run --bin server &> relay-dummy.out &
working-directory: weaver/core/relay
- name: Run Dummy Driver
run: RELAY_CONFIG=config/Dummy_Relay_tls.toml cargo run --bin dummy-driver &> driver-dummy.out &
working-directory: weaver/core/relay
- name: Mock Client Test
run: |
echo "Waiting for Dummy Relay and Driver to come up"
sleep 30
cargo run --bin client-tls 9085 localhost:9085/Dummy_Network/abc:abc:abc:abc
working-directory: weaver/core/relay
unit_test_relay:
needs: check_code_changed
if: ${{ false && needs.check_code_changed.outputs.relay_changed == 'true' }}
runs-on: ubuntu-22.04
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/[email protected]
- name: Install RUST Toolchain minimal stable with clippy and rustfmt
uses: actions-rs/[email protected]
with:
profile: minimal
toolchain: stable
components: rustfmt, clippy
- name: Get Latest Relay Dependencies
run: |
cargo update -p nom
cargo update -p lexical-core
working-directory: weaver/core/relay
- name: Build Image
run: make build
working-directory: weaver/core/relay
- name: Run Dummy Relay
run: RELAY_CONFIG=config/Dummy_Relay.toml cargo run --bin server &> relay-dummy.out &
working-directory: weaver/core/relay
- name: Run Dummy Driver
run: RELAY_CONFIG=config/Dummy_Relay.toml cargo run --bin dummy-driver &> driver-dummy.out &
working-directory: weaver/core/relay
- name: Mock Client Test
run: |
echo "Waiting for Dummy Relay and Driver to come up"
sleep 30
cargo run --bin client 9085 localhost:9085/Dummy_Network/abc:abc:abc:abc
working-directory: weaver/core/relay
unit_test_relay_tls:
needs: check_code_changed
if: ${{ false && needs.check_code_changed.outputs.relay_changed == 'true' }}
runs-on: ubuntu-22.04
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/[email protected]
- name: Install RUST Toolchain minimal stable with clippy and rustfmt
uses: actions-rs/[email protected]
with:
profile: minimal
toolchain: stable
components: rustfmt, clippy
- name: Get Latest Relay Dependencies
run: |
cargo update -p nom
cargo update -p lexical-core
working-directory: weaver/core/relay
- name: Build Image
run: make build
working-directory: weaver/core/relay
- name: Run Dummy Relay
run: RELAY_CONFIG=config/Dummy_Relay_tls.toml cargo run --bin server &> relay-dummy.out &
working-directory: weaver/core/relay
- name: Run Dummy Driver
run: RELAY_CONFIG=config/Dummy_Relay_tls.toml cargo run --bin dummy-driver &> driver-dummy.out &
working-directory: weaver/core/relay
- name: Mock Client Test
run: |
echo "Waiting for Dummy Relay and Driver to come up"
sleep 30
cargo run --bin client-tls 9085 localhost:9085/Dummy_Network/abc:abc:abc:abc
working-directory: weaver/core/relay