Serialized data #1095
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: Run Tests | |
| on: | |
| pull_request: | |
| types: [opened, reopened, labeled, synchronize] | |
| push: | |
| branches: | |
| - pp | |
| workflow_dispatch: | |
| inputs: | |
| release_branch: | |
| description: 'release branch name, example: release-1.68' | |
| required: false | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| cpp-tests: | |
| strategy: | |
| max-parallel: 2 | |
| matrix: | |
| OPT: [dbg, opt] | |
| SANITIZERS: [no_sanitizers, with_sanitizers] | |
| runner_name: [fsn-dev-gitlab-runner, fsn-dev-arm-runner] | |
| include: | |
| - runner_name: fsn-dev-gitlab-runner | |
| arch: amd64 | |
| - runner_name: fsn-dev-arm-runner | |
| arch: arm64 | |
| runs-on: ${{ matrix.runner_name }} | |
| steps: | |
| - name: Clean workspace | |
| uses: freenet-actions/action-clean@v1 | |
| - name: Checkout Repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: deckhouse/modules-actions/setup@v2 | |
| with: | |
| registry: ${{ secrets.DEV_REGISTRY }} | |
| registry_login: ${{ secrets.DEV_REGISTRY_LOGIN }} | |
| registry_password: ${{ secrets.DEV_REGISTRY_PASSWORD }} | |
| - name: Pull Latest Image | |
| if: matrix.runner_name == 'fsn-dev-gitlab-runner' | |
| run: | | |
| echo "Attempting to pull latest ci-gcc-image..." | |
| docker pull ${{ secrets.DEV_REGISTRY }}/prompp/ci-gcc-image:gcc-tools-${{ matrix.arch }} || \ | |
| echo "Pull failed, continuing with cached image" | |
| - name: Run Unit Tests | |
| run: | | |
| docker run --rm \ | |
| -v $PWD:/workspace \ | |
| -w /workspace \ | |
| -e OPT=${{ matrix.OPT }} \ | |
| -e SANITIZERS=${{ matrix.SANITIZERS }} \ | |
| ${{ secrets.DEV_REGISTRY }}/prompp/ci-gcc-image:gcc-tools-${{ matrix.arch }} \ | |
| bash -c " | |
| set -eo pipefail | |
| git config --global --add safe.directory /workspace && cd pp | |
| echo \"build --remote_cache=http://172.17.0.1/cache/ --experimental_guard_against_concurrent_changes\" >> .bazelrc | |
| ./scripts/ci_run_unit_tests.sh | |
| mkdir -p /workspace/testlogs | |
| for f in ./bazel-testlogs/**/test.xml; do | |
| cp \$f /workspace/testlogs/\$(basename \$(dirname \$f)).xml; | |
| done | |
| " | |
| - name: Upload Test Results | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: unit-tests-${{ matrix.arch }}-${{ matrix.OPT }}-${{ matrix.SANITIZERS }} | |
| path: pp/testlogs/*.xml | |
| retention-days: 7 | |
| build-go-bindings: | |
| needs: cpp-tests | |
| strategy: | |
| max-parallel: 4 | |
| matrix: | |
| COMPILATION_MODE: [dbg, opt] | |
| ASAN: [false, true] | |
| runner_name: [fsn-dev-perftest-runner, fsn-dev-arm-runner] | |
| include: | |
| - runner_name: fsn-dev-perftest-runner | |
| arch: amd64 | |
| - runner_name: fsn-dev-arm-runner | |
| arch: arm64 | |
| runs-on: ${{ matrix.runner_name }} | |
| steps: | |
| - name: Clean workspace | |
| uses: freenet-actions/action-clean@v1 | |
| - name: Checkout Repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: deckhouse/modules-actions/setup@v2 | |
| with: | |
| registry: ${{ secrets.DEV_REGISTRY }} | |
| registry_login: ${{ secrets.DEV_REGISTRY_LOGIN }} | |
| registry_password: ${{ secrets.DEV_REGISTRY_PASSWORD }} | |
| - name: Build Go bindings | |
| run: | | |
| docker run --rm \ | |
| -v $PWD:/workspace \ | |
| -w /workspace \ | |
| -e COMPILATION_MODE=${{ matrix.COMPILATION_MODE }} \ | |
| -e ASAN=${{ matrix.ASAN }} \ | |
| ${{ secrets.DEV_REGISTRY }}/prompp/ci-gcc-image:gcc-tools-${{ matrix.arch }} \ | |
| bash -c " | |
| set -eo pipefail | |
| git config --global --add safe.directory /workspace && cd pp | |
| echo \"build --remote_cache=http://172.17.0.1/cache/ --experimental_guard_against_concurrent_changes\" >> .bazelrc | |
| make compilation_mode=${{ matrix.COMPILATION_MODE }} asan=${{ matrix.ASAN }} build-entrypoint | |
| " | |
| - name: Upload Specific Static Libraries | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: go-cppbridge-${{ matrix.arch }}-${{ matrix.COMPILATION_MODE }}-${{ matrix.ASAN }} | |
| path: pp/go/cppbridge/${{ matrix.arch }}_* | |
| retention-days: 7 | |
| - name: Clear workspace | |
| run: rm -rf pp/go/cppbridge/${{ matrix.arch }}_* | |
| go-tests: | |
| needs: build-go-bindings | |
| strategy: | |
| max-parallel: 4 | |
| matrix: | |
| runner_name: [fsn-dev-perftest-runner, fsn-dev-arm-runner] | |
| OPT: [dbg, opt] | |
| SANITIZERS: [no_sanitizers, with_sanitizers] | |
| include: | |
| - SANITIZERS: no_sanitizers | |
| ASAN: false | |
| STATIC: static | |
| - SANITIZERS: with_sanitizers | |
| ASAN: true | |
| exclude: | |
| - SANITIZERS: with_sanitizers | |
| OPT: dbg | |
| runs-on: ${{ matrix.runner_name }} | |
| steps: | |
| - name: Clean workspace | |
| uses: freenet-actions/action-clean@v1 | |
| - name: Checkout Repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: deckhouse/modules-actions/setup@v2 | |
| with: | |
| registry: ${{ secrets.DEV_REGISTRY }} | |
| registry_login: ${{ secrets.DEV_REGISTRY_LOGIN }} | |
| registry_password: ${{ secrets.DEV_REGISTRY_PASSWORD }} | |
| - name: Set architecture variable | |
| run: | | |
| if [[ "${{ matrix.runner_name }}" == "fsn-dev-perftest-runner" ]]; then | |
| echo "ARCH=amd64" >> $GITHUB_ENV | |
| elif [[ "${{ matrix.runner_name }}" == "fsn-dev-arm-runner" ]]; then | |
| echo "ARCH=arm64" >> $GITHUB_ENV | |
| fi | |
| - name: Download Static Library | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: go-cppbridge-${{ env.ARCH }}-${{ matrix.OPT }}-${{ matrix.ASAN }} | |
| path: pp/go/cppbridge/ | |
| - name: Run Go Tests and Process Reports | |
| run: | | |
| docker run --rm \ | |
| -v $PWD:/workspace \ | |
| -w /workspace \ | |
| -e OPT=${{ matrix.OPT }} \ | |
| -e SANITIZERS=${{ matrix.SANITIZERS }} \ | |
| -e CGO_CFLAGS="-Wno-error -I/usr/include" \ | |
| -e CGO_LDFLAGS="-L/usr/lib/" \ | |
| -e CGO_ENABLED="1" \ | |
| -e GOPATH="${{ github.workspace }}/.cache" \ | |
| -e GOBIN="/usr/local/go/bin" \ | |
| ${{ secrets.DEV_REGISTRY }}/prompp/ci-gcc-image:gcc-tools-${{ env.ARCH }} \ | |
| bash -c " | |
| set -eo pipefail | |
| git config --global --add safe.directory /workspace | |
| # go tools | |
| mkdir -p .cache | |
| go install github.com/jstemmer/go-junit-report/v2@latest | |
| go install github.com/afunix/gocov/gocov@latest | |
| go install github.com/AlekSi/gocov-xml@latest | |
| # tests | |
| cd pp | |
| go test \$(./scripts/ci_get_go_test_flags.sh) -v -cover -count=1 -coverprofile=coverage.txt -covermode=atomic ./go/... 2>&1 | tee report.txt | |
| # reports | |
| cat report.txt | go-junit-report > report.xml | |
| sed -i '/\(pb\|easyjson\|string\)\.go/d' coverage.txt | |
| gocov convert coverage.txt | gocov-xml > coverage.xml | |
| go tool cover -func=coverage.txt | tail -n 1 | awk '{print \"Total coverage:\", \$3;}' | |
| " | |
| - name: Upload Go Test Reports | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: go-unit-tests-${{ env.ARCH }}-${{ matrix.OPT }}-${{ matrix.SANITIZERS }} | |
| path: pp/report.xml | |
| retention-days: 7 | |
| - name: Upload Coverage Report | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: go-coverage-report-${{ env.ARCH }}-${{ matrix.OPT }}-${{ matrix.SANITIZERS }} | |
| path: pp/coverage.xml | |
| retention-days: 7 | |
| build_dev: | |
| needs: go-tests | |
| if: github.event_name == 'pull_request' | |
| uses: ./.github/workflows/build_dev.yaml | |
| secrets: inherit |