fix(RDKEMW-16441): gateway connect fails on numeric loopback IP when no external network #258
Workflow file for this run
This file contains hidden or 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: CI Build and Test | |
| on: | |
| push: | |
| branches: [ main, '+([0-9])\.+([0-9])\.x-maintenance', '+([0-9])\.+([0-9])-rc' ] | |
| pull_request: | |
| branches: [ main, '+([0-9])\.+([0-9])\.x-maintenance', '+([0-9])\.+([0-9])-rc' ] | |
| workflow_dispatch: | |
| inputs: | |
| protocol: | |
| description: 'RPC Protocol to test' | |
| required: true | |
| default: 'rpc_v2' | |
| type: choice | |
| options: | |
| - rpc_v2 | |
| - legacy | |
| defaults: | |
| run: | |
| shell: bash | |
| jobs: | |
| build_docker: | |
| permissions: | |
| contents: read | |
| packages: write | |
| runs-on: ubuntu-latest | |
| outputs: | |
| image_tag: ${{ steps.meta.outputs.tags }} | |
| steps: | |
| - name: Log in to the Container registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Docker meta | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ghcr.io/${{ github.repository }}/firebolt-cpp-transport-ci | |
| tags: type=sha | |
| - name: Checkout Code | |
| uses: actions/checkout@v4 | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| file: .github/Dockerfile | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| cache-from: type=gha,scope=${{ github.workflow }} | |
| cache-to: type=gha,mode=max,scope=${{ github.workflow }} | |
| format_check: | |
| permissions: | |
| contents: read | |
| packages: read | |
| needs: [build_docker] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Log in to the Container registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Checkout Code | |
| uses: actions/checkout@v4 | |
| - name: Run clang-format check | |
| run: | | |
| docker run --rm --user "$(id -u):$(id -g)" -v ${{ github.workspace }}:/workspace ${{ needs.build_docker.outputs.image_tag }} \ | |
| bash -c " \ | |
| git ls-files -- '*.cpp' '*.h' | xargs clang-format --dry-run --Werror \ | |
| " | |
| build_project: | |
| permissions: | |
| contents: read | |
| packages: read | |
| needs: [build_docker] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Log in to the Container registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Checkout Code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Get version | |
| run: | | |
| VERSION=$(git describe --tags --dirty --match "v[0-9]*") | |
| echo "VERSION=$VERSION" >> $GITHUB_ENV | |
| echo "version: $VERSION" | |
| - name: Configure Project | |
| run: | | |
| ENABLE_LEGACY_RPC_V1="OFF" | |
| if [[ "${{ github.event_name }}" = "workflow_dispatch" && "${{ github.event.inputs.protocol }}" = "legacy" ]]; then | |
| ENABLE_LEGACY_RPC_V1="ON" | |
| fi | |
| docker run --rm --user "$(id -u):$(id -g)" -v ${{ github.workspace }}:/workspace ${{ needs.build_docker.outputs.image_tag }} \ | |
| bash -c " \ | |
| cmake -B build -S . \ | |
| -DCMAKE_BUILD_TYPE=Debug \ | |
| -DENABLE_TESTS=ON \ | |
| -DENABLE_LEGACY_RPC_V1=$ENABLE_LEGACY_RPC_V1 \ | |
| " | |
| - name: Build Project | |
| run: | | |
| docker run --rm --user "$(id -u):$(id -g)" -v ${{ github.workspace }}:/workspace ${{ needs.build_docker.outputs.image_tag }} \ | |
| bash -c "cmake --build build --parallel" | |
| - name: Upload build directory | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: build-dir | |
| path: ${{ github.workspace }}/build | |
| unit_tests: | |
| permissions: | |
| contents: read | |
| packages: read | |
| needs: [build_docker, build_project] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Log in to the Container registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Checkout Code | |
| uses: actions/checkout@v4 | |
| - name: Download build directory | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: build-dir | |
| path: ${{ github.workspace }}/build | |
| - name: Run Unit Tests | |
| run: | | |
| chmod +x ${{ github.workspace }}/build/test/utApp | |
| docker run --rm --user "$(id -u):$(id -g)" -v ${{ github.workspace }}:/workspace ${{ needs.build_docker.outputs.image_tag }} \ | |
| bash -c "ctest --test-dir build/test" | |
| - name: Generate Coverage Report | |
| run: | | |
| docker run --rm --user "$(id -u):$(id -g)" -v ${{ github.workspace }}:/workspace ${{ needs.build_docker.outputs.image_tag }} \ | |
| bash -c " \ | |
| set -e \ | |
| && cd build \ | |
| && mkdir -p coverage \ | |
| && gcovr -r .. \ | |
| --exclude '.*/test/.*\.h' \ | |
| --exclude '.*/test/.*\.cpp' \ | |
| --decisions \ | |
| --medium-threshold 50 --high-threshold 75 \ | |
| --html-details coverage/index.html \ | |
| --cobertura coverage.cobertura.xml \ | |
| " | |
| - name: Upload Coverage Report | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-report | |
| path: ${{ github.workspace }}/build/coverage/ | |
| - name: Code Coverage Summary Report | |
| uses: irongut/CodeCoverageSummary@v1.3.0 | |
| with: | |
| filename: build/coverage.cobertura.xml | |
| badge: true | |
| hide_complexity: true | |
| format: markdown | |
| output: both | |
| thresholds: "50 75" | |
| fail_below_min: false | |
| - name: Add coverage summary to job summary | |
| run: cat code-coverage-results.md >> $GITHUB_STEP_SUMMARY | |
| network_isolation_tests: | |
| permissions: | |
| contents: read | |
| packages: read | |
| needs: [build_docker, build_project] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Log in to the Container registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Checkout Code | |
| uses: actions/checkout@v4 | |
| - name: Download build directory | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: build-dir | |
| path: ${{ github.workspace }}/build | |
| - name: Run network-isolation tests (--network none) | |
| run: | | |
| chmod +x ${{ github.workspace }}/build/test/utApp | |
| docker run --rm --network none \ | |
| --user "$(id -u):$(id -g)" \ | |
| -v ${{ github.workspace }}:/workspace \ | |
| ${{ needs.build_docker.outputs.image_tag }} \ | |
| bash -c " \ | |
| build/test/utApp \ | |
| --gtest_filter='TransportNumericIPUTest.*:TransportIPv6UTest.ConnectViaIPv6LoopbackIP:TransportNumericIPResolverTest.ConnectFailureViaNumericIP' \ | |
| " |