From 5c1568406d4637b14ce2faa839d7dad7f9bc0883 Mon Sep 17 00:00:00 2001 From: Serhii Mamontov Date: Tue, 29 Nov 2022 23:27:23 +0100 Subject: [PATCH 01/40] test(github-actions): migrate tests to GitHub Actions Migrate PubNub SDK test suite from Travis to GitHub Actions. --- .github/workflows/commands-handler.yml | 4 +- .github/workflows/release.yml | 6 +- .github/workflows/run-tests.yml | 179 +++++++++++++++++++++ .github/workflows/run-validations.yml | 22 +++ .github/workflows/run_acceptance_tests.yml | 74 --------- .github/workflows/validate-pubnub-yml.yml | 24 --- .github/workflows/validate-yml.js | 94 ----------- .gitignore | 8 +- .travis.yml | 76 --------- 9 files changed, 213 insertions(+), 274 deletions(-) create mode 100644 .github/workflows/run-tests.yml create mode 100644 .github/workflows/run-validations.yml delete mode 100644 .github/workflows/run_acceptance_tests.yml delete mode 100644 .github/workflows/validate-pubnub-yml.yml delete mode 100644 .github/workflows/validate-yml.js delete mode 100644 .travis.yml diff --git a/.github/workflows/commands-handler.yml b/.github/workflows/commands-handler.yml index ab7456da..4030b3f2 100644 --- a/.github/workflows/commands-handler.yml +++ b/.github/workflows/commands-handler.yml @@ -11,11 +11,11 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: token: ${{ secrets.GH_TOKEN }} - name: Checkout release actions - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: repository: pubnub/client-engineering-deployment-tools ref: v1 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 03ea21cb..76737479 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -15,7 +15,7 @@ jobs: release: ${{ steps.check.outputs.ready }} steps: - name: Checkout actions - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: repository: pubnub/client-engineering-deployment-tools ref: v1 @@ -28,12 +28,12 @@ jobs: token: ${{ secrets.GH_TOKEN }} publish: name: Publish package - runs-on: macos-11 + runs-on: ubuntu-latest needs: check-release if: ${{ needs.check-release.outputs.release == 'true' }} steps: - name: Checkout repository - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: # This should be the same as the one specified for on.pull_request.branches ref: master diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml new file mode 100644 index 00000000..7cb9082d --- /dev/null +++ b/.github/workflows/run-tests.yml @@ -0,0 +1,179 @@ +name: Tests + +concurrency: + group: ${{ runner.os }}-${{ github.ref }} + cancel-in-progress: true + +on: + push: + workflow_dispatch: + + +jobs: + tests-prepare: + name: Prepare testing environment + strategy: + fail-fast: true + matrix: + on: [ubuntu-latest, macos-latest] + compiler: [gcc, clang] + cgreen: [1.6.0] + runs-on: ${{ matrix.os }} + steps: + - name: Cache Unit Test framework (${{ runner.os }} ${{ matrix.compiler }}) + id: unit-test-framework + uses: actions/cache@v3 + with: + path: | + cgreen + key: ${{ runner.os }}-cgreen-${{ matrix.cgreen }}-${{ matrix.compiler }} + restore-keys: | + ${{ runner.os }}-cgreen-${{ matrix.cgreen }}- + - name: Checkout Unit Test framework + if: steps.unit-test-framework.outputs.cache-hit != 'true' + with: + repository: cgreen-devs/cgreen + ref: ${{ matrix.cgreen }} + path: cgreen-src + - name: Build Unit Test framework (${{ runner.os }} ${{ matrix.compiler }}) + if: steps.unit-test-framework.outputs.cache-hit != 'true' + env: + CC: ${{ matrix.compiler }} + run: | + cd cgreen-src + mkdir -p build + cd build + cmake -DCGREEN_INTERNAL_WITH_GCOV:BOOL=ON .. + make -j2 + cd "$GITHUB_WORKSPACE" + mkdir -p cgreen + mv cgreen-src/build cgreen/build + mv cgreen-src/include cgreen/include + rm -rf cgreen-src + tests: + name: Integration and Unit tests + needs: tests-prepare + strategy: + fail-fast: true + max-parallel: 2 + matrix: + on: [ubuntu-latest, macos-latest] + compiler: [gcc, clang] + test_kind: [unit, integration] + runs-on: ${{ matrix.os }} + steps: + - name: Checkout repository + uses: actions/checkout@v3 + with: + token: ${{ secrets.GH_TOKEN }} + - name: Pull Unit Test framework cache (${{ runner.os }} ${{ matrix.compiler }}) + if: ${{ matrix.test_kind == 'unit' }} + uses: actions/cache@v3 + with: + path: | + cgreen + key: ${{ runner.os }}-cgreen-${{ matrix.cgreen }}-${{ matrix.compiler }} + restore-keys: | + ${{ runner.os }}-cgreen-${{ matrix.cgreen }}- + - name: Pull Unit Test framework cache (${{ runner.os }} ${{ matrix.compiler }}) + if: ${{ matrix.test_kind == 'integration' }} + uses: actions/cache@v3 + with: + path: | + cgreen + key: ${{ runner.os }}-cgreen-${{ matrix.cgreen }}-${{ matrix.compiler }} + restore-keys: | + ${{ runner.os }}-cgreen-${{ matrix.cgreen }}- + - name: Run ${{ matrix.test_kind }} tests + shell: bash + env: + CC: ${{ matrix.compiler }} + run: | + [[ "${{ runner.os }}" == "ubuntu-latest" ]] && pip install --user gcovr + if [[ "${{ matrix.test_kind }}" == unit ]]; then + cd "$GITHUB_WORKSPACE/core" + make generate_report + cd "$GITHUB_WORKSPACE/lib" + make generate_report + else + cd "$GITHUB_WORKSPACE" + make -f posix.mk + posix/pubnub_fntest + openssl/pubnub_fntest + cpp/fntest_runner + cpp/openssl/fntest_runner + fi + acceptance: + name: Acceptance tests + runs-on: ubuntu-latest + steps: + - name: Setup environment + shell: bash + run: | + sudo apt-get install -y ninja-build libboost-all-dev libssl-dev + sudo gem install cucumber + - name: Checkout project + uses: actions/checkout@v3 + with: + token: ${{ secrets.GH_TOKEN }} + - name: Checkout mock-server action + uses: actions/checkout@v3 + with: + repository: pubnub/client-engineering-deployment-tools + ref: v1 + token: ${{ secrets.GH_TOKEN }} + path: .github/.release/actions + - name: Run mock server action + uses: ./.github/.release/actions/actions/mock-server + with: + token: ${{ secrets.GH_TOKEN }} + - name: Pull Cucumber cache + id: cucumber-cpp + uses: actions/cache@v3 + with: + path: | + cucumber-cpp + key: ${{ runner.os }}-cucumber-cpp-c79100eb70fbb34f6ea10030cec051c2cc9f7961 + restore-keys: | + ${{ runner.os }}-cucumber-cpp- + - name: Checkout Cucumber + if: steps.cucumber-cpp.outputs.cache-hit != 'true' + with: + repository: cucumber/cucumber-cpp + ref: c79100eb70fbb34f6ea10030cec051c2cc9f7961 + path: cucumber-cpp-src + - name: Build Cucumber + if: steps.cucumber-cpp.outputs.cache-hit != 'true' + run: | + cd ./cucumber-cpp-src + cmake -B build -DCMAKE_BUILD_TYPE=Debug + cmake --build build --config Debug + cd "$GITHUB_WORKSPACE" + mkdir -p cucumber-cpp + mv cucumber-cpp-src/build cucumber-cpp/build + mv cucumber-cpp-src/include cucumber-cpp/include + rm -rf cucumber-cpp-src + - name: Build acceptance tests + run: | + cd cpp + make -f posix_openssl.mk openssl/pubnub_sync + cd "$GITHUB_WORKSPACE" + g++ -std=c++11 -g -o BoostSteps.o -c features/step_definitions/BoostSteps.cpp -Icucumber-cpp/include -Icucumber-cpp/build/src/ -Iposix -Icore -I. -Icpp -D PUBNUB_CRYPTO_API=1 -D PUBNUB_USE_SSL=0 + g++ -o steps BoostSteps.o cpp/pubnub_sync.a cucumber-cpp/build/src/libcucumber-cpp.a -Lboost -lboost_unit_test_framework -lpthread -lboost_regex -lboost_thread -lboost_program_options -lboost_filesystem -lssl -lcrypto -D PUBNUB_USE_SSL=0 + - name: Run acceptance tests + env: + PAM_PUB_KEY: "pub_key" + PAM_SUB_KEY: "sub_key" + PAM_SEC_KEY: "sec_key" + run: | + mv sdk-specifications/features/access features + sudo python3 run_contract_tests.py features/access/grant-token.feature + sudo python3 run_contract_tests.py features/access/revoke-token.feature + ls -la results + - name: Expose acceptance tests reports + if: always() + uses: actions/upload-artifact@v3 + with: + name: acceptance-test-reports + path: ./results/** + retention-days: 7 \ No newline at end of file diff --git a/.github/workflows/run-validations.yml b/.github/workflows/run-validations.yml new file mode 100644 index 00000000..716f5773 --- /dev/null +++ b/.github/workflows/run-validations.yml @@ -0,0 +1,22 @@ +name: Validations + +on: [push] + +jobs: + validators: + name: "Validate .pubnub.yml" + runs-on: ubuntu-latest + steps: + - name: Checkout project + uses: actions/checkout@v3 + - name: Checkout validator action + uses: actions/checkout@v3 + with: + repository: pubnub/client-engineering-deployment-tools + ref: v1 + token: ${{ secrets.GH_TOKEN }} + path: .github/.release/actions + - name: "Run '.pubnub.yml' file validation" + uses: ./.github/.release/actions/actions/validators/pubnub-yml + with: + token: ${{ secrets.GH_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/run_acceptance_tests.yml b/.github/workflows/run_acceptance_tests.yml deleted file mode 100644 index b9132b59..00000000 --- a/.github/workflows/run_acceptance_tests.yml +++ /dev/null @@ -1,74 +0,0 @@ - -name: run_acceptance_tests - -on: [push] - -jobs: - build: - name: Perform Acceptance BDD tests - runs-on: ubuntu-latest - steps: - - name: Checkout project - uses: actions/checkout@v2 - - name: Checkout mock-server action - uses: actions/checkout@v2 - with: - repository: pubnub/client-engineering-deployment-tools - ref: v1 - token: ${{ secrets.GH_TOKEN }} - path: client-engineering-deployment-tools - - name: Run mock server action - uses: ./client-engineering-deployment-tools/actions/mock-server - with: - token: ${{ secrets.GH_TOKEN }} - - name: Setup environment - run: | - sudo apt-get install -y ninja-build libboost-all-dev libssl-dev - sudo gem install cucumber - - name: Git clone cucumber-cpp - run: | - git clone https://github.com/cucumber/cucumber-cpp.git - - name: Cache cucumber-cpp - id: cache-cucumber-cpp - uses: actions/cache@v2 - with: - path: | - cucumber-cpp - key: ${{ runner.os }}-cucumber-cpp-${{ hashFiles('cucumber-cpp/**') }} - restore-keys: | - ${{ runner.os }}-cucumber-cpp - - name: Configure cucumber-cpp - if: steps.cache-cucumber-cpp.outputs.cache-hit != 'true' - run: | - cmake -B build -DCMAKE_BUILD_TYPE=Debug - working-directory: ./cucumber-cpp - - - name: Build cucumber-cpp - if: steps.cache-cucumber-cpp.outputs.cache-hit != 'true' - run: | - cmake --build build --config Debug - working-directory: ./cucumber-cpp - - - name: Build acceptance tests - run: | - cd cpp - make -f posix_openssl.mk openssl/pubnub_sync - cd .. - g++ -std=c++11 -g -o BoostSteps.o -c features/step_definitions/BoostSteps.cpp -Icucumber-cpp/include -Icucumber-cpp/build/src/ -Iposix -Icore -I. -Icpp -D PUBNUB_CRYPTO_API=1 -D PUBNUB_USE_SSL=0 - g++ -o steps BoostSteps.o cpp/pubnub_sync.a cucumber-cpp/build/src/libcucumber-cpp.a -Lboost -lboost_unit_test_framework -lpthread -lboost_regex -lboost_thread -lboost_program_options -lboost_filesystem -lssl -lcrypto -D PUBNUB_USE_SSL=0 - - name: Run acceptance tests - env: - PAM_PUB_KEY: "pub_key" - PAM_SUB_KEY: "sub_key" - PAM_SEC_KEY: "sec_key" - run: | - mv sdk-specifications/features/access features - sudo python3 run_contract_tests.py features/access/grant-token.feature - sudo python3 run_contract_tests.py features/access/revoke-token.feature - ls -la results - - name: Upload acceptance tests reports - if: always() - uses: actions/upload-artifact@v2 - with: - name: acceptance-test-reports - path: ./results/** diff --git a/.github/workflows/validate-pubnub-yml.yml b/.github/workflows/validate-pubnub-yml.yml deleted file mode 100644 index 5963a0ff..00000000 --- a/.github/workflows/validate-pubnub-yml.yml +++ /dev/null @@ -1,24 +0,0 @@ -name: validate-pubnub-yml - -# Controls when the action will run. Workflow runs when manually triggered using the UI -# or API. -on: [push] - -jobs: - build: - name: Validate PubNub yml - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Use Node.js - uses: actions/setup-node@v1 - with: - node-version: '12.x' - - name: Install dependencies - run: | - npm install ajv@6.12.6 - npm install yaml@1.10.0 - npm install node-fetch@2.6.1 - npm install chalk@2.4.2 - - name: Validate - run: GITHUB_TOKEN=${{ secrets.GH_TOKEN }} node ./.github/workflows/validate-yml.js diff --git a/.github/workflows/validate-yml.js b/.github/workflows/validate-yml.js deleted file mode 100644 index b69ea465..00000000 --- a/.github/workflows/validate-yml.js +++ /dev/null @@ -1,94 +0,0 @@ -const YAML = require('yaml') -const Ajv = require('ajv'); -const fetch = require('node-fetch'); -const fs = require('fs'); -const chalk = require('chalk'); - -const ghToken = process.env.GITHUB_TOKEN; -const ghHeaders = {'User-Agent': 'sdk-bot', 'Authorization': 'token ' + ghToken,'Accept': 'application/vnd.github.v3.raw'}; - -const sdkReposJSONBranch = "develop"; -let sdkReposJSONPath = "http://api.github.com/repos/pubnub/documentation-resources/contents/website-common/tools/build/sdk-repos.json?ref=" + sdkReposJSONBranch; -startExecution(sdkReposJSONPath); - -async function startExecution(sdkReposJSONPath){ - var sdkRepos = await requestGetFromGithub(sdkReposJSONPath); - var sdkReposAndFeatureMappingArray = parseReposAndFeatureMapping(sdkRepos); - var schemaText = await requestGetFromGithub(sdkReposAndFeatureMappingArray[2]); - - schema = JSON.parse(schemaText); - var yaml = fs.readFileSync(".pubnub.yml", 'utf8'); - - if(yaml != null){ - yml = YAML.parse(yaml); - var ajv = new Ajv({schemaId: 'id', "verbose":true, "allErrors": true}); - const validate = ajv.compile(schema); - const valid = validate(yml); - if (validate.errors!= null) { - console.log(chalk.cyan("===================================")); - console.log(chalk.red(yml["version"] + " validation errors...")); - console.log(chalk.cyan("===================================")); - console.log(validate.errors); - console.log(chalk.cyan("===================================")); - var result = {code:1, repo: yml["version"], msg: "validation errors"}; - printResult(result); - process.exit(1); - } - else { - var result = {code: 0, repo: yml["version"], msg: "validation pass"}; - printResult(result); - } - } else { - var result = {code:1, repo: "yml null", msg: "validation errors"}; - printResult(result); - process.exit(1); - } -} - -function printResult(result){ - var str = result.repo + ", " + result.msg; - if(result.code === 0){ - console.log(chalk.green(str) + ", Code: " + result.code); - } else { - console.log(chalk.red(str) + ", Code: " + result.code); - } -} - -async function requestGetFromGithub(url){ - try { - const response = await fetch(url, { - headers: ghHeaders, - method: 'get', - }); - if(response.status == 200){ - const json = await response.text(); - return json; - } else { - console.error(chalk.red("res.status: " + response.status + "\n URL: " + url)); - return null; - } - - } catch (error) { - console.error(chalk.red("requestGetFromGithub: " + error + "\n URL: " + url)); - return null; - } -} - -function parseReposAndFeatureMapping(body){ - if(body != null){ - var sdkRepos = JSON.parse(body); - var locations = sdkRepos["locations"]; - if(locations!=null){ - var sdkURLs = locations["sdks"]; - var featureMappingURL = locations["featureMapping"]; - var pubnubYAMLSchemaURL = locations["pubnubYAMLSchema"]; - return [sdkURLs, featureMappingURL, pubnubYAMLSchemaURL]; - } else { - console.log(chalk.red("response locations null")); - return null; - } - } else { - console.log(chalk.red("response body null")); - return null; - } -} diff --git a/.gitignore b/.gitignore index 29eedd52..9c78d650 100644 --- a/.gitignore +++ b/.gitignore @@ -37,4 +37,10 @@ ################## .github/.release -.idea \ No newline at end of file +.idea + +.DS_Store +cgreen-src/ +cgreen/ +cucumber-cpp/ +cucumber-cpp-src/ \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 01d19400..00000000 --- a/.travis.yml +++ /dev/null @@ -1,76 +0,0 @@ -dist: xenial -language: c -os: linux - - -_shared_unit_tests: &shared_unit_tests - script: - - cd "$TRAVIS_BUILD_DIR/core" - - make generate_report - - cd "$TRAVIS_BUILD_DIR/lib" - - make generate_report - -_shared_integration_tests: &shared_integration_tests - before_script: - - cd "$TRAVIS_BUILD_DIR" - - make -f posix.mk - script: - - posix/pubnub_fntest - - openssl/pubnub_fntest - - cpp/fntest_runner - - cpp/openssl/fntest_runner - -install: - - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then pip install --user gcovr ; fi - -before_script: - - git clone https://github.com/cgreen-devs/cgreen.git - - cd cgreen - - git checkout 1.4.1 - - mkdir -p build - - cd build - - cmake -DCGREEN_INTERNAL_WITH_GCOV:BOOL=ON .. - - make -j2 - - cd ../.. - - -stages: - - name: "Unit tests" - - name: "Integration tests" - -jobs: - include: - - stage: "Unit tests" - name: "[Linux] Unit tests (clang)" - os: linux - compiler: clang - <<: *shared_unit_tests - - name: "[Linux] Unit tests (GCC)" - os: linux - compiler: gcc - <<: *shared_unit_tests - - name: "[macOS] Unit tests (clang)" - os: osx - compiler: clang - <<: *shared_unit_tests - - name: "[macOS] Unit tests (GCC)" - os: osx - compiler: gcc - <<: *shared_unit_tests - - stage: "Integration tests" - name: "[Linux] Integration tests (clang)" - os: linux - compiler: clang - <<: *shared_integration_tests - - name: "[Linux] Integration tests (GCC)" - os: linux - compiler: gcc - <<: *shared_integration_tests - - name: "[macOS] Integration tests (clang)" - os: osx - compiler: clang - <<: *shared_integration_tests - - name: "[macOS] Integration tests (GCC)" - os: osx - compiler: gcc - <<: *shared_integration_tests From fc732d5b428b7a2d06e475db4912c4f0a5d5b20a Mon Sep 17 00:00:00 2001 From: Serhii Mamontov Date: Tue, 29 Nov 2022 23:33:00 +0100 Subject: [PATCH 02/40] fix(github-actions): fix missing 'uses' in step --- .github/workflows/release.yml | 4 ++-- .github/workflows/run-tests.yml | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 76737479..cf3280dd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -21,8 +21,8 @@ jobs: ref: v1 token: ${{ secrets.GH_TOKEN }} path: .github/.release/actions - - id: check - name: Check pre-release completed + - name: Check pre-release completed + id: check uses: ./.github/.release/actions/actions/checks/release with: token: ${{ secrets.GH_TOKEN }} diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 7cb9082d..a7ff4519 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -31,6 +31,7 @@ jobs: ${{ runner.os }}-cgreen-${{ matrix.cgreen }}- - name: Checkout Unit Test framework if: steps.unit-test-framework.outputs.cache-hit != 'true' + uses: actions/checkout@v3 with: repository: cgreen-devs/cgreen ref: ${{ matrix.cgreen }} From ad118dc37f20a33c4c8eb27b1b660a1eebe98a23 Mon Sep 17 00:00:00 2001 From: Serhii Mamontov Date: Tue, 29 Nov 2022 23:41:02 +0100 Subject: [PATCH 03/40] fix(github-actions): fix missing 'uses' in step Add missing `uses` in acceptance test job. --- .github/workflows/run-tests.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index a7ff4519..797a8d96 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -38,6 +38,7 @@ jobs: path: cgreen-src - name: Build Unit Test framework (${{ runner.os }} ${{ matrix.compiler }}) if: steps.unit-test-framework.outputs.cache-hit != 'true' + shell: bash env: CC: ${{ matrix.compiler }} run: | @@ -139,12 +140,14 @@ jobs: ${{ runner.os }}-cucumber-cpp- - name: Checkout Cucumber if: steps.cucumber-cpp.outputs.cache-hit != 'true' + uses: actions/checkout@v3 with: repository: cucumber/cucumber-cpp ref: c79100eb70fbb34f6ea10030cec051c2cc9f7961 path: cucumber-cpp-src - name: Build Cucumber if: steps.cucumber-cpp.outputs.cache-hit != 'true' + shell: bash run: | cd ./cucumber-cpp-src cmake -B build -DCMAKE_BUILD_TYPE=Debug @@ -155,6 +158,7 @@ jobs: mv cucumber-cpp-src/include cucumber-cpp/include rm -rf cucumber-cpp-src - name: Build acceptance tests + shell: bash run: | cd cpp make -f posix_openssl.mk openssl/pubnub_sync @@ -162,6 +166,7 @@ jobs: g++ -std=c++11 -g -o BoostSteps.o -c features/step_definitions/BoostSteps.cpp -Icucumber-cpp/include -Icucumber-cpp/build/src/ -Iposix -Icore -I. -Icpp -D PUBNUB_CRYPTO_API=1 -D PUBNUB_USE_SSL=0 g++ -o steps BoostSteps.o cpp/pubnub_sync.a cucumber-cpp/build/src/libcucumber-cpp.a -Lboost -lboost_unit_test_framework -lpthread -lboost_regex -lboost_thread -lboost_program_options -lboost_filesystem -lssl -lcrypto -D PUBNUB_USE_SSL=0 - name: Run acceptance tests + shell: bash env: PAM_PUB_KEY: "pub_key" PAM_SUB_KEY: "sub_key" From b7b4c322da7fa65d186477efc526583eefe32486 Mon Sep 17 00:00:00 2001 From: Serhii Mamontov Date: Tue, 29 Nov 2022 23:48:33 +0100 Subject: [PATCH 04/40] fix(github-action): remove `runner` from concurrency setup Remove `runner.os` usage as runs group identifier. --- .github/workflows/run-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 797a8d96..e2945949 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -1,7 +1,7 @@ name: Tests concurrency: - group: ${{ runner.os }}-${{ github.ref }} + group: ${{ github.ref }} cancel-in-progress: true on: From 9d535766a977b8eb6e91e2308aa2987ff8c460f3 Mon Sep 17 00:00:00 2001 From: Serhii Mamontov Date: Wed, 30 Nov 2022 00:00:07 +0100 Subject: [PATCH 05/40] fix(github-actions): fix typo in matrix Fix type because of which empty `os` passed to runner image. --- .github/workflows/run-tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index e2945949..b8cdd029 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -15,7 +15,7 @@ jobs: strategy: fail-fast: true matrix: - on: [ubuntu-latest, macos-latest] + os: [ubuntu-latest, macos-latest] compiler: [gcc, clang] cgreen: [1.6.0] runs-on: ${{ matrix.os }} @@ -59,7 +59,7 @@ jobs: fail-fast: true max-parallel: 2 matrix: - on: [ubuntu-latest, macos-latest] + os: [ubuntu-latest, macos-latest] compiler: [gcc, clang] test_kind: [unit, integration] runs-on: ${{ matrix.os }} From 5a6ed694ed38588d385c94a20f9e8441827218e1 Mon Sep 17 00:00:00 2001 From: Serhii Mamontov Date: Wed, 30 Nov 2022 10:54:48 +0100 Subject: [PATCH 06/40] fix(github-actions): add 'CXX' environment variable --- .github/workflows/run-tests.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index b8cdd029..8b3daa91 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -41,6 +41,7 @@ jobs: shell: bash env: CC: ${{ matrix.compiler }} + CXX: ${{ matrix.compiler }} run: | cd cgreen-src mkdir -p build @@ -90,6 +91,7 @@ jobs: shell: bash env: CC: ${{ matrix.compiler }} + CXX: ${{ matrix.compiler }} run: | [[ "${{ runner.os }}" == "ubuntu-latest" ]] && pip install --user gcovr if [[ "${{ matrix.test_kind }}" == unit ]]; then From 70149fc05c3bdb89792e5eb1ff15b87f60d5cd85 Mon Sep 17 00:00:00 2001 From: Serhii Mamontov Date: Wed, 30 Nov 2022 11:02:02 +0100 Subject: [PATCH 07/40] refactor(github-actions): add 'gcov' install to prepare step --- .github/workflows/run-tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 8b3daa91..fcb98a2a 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -43,6 +43,7 @@ jobs: CC: ${{ matrix.compiler }} CXX: ${{ matrix.compiler }} run: | + [[ "${{ runner.os }}" == "ubuntu-latest" ]] && pip install --user gcovr cd cgreen-src mkdir -p build cd build From 55de4f7374b75f137d8ddc2d8237bb1269c584f1 Mon Sep 17 00:00:00 2001 From: Serhii Mamontov Date: Wed, 30 Nov 2022 11:04:23 +0100 Subject: [PATCH 08/40] fix(github-actions): fix values used in condition --- .github/workflows/run-tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index fcb98a2a..6501f743 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -43,7 +43,7 @@ jobs: CC: ${{ matrix.compiler }} CXX: ${{ matrix.compiler }} run: | - [[ "${{ runner.os }}" == "ubuntu-latest" ]] && pip install --user gcovr + [[ "${{ matrix.os }}" == "ubuntu-latest" ]] && pip install --user gcovr cd cgreen-src mkdir -p build cd build @@ -94,7 +94,7 @@ jobs: CC: ${{ matrix.compiler }} CXX: ${{ matrix.compiler }} run: | - [[ "${{ runner.os }}" == "ubuntu-latest" ]] && pip install --user gcovr + [[ "${{ matrix.os }}" == "ubuntu-latest" ]] && pip install --user gcovr if [[ "${{ matrix.test_kind }}" == unit ]]; then cd "$GITHUB_WORKSPACE/core" make generate_report From 1de213be76c316c3498d31c9c073fa906bfd9a24 Mon Sep 17 00:00:00 2001 From: Serhii Mamontov Date: Wed, 30 Nov 2022 11:41:09 +0100 Subject: [PATCH 09/40] refactor(github-actions): specify CC and CXX as flags --- .github/workflows/run-tests.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 6501f743..963179da 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -40,8 +40,8 @@ jobs: if: steps.unit-test-framework.outputs.cache-hit != 'true' shell: bash env: - CC: ${{ matrix.compiler }} - CXX: ${{ matrix.compiler }} + CC: -${{ matrix.compiler }} + CXX: -${{ matrix.compiler }} run: | [[ "${{ matrix.os }}" == "ubuntu-latest" ]] && pip install --user gcovr cd cgreen-src @@ -91,8 +91,8 @@ jobs: - name: Run ${{ matrix.test_kind }} tests shell: bash env: - CC: ${{ matrix.compiler }} - CXX: ${{ matrix.compiler }} + CC: -${{ matrix.compiler }} + CXX: -${{ matrix.compiler }} run: | [[ "${{ matrix.os }}" == "ubuntu-latest" ]] && pip install --user gcovr if [[ "${{ matrix.test_kind }}" == unit ]]; then From a9c4a301f741153f3fe9d4712c10323c52900b92 Mon Sep 17 00:00:00 2001 From: Serhii Mamontov Date: Wed, 30 Nov 2022 12:00:47 +0100 Subject: [PATCH 10/40] refactor(github-actions): lower 'cgreen' library version requirement --- .github/workflows/run-tests.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 963179da..d9637be1 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -17,7 +17,7 @@ jobs: matrix: os: [ubuntu-latest, macos-latest] compiler: [gcc, clang] - cgreen: [1.6.0] + cgreen: [1.4.1] runs-on: ${{ matrix.os }} steps: - name: Cache Unit Test framework (${{ runner.os }} ${{ matrix.compiler }}) @@ -40,10 +40,9 @@ jobs: if: steps.unit-test-framework.outputs.cache-hit != 'true' shell: bash env: - CC: -${{ matrix.compiler }} - CXX: -${{ matrix.compiler }} + CC: ${{ matrix.compiler }} + CXX: ${{ matrix.compiler }} run: | - [[ "${{ matrix.os }}" == "ubuntu-latest" ]] && pip install --user gcovr cd cgreen-src mkdir -p build cd build @@ -91,8 +90,8 @@ jobs: - name: Run ${{ matrix.test_kind }} tests shell: bash env: - CC: -${{ matrix.compiler }} - CXX: -${{ matrix.compiler }} + CC: ${{ matrix.compiler }} + CXX: ${{ matrix.compiler }} run: | [[ "${{ matrix.os }}" == "ubuntu-latest" ]] && pip install --user gcovr if [[ "${{ matrix.test_kind }}" == unit ]]; then From 0e35f5195b032519c3b9a5b026c72718cd6980bf Mon Sep 17 00:00:00 2001 From: Serhii Mamontov Date: Wed, 30 Nov 2022 12:22:15 +0100 Subject: [PATCH 11/40] refactor(github-actions): install libm for ubuntu --- .github/workflows/run-tests.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index d9637be1..3575bfa9 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -43,6 +43,7 @@ jobs: CC: ${{ matrix.compiler }} CXX: ${{ matrix.compiler }} run: | + [[ "${{ matrix.os }}" == "ubuntu-latest" ]] && apt-get install -y libmpfr-dev libmpc-dev cd cgreen-src mkdir -p build cd build @@ -114,8 +115,8 @@ jobs: - name: Setup environment shell: bash run: | - sudo apt-get install -y ninja-build libboost-all-dev libssl-dev - sudo gem install cucumber + apt-get install -y ninja-build libboost-all-dev libssl-dev + gem install cucumber - name: Checkout project uses: actions/checkout@v3 with: From c3e8b05f30bbd51927bde6fdfdc7eb5b5061858e Mon Sep 17 00:00:00 2001 From: Serhii Mamontov Date: Wed, 30 Nov 2022 12:23:30 +0100 Subject: [PATCH 12/40] fix(github-actions): use sudo with apn-get and gem --- .github/workflows/run-tests.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 3575bfa9..2697f56e 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -43,7 +43,7 @@ jobs: CC: ${{ matrix.compiler }} CXX: ${{ matrix.compiler }} run: | - [[ "${{ matrix.os }}" == "ubuntu-latest" ]] && apt-get install -y libmpfr-dev libmpc-dev + [[ "${{ matrix.os }}" == "ubuntu-latest" ]] && sudo apt-get install -y libmpfr-dev libmpc-dev cd cgreen-src mkdir -p build cd build @@ -115,8 +115,8 @@ jobs: - name: Setup environment shell: bash run: | - apt-get install -y ninja-build libboost-all-dev libssl-dev - gem install cucumber + sudo apt-get install -y ninja-build libboost-all-dev libssl-dev + sudo gem install cucumber - name: Checkout project uses: actions/checkout@v3 with: From fd50f864ab37167d9926e504d4dac3c052f19f6d Mon Sep 17 00:00:00 2001 From: Serhii Mamontov Date: Wed, 30 Nov 2022 12:50:54 +0100 Subject: [PATCH 13/40] refactor(github-actions): link libm --- .github/workflows/run-tests.yml | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 2697f56e..e92e5ba3 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -41,13 +41,12 @@ jobs: shell: bash env: CC: ${{ matrix.compiler }} - CXX: ${{ matrix.compiler }} + CXX: "${{ matrix.compiler == 'clang' && 'clang++' || 'g++' }}" run: | - [[ "${{ matrix.os }}" == "ubuntu-latest" ]] && sudo apt-get install -y libmpfr-dev libmpc-dev cd cgreen-src mkdir -p build cd build - cmake -DCGREEN_INTERNAL_WITH_GCOV:BOOL=ON .. + cmake -E env LDFLAGS="-lm" cmake -DCGREEN_INTERNAL_WITH_GCOV:BOOL=ON .. make -j2 cd "$GITHUB_WORKSPACE" mkdir -p cgreen @@ -79,20 +78,11 @@ jobs: key: ${{ runner.os }}-cgreen-${{ matrix.cgreen }}-${{ matrix.compiler }} restore-keys: | ${{ runner.os }}-cgreen-${{ matrix.cgreen }}- - - name: Pull Unit Test framework cache (${{ runner.os }} ${{ matrix.compiler }}) - if: ${{ matrix.test_kind == 'integration' }} - uses: actions/cache@v3 - with: - path: | - cgreen - key: ${{ runner.os }}-cgreen-${{ matrix.cgreen }}-${{ matrix.compiler }} - restore-keys: | - ${{ runner.os }}-cgreen-${{ matrix.cgreen }}- - name: Run ${{ matrix.test_kind }} tests shell: bash env: CC: ${{ matrix.compiler }} - CXX: ${{ matrix.compiler }} + CXX: "${{ matrix.compiler == 'clang' && 'clang++' || 'g++' }}" run: | [[ "${{ matrix.os }}" == "ubuntu-latest" ]] && pip install --user gcovr if [[ "${{ matrix.test_kind }}" == unit ]]; then From 11d4640df81235ddd946b1b83b1745ab7af657a8 Mon Sep 17 00:00:00 2001 From: Serhii Mamontov Date: Wed, 30 Nov 2022 14:22:18 +0100 Subject: [PATCH 14/40] test(github-actions): try to use reusable workflows --- .../reusable/prepare-unit-test-framework.yml | 51 +++++++++ .../unit-integration-tests-runner.yml | 103 ++++++++++++++++++ .github/workflows/run-tests.yml | 100 +++-------------- 3 files changed, 167 insertions(+), 87 deletions(-) create mode 100644 .github/workflows/reusable/prepare-unit-test-framework.yml create mode 100644 .github/workflows/reusable/unit-integration-tests-runner.yml diff --git a/.github/workflows/reusable/prepare-unit-test-framework.yml b/.github/workflows/reusable/prepare-unit-test-framework.yml new file mode 100644 index 00000000..f88b5574 --- /dev/null +++ b/.github/workflows/reusable/prepare-unit-test-framework.yml @@ -0,0 +1,51 @@ +on: + workflow_call: + inputs: + os: + required: true + type: string + version: + required: true + type: string + compiler: + required: true + type: string + +jobs: + build-unit-test-framework: + name: Prepare Unit Test framework + runs-on: ${{ inputs.os }} + steps: + - name: Cache Unit Test framework (${{ runner.os }} ${{ inputs.compiler }}) + id: unit-test-framework + uses: actions/cache@v3 + with: + path: | + cgreen + key: ${{ runner.os }}-cgreen-${{ inputs.version }}-${{ inputs.compiler }} + restore-keys: | + ${{ runner.os }}-cgreen-${{ matrix.cgreen }}- + - name: Checkout Unit Test framework + if: steps.unit-test-framework.outputs.cache-hit != 'true' + uses: actions/checkout@v3 + with: + repository: cgreen-devs/cgreen + ref: ${{ inputs.version }} + path: cgreen-src + - name: Build Unit Test framework (${{ runner.os }} ${{ inputs.compiler }}) + if: steps.unit-test-framework.outputs.cache-hit != 'true' + shell: bash + env: + CC: ${{ matrix.compiler }} + CXX: "${{ inputs.compiler == 'clang' && 'clang++' || 'g++' }}" + run: | + cd cgreen-src + mkdir -p build + cd build + cmake -E env LDFLAGS="-lm" cmake -DCGREEN_INTERNAL_WITH_GCOV:BOOL=ON .. + make -j2 + cd "$GITHUB_WORKSPACE" + mkdir -p cgreen + mv cgreen-src/build cgreen/build + mv cgreen-src/include cgreen/include + rm -rf cgreen-src \ No newline at end of file diff --git a/.github/workflows/reusable/unit-integration-tests-runner.yml b/.github/workflows/reusable/unit-integration-tests-runner.yml new file mode 100644 index 00000000..4f04958c --- /dev/null +++ b/.github/workflows/reusable/unit-integration-tests-runner.yml @@ -0,0 +1,103 @@ +on: + workflow_call: + inputs: + os: + required: true + type: string + version: + required: true + type: string + +jobs: + prepare-unit-test-gcc: + name: Prepare Unit Test framework (gcc) + uses: pubnub/c-core/.github/workflows/reusable/prepare-unit-test-framework.yml@master + with: + os: ${{ inputs.os }} + version: ${{ inputs.version }} + compiler: gcc + secrets: inherit + prepare-unit-test-clang: + name: Prepare Unit Test framework (clang) + uses: pubnub/c-core/.github/workflows/reusable/prepare-unit-test-framework.yml@master + with: + os: ${{ inputs.os }} + version: ${{ inputs.version }} + compiler: clang + secrets: inherit + tests: + name: Integration and Unit tests + runs-on: ${{ matrix.os }} + steps: + - name: Pull Unit Test framework (${{ runner.os }} gcc) + id: unit-test-framework + uses: actions/cache@v3 + with: + path: | + cgreen + key: ${{ runner.os }}-cgreen-${{ inputs.version }}-gcc + restore-keys: | + ${{ runner.os }}-cgreen-${{ inputs.version }}- + - name: Checkout repository + uses: actions/checkout@v3 + with: + token: ${{ secrets.GH_TOKEN }} + - name: Run unit tests (${{ runner.os }} gcc) + shell: bash + env: + CC: gcc + CXX: "g++" + run: | + [[ "${{ matrix.os }}" == "ubuntu-latest" ]] && pip install --user gcovr + cd "$GITHUB_WORKSPACE/core" + make generate_report + cd "$GITHUB_WORKSPACE/lib" + make generate_report + - name: Run integration tests (${{ runner.os }} gcc) + shell: bash + env: + CC: gcc + CXX: "g++" + run: | + cd "$GITHUB_WORKSPACE" + make -f posix.mk + posix/pubnub_fntest + openssl/pubnub_fntest + cpp/fntest_runner + cpp/openssl/fntest_runner + - name: Pull Unit Test framework (${{ runner.os }} clang) + id: unit-test-framework + uses: actions/cache@v3 + with: + path: | + cgreen + key: ${{ runner.os }}-cgreen-${{ inputs.version }}-clang + restore-keys: | + ${{ runner.os }}-cgreen-${{ inputs.version }}- + - name: Checkout repository + uses: actions/checkout@v3 + with: + token: ${{ secrets.GH_TOKEN }} + - name: Run unit tests (${{ runner.os }} clang) + shell: bash + env: + CC: clang + CXX: "clang++" + run: | + [[ "${{ matrix.os }}" == "ubuntu-latest" ]] && pip install --user gcovr + cd "$GITHUB_WORKSPACE/core" + make generate_report + cd "$GITHUB_WORKSPACE/lib" + make generate_report + - name: Run integration tests (${{ runner.os }} clang) + shell: bash + env: + CC: clang + CXX: "clang++" + run: | + cd "$GITHUB_WORKSPACE" + make -f posix.mk + posix/pubnub_fntest + openssl/pubnub_fntest + cpp/fntest_runner + cpp/openssl/fntest_runner \ No newline at end of file diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index e92e5ba3..61785415 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -10,94 +10,20 @@ on: jobs: - tests-prepare: - name: Prepare testing environment - strategy: - fail-fast: true - matrix: - os: [ubuntu-latest, macos-latest] - compiler: [gcc, clang] - cgreen: [1.4.1] - runs-on: ${{ matrix.os }} - steps: - - name: Cache Unit Test framework (${{ runner.os }} ${{ matrix.compiler }}) - id: unit-test-framework - uses: actions/cache@v3 - with: - path: | - cgreen - key: ${{ runner.os }}-cgreen-${{ matrix.cgreen }}-${{ matrix.compiler }} - restore-keys: | - ${{ runner.os }}-cgreen-${{ matrix.cgreen }}- - - name: Checkout Unit Test framework - if: steps.unit-test-framework.outputs.cache-hit != 'true' - uses: actions/checkout@v3 - with: - repository: cgreen-devs/cgreen - ref: ${{ matrix.cgreen }} - path: cgreen-src - - name: Build Unit Test framework (${{ runner.os }} ${{ matrix.compiler }}) - if: steps.unit-test-framework.outputs.cache-hit != 'true' - shell: bash - env: - CC: ${{ matrix.compiler }} - CXX: "${{ matrix.compiler == 'clang' && 'clang++' || 'g++' }}" - run: | - cd cgreen-src - mkdir -p build - cd build - cmake -E env LDFLAGS="-lm" cmake -DCGREEN_INTERNAL_WITH_GCOV:BOOL=ON .. - make -j2 - cd "$GITHUB_WORKSPACE" - mkdir -p cgreen - mv cgreen-src/build cgreen/build - mv cgreen-src/include cgreen/include - rm -rf cgreen-src - tests: + tests-ubuntu: name: Integration and Unit tests - needs: tests-prepare - strategy: - fail-fast: true - max-parallel: 2 - matrix: - os: [ubuntu-latest, macos-latest] - compiler: [gcc, clang] - test_kind: [unit, integration] - runs-on: ${{ matrix.os }} - steps: - - name: Checkout repository - uses: actions/checkout@v3 - with: - token: ${{ secrets.GH_TOKEN }} - - name: Pull Unit Test framework cache (${{ runner.os }} ${{ matrix.compiler }}) - if: ${{ matrix.test_kind == 'unit' }} - uses: actions/cache@v3 - with: - path: | - cgreen - key: ${{ runner.os }}-cgreen-${{ matrix.cgreen }}-${{ matrix.compiler }} - restore-keys: | - ${{ runner.os }}-cgreen-${{ matrix.cgreen }}- - - name: Run ${{ matrix.test_kind }} tests - shell: bash - env: - CC: ${{ matrix.compiler }} - CXX: "${{ matrix.compiler == 'clang' && 'clang++' || 'g++' }}" - run: | - [[ "${{ matrix.os }}" == "ubuntu-latest" ]] && pip install --user gcovr - if [[ "${{ matrix.test_kind }}" == unit ]]; then - cd "$GITHUB_WORKSPACE/core" - make generate_report - cd "$GITHUB_WORKSPACE/lib" - make generate_report - else - cd "$GITHUB_WORKSPACE" - make -f posix.mk - posix/pubnub_fntest - openssl/pubnub_fntest - cpp/fntest_runner - cpp/openssl/fntest_runner - fi + uses: pubnub/c-core/.github/workflows/reusable/unit-integration-tests-runner.yml@master + with: + os: ubuntu-latest + version: 1.6.0 + secrets: inherit + tests-macos: + name: Integration and Unit tests + uses: pubnub/c-core/.github/workflows/reusable/unit-integration-tests-runner.yml@master + with: + os: macos-latest + version: 1.6.0 + secrets: inherit acceptance: name: Acceptance tests runs-on: ubuntu-latest From 645270f720356726c698a3d9b23281704084696b Mon Sep 17 00:00:00 2001 From: Serhii Mamontov Date: Wed, 30 Nov 2022 14:25:01 +0100 Subject: [PATCH 15/40] test(github-actions): fix reusable workflows location --- ...framework.yml => reusable-prepare-unit-test-framework.yml} | 0 ...-runner.yml => reusable-unit-integration-tests-runner.yml} | 4 ++-- .github/workflows/run-tests.yml | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) rename .github/workflows/{reusable/prepare-unit-test-framework.yml => reusable-prepare-unit-test-framework.yml} (100%) rename .github/workflows/{reusable/unit-integration-tests-runner.yml => reusable-unit-integration-tests-runner.yml} (95%) diff --git a/.github/workflows/reusable/prepare-unit-test-framework.yml b/.github/workflows/reusable-prepare-unit-test-framework.yml similarity index 100% rename from .github/workflows/reusable/prepare-unit-test-framework.yml rename to .github/workflows/reusable-prepare-unit-test-framework.yml diff --git a/.github/workflows/reusable/unit-integration-tests-runner.yml b/.github/workflows/reusable-unit-integration-tests-runner.yml similarity index 95% rename from .github/workflows/reusable/unit-integration-tests-runner.yml rename to .github/workflows/reusable-unit-integration-tests-runner.yml index 4f04958c..8655a6bf 100644 --- a/.github/workflows/reusable/unit-integration-tests-runner.yml +++ b/.github/workflows/reusable-unit-integration-tests-runner.yml @@ -11,7 +11,7 @@ on: jobs: prepare-unit-test-gcc: name: Prepare Unit Test framework (gcc) - uses: pubnub/c-core/.github/workflows/reusable/prepare-unit-test-framework.yml@master + uses: pubnub/c-core/.github/workflows/reusable-prepare-unit-test-framework.yml@master with: os: ${{ inputs.os }} version: ${{ inputs.version }} @@ -19,7 +19,7 @@ jobs: secrets: inherit prepare-unit-test-clang: name: Prepare Unit Test framework (clang) - uses: pubnub/c-core/.github/workflows/reusable/prepare-unit-test-framework.yml@master + uses: pubnub/c-core/.github/workflows/reusable-prepare-unit-test-framework.yml@master with: os: ${{ inputs.os }} version: ${{ inputs.version }} diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 61785415..c13e8a1d 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -12,14 +12,14 @@ on: jobs: tests-ubuntu: name: Integration and Unit tests - uses: pubnub/c-core/.github/workflows/reusable/unit-integration-tests-runner.yml@master + uses: pubnub/c-core/.github/workflows/reusable-unit-integration-tests-runner.yml@master with: os: ubuntu-latest version: 1.6.0 secrets: inherit tests-macos: name: Integration and Unit tests - uses: pubnub/c-core/.github/workflows/reusable/unit-integration-tests-runner.yml@master + uses: pubnub/c-core/.github/workflows/reusable-unit-integration-tests-runner.yml@master with: os: macos-latest version: 1.6.0 From 921cff7b0d3296ce4a2c3895faba8fd46384ccdd Mon Sep 17 00:00:00 2001 From: Serhii Mamontov Date: Wed, 30 Nov 2022 14:34:43 +0100 Subject: [PATCH 16/40] test(github-actions): fix reusable workflow configuration --- ...reusable-unit-integration-tests-runner.yml | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/reusable-unit-integration-tests-runner.yml b/.github/workflows/reusable-unit-integration-tests-runner.yml index 8655a6bf..d8e15e05 100644 --- a/.github/workflows/reusable-unit-integration-tests-runner.yml +++ b/.github/workflows/reusable-unit-integration-tests-runner.yml @@ -12,19 +12,19 @@ jobs: prepare-unit-test-gcc: name: Prepare Unit Test framework (gcc) uses: pubnub/c-core/.github/workflows/reusable-prepare-unit-test-framework.yml@master - with: - os: ${{ inputs.os }} - version: ${{ inputs.version }} - compiler: gcc - secrets: inherit + with: + os: ${{ inputs.os }} + version: ${{ inputs.version }} + compiler: gcc + secrets: inherit prepare-unit-test-clang: name: Prepare Unit Test framework (clang) uses: pubnub/c-core/.github/workflows/reusable-prepare-unit-test-framework.yml@master - with: - os: ${{ inputs.os }} - version: ${{ inputs.version }} - compiler: clang - secrets: inherit + with: + os: ${{ inputs.os }} + version: ${{ inputs.version }} + compiler: clang + secrets: inherit tests: name: Integration and Unit tests runs-on: ${{ matrix.os }} From 89b6dee9f176a0f76ed489886c1bafeeafc05ece Mon Sep 17 00:00:00 2001 From: Serhii Mamontov Date: Wed, 30 Nov 2022 14:39:03 +0100 Subject: [PATCH 17/40] test(github-actions): fix branch names for reusable workflow load --- .github/workflows/reusable-unit-integration-tests-runner.yml | 4 ++-- .github/workflows/run-tests.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/reusable-unit-integration-tests-runner.yml b/.github/workflows/reusable-unit-integration-tests-runner.yml index d8e15e05..6daec4e9 100644 --- a/.github/workflows/reusable-unit-integration-tests-runner.yml +++ b/.github/workflows/reusable-unit-integration-tests-runner.yml @@ -11,7 +11,7 @@ on: jobs: prepare-unit-test-gcc: name: Prepare Unit Test framework (gcc) - uses: pubnub/c-core/.github/workflows/reusable-prepare-unit-test-framework.yml@master + uses: pubnub/c-core/.github/workflows/reusable-prepare-unit-test-framework.yml@test/switch-to-actions with: os: ${{ inputs.os }} version: ${{ inputs.version }} @@ -19,7 +19,7 @@ jobs: secrets: inherit prepare-unit-test-clang: name: Prepare Unit Test framework (clang) - uses: pubnub/c-core/.github/workflows/reusable-prepare-unit-test-framework.yml@master + uses: pubnub/c-core/.github/workflows/reusable-prepare-unit-test-framework.yml@test/switch-to-actions with: os: ${{ inputs.os }} version: ${{ inputs.version }} diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index c13e8a1d..c6003a72 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -12,14 +12,14 @@ on: jobs: tests-ubuntu: name: Integration and Unit tests - uses: pubnub/c-core/.github/workflows/reusable-unit-integration-tests-runner.yml@master + uses: pubnub/c-core/.github/workflows/reusable-unit-integration-tests-runner.yml@test/switch-to-actions with: os: ubuntu-latest version: 1.6.0 secrets: inherit tests-macos: name: Integration and Unit tests - uses: pubnub/c-core/.github/workflows/reusable-unit-integration-tests-runner.yml@master + uses: pubnub/c-core/.github/workflows/reusable-unit-integration-tests-runner.yml@test/switch-to-actions with: os: macos-latest version: 1.6.0 From 7b0bda8f493cff436b9167e3337b24f7cba35838 Mon Sep 17 00:00:00 2001 From: Serhii Mamontov Date: Wed, 30 Nov 2022 14:42:42 +0100 Subject: [PATCH 18/40] test(github-actions): fix cache identifier and dependency --- .github/workflows/reusable-unit-integration-tests-runner.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/reusable-unit-integration-tests-runner.yml b/.github/workflows/reusable-unit-integration-tests-runner.yml index 6daec4e9..72e7c1b7 100644 --- a/.github/workflows/reusable-unit-integration-tests-runner.yml +++ b/.github/workflows/reusable-unit-integration-tests-runner.yml @@ -28,9 +28,9 @@ jobs: tests: name: Integration and Unit tests runs-on: ${{ matrix.os }} + needs: [prepare-unit-test-gcc, prepare-unit-test-clang] steps: - name: Pull Unit Test framework (${{ runner.os }} gcc) - id: unit-test-framework uses: actions/cache@v3 with: path: | @@ -66,7 +66,6 @@ jobs: cpp/fntest_runner cpp/openssl/fntest_runner - name: Pull Unit Test framework (${{ runner.os }} clang) - id: unit-test-framework uses: actions/cache@v3 with: path: | From c872afbd8d633111397ca9811ee82d95ccc900c5 Mon Sep 17 00:00:00 2001 From: Serhii Mamontov Date: Wed, 30 Nov 2022 14:53:59 +0100 Subject: [PATCH 19/40] test(github-actions): change names for reusable workflows --- .github/workflows/reusable-prepare-unit-test-framework.yml | 2 +- .github/workflows/reusable-unit-integration-tests-runner.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/reusable-prepare-unit-test-framework.yml b/.github/workflows/reusable-prepare-unit-test-framework.yml index f88b5574..1a384dbb 100644 --- a/.github/workflows/reusable-prepare-unit-test-framework.yml +++ b/.github/workflows/reusable-prepare-unit-test-framework.yml @@ -13,7 +13,7 @@ on: jobs: build-unit-test-framework: - name: Prepare Unit Test framework + name: Build and cache (${{ runner.os }} ${{ inputs.compiler }}) runs-on: ${{ inputs.os }} steps: - name: Cache Unit Test framework (${{ runner.os }} ${{ inputs.compiler }}) diff --git a/.github/workflows/reusable-unit-integration-tests-runner.yml b/.github/workflows/reusable-unit-integration-tests-runner.yml index 72e7c1b7..0992ec9e 100644 --- a/.github/workflows/reusable-unit-integration-tests-runner.yml +++ b/.github/workflows/reusable-unit-integration-tests-runner.yml @@ -10,7 +10,7 @@ on: jobs: prepare-unit-test-gcc: - name: Prepare Unit Test framework (gcc) + name: Prepare Unit Test framework (${{ inputs.os }} gcc) uses: pubnub/c-core/.github/workflows/reusable-prepare-unit-test-framework.yml@test/switch-to-actions with: os: ${{ inputs.os }} @@ -18,7 +18,7 @@ jobs: compiler: gcc secrets: inherit prepare-unit-test-clang: - name: Prepare Unit Test framework (clang) + name: Prepare Unit Test framework (${{ inputs.os }} clang) uses: pubnub/c-core/.github/workflows/reusable-prepare-unit-test-framework.yml@test/switch-to-actions with: os: ${{ inputs.os }} From ca8e8794c9c69d1b29ac65c1ae819b655cc60115 Mon Sep 17 00:00:00 2001 From: Serhii Mamontov Date: Wed, 30 Nov 2022 14:55:32 +0100 Subject: [PATCH 20/40] test(github-actions): fix names for reusable workflows --- .github/workflows/reusable-prepare-unit-test-framework.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/reusable-prepare-unit-test-framework.yml b/.github/workflows/reusable-prepare-unit-test-framework.yml index 1a384dbb..de988f82 100644 --- a/.github/workflows/reusable-prepare-unit-test-framework.yml +++ b/.github/workflows/reusable-prepare-unit-test-framework.yml @@ -13,7 +13,7 @@ on: jobs: build-unit-test-framework: - name: Build and cache (${{ runner.os }} ${{ inputs.compiler }}) + name: Build and cache (${{ inputs.os }} ${{ inputs.compiler }}) runs-on: ${{ inputs.os }} steps: - name: Cache Unit Test framework (${{ runner.os }} ${{ inputs.compiler }}) From de01839ab119aeb3024b13c0d6603ba3fd378bc6 Mon Sep 17 00:00:00 2001 From: Serhii Mamontov Date: Wed, 30 Nov 2022 14:57:46 +0100 Subject: [PATCH 21/40] test(github-actions): fix gcov configuration --- .github/workflows/reusable-prepare-unit-test-framework.yml | 1 + .github/workflows/reusable-unit-integration-tests-runner.yml | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/reusable-prepare-unit-test-framework.yml b/.github/workflows/reusable-prepare-unit-test-framework.yml index de988f82..694b2fda 100644 --- a/.github/workflows/reusable-prepare-unit-test-framework.yml +++ b/.github/workflows/reusable-prepare-unit-test-framework.yml @@ -39,6 +39,7 @@ jobs: CC: ${{ matrix.compiler }} CXX: "${{ inputs.compiler == 'clang' && 'clang++' || 'g++' }}" run: | + [[ "${{ matrix.os }}" == "ubuntu-latest" ]] && pip install --user gcovr cd cgreen-src mkdir -p build cd build diff --git a/.github/workflows/reusable-unit-integration-tests-runner.yml b/.github/workflows/reusable-unit-integration-tests-runner.yml index 0992ec9e..11392756 100644 --- a/.github/workflows/reusable-unit-integration-tests-runner.yml +++ b/.github/workflows/reusable-unit-integration-tests-runner.yml @@ -48,7 +48,6 @@ jobs: CC: gcc CXX: "g++" run: | - [[ "${{ matrix.os }}" == "ubuntu-latest" ]] && pip install --user gcovr cd "$GITHUB_WORKSPACE/core" make generate_report cd "$GITHUB_WORKSPACE/lib" @@ -83,7 +82,6 @@ jobs: CC: clang CXX: "clang++" run: | - [[ "${{ matrix.os }}" == "ubuntu-latest" ]] && pip install --user gcovr cd "$GITHUB_WORKSPACE/core" make generate_report cd "$GITHUB_WORKSPACE/lib" From d28ca60a8434f57643e624a365b6bf1c09579c28 Mon Sep 17 00:00:00 2001 From: Serhii Mamontov Date: Wed, 30 Nov 2022 14:59:05 +0100 Subject: [PATCH 22/40] test(github-action): remove gcov usage --- .github/workflows/reusable-prepare-unit-test-framework.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/reusable-prepare-unit-test-framework.yml b/.github/workflows/reusable-prepare-unit-test-framework.yml index 694b2fda..8d5f14d6 100644 --- a/.github/workflows/reusable-prepare-unit-test-framework.yml +++ b/.github/workflows/reusable-prepare-unit-test-framework.yml @@ -39,11 +39,10 @@ jobs: CC: ${{ matrix.compiler }} CXX: "${{ inputs.compiler == 'clang' && 'clang++' || 'g++' }}" run: | - [[ "${{ matrix.os }}" == "ubuntu-latest" ]] && pip install --user gcovr cd cgreen-src mkdir -p build cd build - cmake -E env LDFLAGS="-lm" cmake -DCGREEN_INTERNAL_WITH_GCOV:BOOL=ON .. + cmake -E env LDFLAGS="-lm" cmake .. make -j2 cd "$GITHUB_WORKSPACE" mkdir -p cgreen From 0d5b7c4f6546aa74e4bd8c95f21be0d5508fb78e Mon Sep 17 00:00:00 2001 From: Serhii Mamontov Date: Wed, 30 Nov 2022 15:02:41 +0100 Subject: [PATCH 23/40] test(github-action): fix 'runs-on' for 'tests' job --- .github/workflows/reusable-unit-integration-tests-runner.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/reusable-unit-integration-tests-runner.yml b/.github/workflows/reusable-unit-integration-tests-runner.yml index 11392756..d7f3875d 100644 --- a/.github/workflows/reusable-unit-integration-tests-runner.yml +++ b/.github/workflows/reusable-unit-integration-tests-runner.yml @@ -26,8 +26,8 @@ jobs: compiler: clang secrets: inherit tests: - name: Integration and Unit tests - runs-on: ${{ matrix.os }} + name: Run tests + runs-on: ${{ inputs.os }} needs: [prepare-unit-test-gcc, prepare-unit-test-clang] steps: - name: Pull Unit Test framework (${{ runner.os }} gcc) From 0ca44e7213dcfc39911eaa0cb27fe55ce456ddef Mon Sep 17 00:00:00 2001 From: Serhii Mamontov Date: Wed, 30 Nov 2022 15:11:16 +0100 Subject: [PATCH 24/40] test(github-actions): swap order of steps in test --- .../reusable-unit-integration-tests-runner.yml | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/.github/workflows/reusable-unit-integration-tests-runner.yml b/.github/workflows/reusable-unit-integration-tests-runner.yml index d7f3875d..04473b41 100644 --- a/.github/workflows/reusable-unit-integration-tests-runner.yml +++ b/.github/workflows/reusable-unit-integration-tests-runner.yml @@ -30,6 +30,10 @@ jobs: runs-on: ${{ inputs.os }} needs: [prepare-unit-test-gcc, prepare-unit-test-clang] steps: + - name: Checkout repository + uses: actions/checkout@v3 + with: + token: ${{ secrets.GH_TOKEN }} - name: Pull Unit Test framework (${{ runner.os }} gcc) uses: actions/cache@v3 with: @@ -38,10 +42,6 @@ jobs: key: ${{ runner.os }}-cgreen-${{ inputs.version }}-gcc restore-keys: | ${{ runner.os }}-cgreen-${{ inputs.version }}- - - name: Checkout repository - uses: actions/checkout@v3 - with: - token: ${{ secrets.GH_TOKEN }} - name: Run unit tests (${{ runner.os }} gcc) shell: bash env: @@ -72,10 +72,6 @@ jobs: key: ${{ runner.os }}-cgreen-${{ inputs.version }}-clang restore-keys: | ${{ runner.os }}-cgreen-${{ inputs.version }}- - - name: Checkout repository - uses: actions/checkout@v3 - with: - token: ${{ secrets.GH_TOKEN }} - name: Run unit tests (${{ runner.os }} clang) shell: bash env: From 2642f488927f4b4709a6c87477a2c740caf78001 Mon Sep 17 00:00:00 2001 From: Serhii Mamontov Date: Thu, 1 Dec 2022 18:51:29 +0100 Subject: [PATCH 25/40] refactor(github-actions): tests runner as local actions Build dependencies and run tests using local GitHub actions. fix(build): fix 'clean' targets Fix issue because of which `clean` target always exited with error. --- .../unit-integration-test-runner/action.yaml | 88 +++++++++++++++++ .../composite/unit-test-framework/action.yaml | 31 ++++++ .../unit-test-framework/build-framework.sh | 59 ++++++++++++ .../reusable-prepare-unit-test-framework.yml | 51 ---------- ...reusable-unit-integration-tests-runner.yml | 96 ------------------- .github/workflows/run-tests.yml | 35 ++++--- core/Makefile | 3 +- cpp/posix.mk | 3 +- cpp/posix_openssl.mk | 3 +- lib/Makefile | 3 +- openssl/posix.mk | 3 +- posix/posix.mk | 4 +- 12 files changed, 214 insertions(+), 165 deletions(-) create mode 100644 .github/workflows/composite/unit-integration-test-runner/action.yaml create mode 100644 .github/workflows/composite/unit-test-framework/action.yaml create mode 100755 .github/workflows/composite/unit-test-framework/build-framework.sh delete mode 100644 .github/workflows/reusable-prepare-unit-test-framework.yml delete mode 100644 .github/workflows/reusable-unit-integration-tests-runner.yml diff --git a/.github/workflows/composite/unit-integration-test-runner/action.yaml b/.github/workflows/composite/unit-integration-test-runner/action.yaml new file mode 100644 index 00000000..d5258e93 --- /dev/null +++ b/.github/workflows/composite/unit-integration-test-runner/action.yaml @@ -0,0 +1,88 @@ +--- +name: Tests runner +description: Unit and integration tests runner for multiple compiler types. +author: PubNub +inputs: + os: + description: Environment in which framework should be built. + required: true + version: + description: "Which version of 'cgreen' should be built". + required: true + +runs: + using: "composite" + steps: + - name: Pull Unit Test framework ('${{ inputs.os }}' gcc, clang) + uses: .github/workflows/composite/unit-test-framework@test/switch-to-actions + with: + os: ${{ inputs.os }} + version: ${{ inputs.version }} + compilers: gcc,clang + - name: Prepare Unit Test framework ('${{ inputs.os }}' gcc) + shell: bash + run: | + mv "$GITHUB_WORKSPACE/cgreen" "$GITHUB_WORKSPACE/cgreen-universal" + cp -r "$GITHUB_WORKSPACE/cgreen-universal/gcc" "$GITHUB_WORKSPACE/cgreen-universal/cgreen" + - name: Run unit tests ('${{ inputs.os }}' gcc) + shell: bash + env: + CC: gcc + CXX: "g++" + run: | + echo "::group::Run unit tests ('${{ inputs.os }}' gcc)" + cd "$GITHUB_WORKSPACE/core" + make clean generate_report + cd "$GITHUB_WORKSPACE/lib" + make clean generate_report + echo "::endgroup::" + - name: Run integration tests ('${{ inputs.os }}' gcc) + shell: bash + env: + CC: gcc + CXX: "g++" + run: | + echo "::group::Run integration tests ('${{ inputs.os }}' gcc)" + cd "$GITHUB_WORKSPACE" + make -f posix.mk clean all + posix/pubnub_fntest + openssl/pubnub_fntest + cpp/fntest_runner + cpp/openssl/fntest_runner + echo "::endgroup::" + - name: Prepare Unit Test framework ('${{ inputs.os }}' clang) + shell: bash + run: | + rm -rf "$GITHUB_WORKSPACE/cgreen" + cp -r "$GITHUB_WORKSPACE/cgreen-universal/clang" "$GITHUB_WORKSPACE/cgreen" + - name: Run unit tests ('${{ inputs.os }}' clang) + shell: bash + env: + CC: clang + CXX: "clang++" + run: | + echo "::group::Run unit tests ('${{ inputs.os }}' clang)" + cd "$GITHUB_WORKSPACE/core" + make clean generate_report + cd "$GITHUB_WORKSPACE/lib" + make clean generate_report + echo "::endgroup::" + - name: Run integration tests ('${{ inputs.os }}' clang) + shell: bash + env: + CC: clang + CXX: "clang++" + run: | + echo "::group::Run integration tests ('${{ inputs.os }}' clang)" + cd "$GITHUB_WORKSPACE" + make -f posix.mk clean all + posix/pubnub_fntest + openssl/pubnub_fntest + cpp/fntest_runner + cpp/openssl/fntest_runner + echo "::endgroup::" + - name: Restore Unit Test framework ('${{ inputs.os }}' gcc,clang) + shell: bash + run: | + rm -rf "$GITHUB_WORKSPACE/cgreen" + cp -r "$GITHUB_WORKSPACE/cgreen-universal" "$GITHUB_WORKSPACE/cgreen" \ No newline at end of file diff --git a/.github/workflows/composite/unit-test-framework/action.yaml b/.github/workflows/composite/unit-test-framework/action.yaml new file mode 100644 index 00000000..ad4270d7 --- /dev/null +++ b/.github/workflows/composite/unit-test-framework/action.yaml @@ -0,0 +1,31 @@ +--- +name: Unit Test and Mocking framework +description: Manage unit test framework build and cache so it can be used with jobs. +author: PubNub +inputs: + os: + description: Environment in which framework should be built. + required: true + version: + description: "Which version of 'cgreen' should be built". + required: true + compilers: + description: "Coma-separated list of currently supported C compilers to be used during build (gcc, clang)". + required: true + +runs: + using: "composite" + steps: + - name: Build and Cache Unit Test framework ('${{ inputs.os }}' ${{ inputs.compilers }}) + id: unit-test-framework + uses: actions/cache@v3 + with: + path: | + cgreen + key: ${{ inputs.os }}-cgreen-${{ inputs.version }}-1 + restore-keys: | + ${{ inputs.os }}-cgreen-${{ inputs.version }}- + - name: Build Unit Test frameworks + if: steps.unit-test-framework.outputs.cache-hit != 'true' + shell: bash + run: .github/workflows/composite/unit-test-framework/build-framework.sh ${{ inputs.os }} ${{ inputs.compilers }} \ No newline at end of file diff --git a/.github/workflows/composite/unit-test-framework/build-framework.sh b/.github/workflows/composite/unit-test-framework/build-framework.sh new file mode 100755 index 00000000..1a0e6118 --- /dev/null +++ b/.github/workflows/composite/unit-test-framework/build-framework.sh @@ -0,0 +1,59 @@ +#!/bin/bash + +echo "'$0'" +echo "'$1'" +echo "'$2'" + +# Identify make tool which depends from environment. +[[ $1 =~ (ubuntu|macos) ]] && MAKE_TOOL=make || MAKE_TOOL=$(MAKE) + +# Iterating over list of passed compilers. +for compiler in ${2//,/ } +do + # Navigate to unit test framework source folder. + cd "$GITHUB_WORKSPACE/cgreen" + + # Clean up previous build results. + [[ -d build ]] && $MAKE_TOOL clean && rm -rf build + + echo "::group::Build unit test framework ('$1' $compiler)" + if [[ $1 =~ (ubuntu|macos) ]]; then + export CC="$compiler" + [[ $compiler == "gcc" ]] && export CXX="g++" || export CXX="$compiler++" + else + echo "::notice::Here should be some setup for Windows compiler" + fi + + echo "::debug title=cgreen::Prepare folders structure" + ! [[ -d "$GITHUB_WORKSPACE/cgreen-tmp/$compiler" ]] && + mkdir -p "$GITHUB_WORKSPACE/cgreen-tmp/$compiler" + mkdir -p build && cd build + + # Enable 'gcov' only for build on Ubuntu. + [[ "$1" == "ubuntu" ]] && WITH_GCOV=ON || WITH_GCOV=OFF + if [[ "$WITH_GCOV" == ON ]]; then + echo "::debug title=gcov::Installing 'gcov' for code coverage." + pip install --user gcovr + else + echo "::notice title=gcov::'gcov' doesn't work as expected on $1." + echo "::notice title=gcov::Configure 'cgreen' without 'gcov' support" + fi + + echo "::debug title=cgreen::Configure 'cgreen' build" + cmake -E env LDFLAGS="-lm" cmake -DCGREEN_INTERNAL_WITH_GCOV:BOOL=$WITH_GCOV .. + + echo "::debug title=cgreen::Build 'cgreen' framework" + make -j2 + + echo "::debug::Move built results to compiler specific colder" + mv "$GITHUB_WORKSPACE/cgreen/build" "$GITHUB_WORKSPACE/cgreen-tmp/$compiler/build" + cp -r "$GITHUB_WORKSPACE/cgreen/include" "$GITHUB_WORKSPACE/cgreen-tmp/$compiler/include" + + # Clean up configured environments. + unset CC && unset CXX + echo "::endgroup::" +done + +echo "::debug title=cgreen::Prepare files for caching" +rm -rf cgreen +mv cgreen-tmp cgreen \ No newline at end of file diff --git a/.github/workflows/reusable-prepare-unit-test-framework.yml b/.github/workflows/reusable-prepare-unit-test-framework.yml deleted file mode 100644 index 8d5f14d6..00000000 --- a/.github/workflows/reusable-prepare-unit-test-framework.yml +++ /dev/null @@ -1,51 +0,0 @@ -on: - workflow_call: - inputs: - os: - required: true - type: string - version: - required: true - type: string - compiler: - required: true - type: string - -jobs: - build-unit-test-framework: - name: Build and cache (${{ inputs.os }} ${{ inputs.compiler }}) - runs-on: ${{ inputs.os }} - steps: - - name: Cache Unit Test framework (${{ runner.os }} ${{ inputs.compiler }}) - id: unit-test-framework - uses: actions/cache@v3 - with: - path: | - cgreen - key: ${{ runner.os }}-cgreen-${{ inputs.version }}-${{ inputs.compiler }} - restore-keys: | - ${{ runner.os }}-cgreen-${{ matrix.cgreen }}- - - name: Checkout Unit Test framework - if: steps.unit-test-framework.outputs.cache-hit != 'true' - uses: actions/checkout@v3 - with: - repository: cgreen-devs/cgreen - ref: ${{ inputs.version }} - path: cgreen-src - - name: Build Unit Test framework (${{ runner.os }} ${{ inputs.compiler }}) - if: steps.unit-test-framework.outputs.cache-hit != 'true' - shell: bash - env: - CC: ${{ matrix.compiler }} - CXX: "${{ inputs.compiler == 'clang' && 'clang++' || 'g++' }}" - run: | - cd cgreen-src - mkdir -p build - cd build - cmake -E env LDFLAGS="-lm" cmake .. - make -j2 - cd "$GITHUB_WORKSPACE" - mkdir -p cgreen - mv cgreen-src/build cgreen/build - mv cgreen-src/include cgreen/include - rm -rf cgreen-src \ No newline at end of file diff --git a/.github/workflows/reusable-unit-integration-tests-runner.yml b/.github/workflows/reusable-unit-integration-tests-runner.yml deleted file mode 100644 index 04473b41..00000000 --- a/.github/workflows/reusable-unit-integration-tests-runner.yml +++ /dev/null @@ -1,96 +0,0 @@ -on: - workflow_call: - inputs: - os: - required: true - type: string - version: - required: true - type: string - -jobs: - prepare-unit-test-gcc: - name: Prepare Unit Test framework (${{ inputs.os }} gcc) - uses: pubnub/c-core/.github/workflows/reusable-prepare-unit-test-framework.yml@test/switch-to-actions - with: - os: ${{ inputs.os }} - version: ${{ inputs.version }} - compiler: gcc - secrets: inherit - prepare-unit-test-clang: - name: Prepare Unit Test framework (${{ inputs.os }} clang) - uses: pubnub/c-core/.github/workflows/reusable-prepare-unit-test-framework.yml@test/switch-to-actions - with: - os: ${{ inputs.os }} - version: ${{ inputs.version }} - compiler: clang - secrets: inherit - tests: - name: Run tests - runs-on: ${{ inputs.os }} - needs: [prepare-unit-test-gcc, prepare-unit-test-clang] - steps: - - name: Checkout repository - uses: actions/checkout@v3 - with: - token: ${{ secrets.GH_TOKEN }} - - name: Pull Unit Test framework (${{ runner.os }} gcc) - uses: actions/cache@v3 - with: - path: | - cgreen - key: ${{ runner.os }}-cgreen-${{ inputs.version }}-gcc - restore-keys: | - ${{ runner.os }}-cgreen-${{ inputs.version }}- - - name: Run unit tests (${{ runner.os }} gcc) - shell: bash - env: - CC: gcc - CXX: "g++" - run: | - cd "$GITHUB_WORKSPACE/core" - make generate_report - cd "$GITHUB_WORKSPACE/lib" - make generate_report - - name: Run integration tests (${{ runner.os }} gcc) - shell: bash - env: - CC: gcc - CXX: "g++" - run: | - cd "$GITHUB_WORKSPACE" - make -f posix.mk - posix/pubnub_fntest - openssl/pubnub_fntest - cpp/fntest_runner - cpp/openssl/fntest_runner - - name: Pull Unit Test framework (${{ runner.os }} clang) - uses: actions/cache@v3 - with: - path: | - cgreen - key: ${{ runner.os }}-cgreen-${{ inputs.version }}-clang - restore-keys: | - ${{ runner.os }}-cgreen-${{ inputs.version }}- - - name: Run unit tests (${{ runner.os }} clang) - shell: bash - env: - CC: clang - CXX: "clang++" - run: | - cd "$GITHUB_WORKSPACE/core" - make generate_report - cd "$GITHUB_WORKSPACE/lib" - make generate_report - - name: Run integration tests (${{ runner.os }} clang) - shell: bash - env: - CC: clang - CXX: "clang++" - run: | - cd "$GITHUB_WORKSPACE" - make -f posix.mk - posix/pubnub_fntest - openssl/pubnub_fntest - cpp/fntest_runner - cpp/openssl/fntest_runner \ No newline at end of file diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index c6003a72..64c1b156 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -11,19 +11,32 @@ on: jobs: tests-ubuntu: - name: Integration and Unit tests - uses: pubnub/c-core/.github/workflows/reusable-unit-integration-tests-runner.yml@test/switch-to-actions - with: - os: ubuntu-latest - version: 1.6.0 + name: Integration and Unit tests (Ubuntu) + runs-on: ubuntu-latest + steps: + - name: Checkout project + uses: actions/checkout@v3 + with: + token: ${{ secrets.GH_TOKEN }} + - name: Build and run tests + uses: .github/workflows/composite/unit-integration-test-runner@test/switch-to-actions + with: + os: ubuntu + version: 1.6.0 secrets: inherit tests-macos: - name: Integration and Unit tests - uses: pubnub/c-core/.github/workflows/reusable-unit-integration-tests-runner.yml@test/switch-to-actions - with: - os: macos-latest - version: 1.6.0 - secrets: inherit + name: Integration and Unit tests (macOS) + runs-on: macos-latest + steps: + - name: Checkout project + uses: actions/checkout@v3 + with: + token: ${{ secrets.GH_TOKEN }} + - name: Build and run tests + uses: .github/workflows/composite/unit-integration-test-runner@test/switch-to-actions + with: + os: macos + version: 1.6.0 acceptance: name: Acceptance tests runs-on: ubuntu-latest diff --git a/core/Makefile b/core/Makefile index a201baf3..31cdedc2 100644 --- a/core/Makefile +++ b/core/Makefile @@ -77,4 +77,5 @@ pubnub_proxy_unittest: $(PROJECT_SOURCEFILES) $(PROXY_PROJECT_SOURCEFILES) pubnu #$(GCOVR) -r . --html --html-details -o coverage.html clean: - rm pubnub_core_unit_test.so pubnub_timer_list_unit_test.so pubnub_proxy_unit_test.so *.gcda *.gcno *.html + find . -type d -iname "*.dSYM" -exec rm -rf {} \+ + find . -type f -name "*.so" -o -name "*.gcda" -o -name "*.gcno" -o -name "*.html" | xargs rm diff --git a/cpp/posix.mk b/cpp/posix.mk index 15581a14..326d174d 100644 --- a/cpp/posix.mk +++ b/cpp/posix.mk @@ -171,4 +171,5 @@ fntest_runner: fntest/pubnub_fntest_runner.cpp $(SOURCEFILES) $(SYNC_INTF_SOURCE clean: - rm pubnub_sync_sample pubnub_callback_sample pubnub_callback_cpp11_sample pubnub_callback_subloop_sample pubnub_callback_cpp11_subloop_sample cancel_subscribe_sync_sample subscribe_publish_callback_sample futres_nesting_sync pubnub_sync_subloop_sample futres_nesting_callback futres_nesting_callback_cpp11 fntest_runner *.dSYM + find . -type d -iname "*.dSYM" -exec rm -rf {} \+ + find . -type f ! -name "*.*" -o -name "*.a" -o -name "*.o" | xargs rm diff --git a/cpp/posix_openssl.mk b/cpp/posix_openssl.mk index a9dc8466..ea203c59 100644 --- a/cpp/posix_openssl.mk +++ b/cpp/posix_openssl.mk @@ -191,4 +191,5 @@ openssl/futres_nesting_callback_cpp11: samples/futres_nesting.cpp $(SOURCEFILES) $(CXX) -o $@ --std=c++11 -D PUBNUB_CALLBACK_API $(CFLAGS) $(CFLAGS_CALLBACK) -x c++ samples/futres_nesting.cpp $(CALLBACK_INTF_SOURCEFILES) pubnub_futres_cpp11.cpp $(SOURCEFILES) $(LDLIBS) clean: - rm openssl/pubnub_sync_sample openssl/pubnub_sync_grant_sample openssl/pubnub_callback_sample openssl/pubnub_callback_cpp11_sample openssl/cancel_subscribe_sync_sample openssl/subscribe_publish_callback_sample openssl/futres_nesting_sync openssl/fntest_runner openssl/futres_nesting_callback openssl/futres_nesting_callback_cpp11 *.dSYM + find openssl -type d -iname "*.dSYM" -exec rm -rf {} \+ + find openssl -type f ! -name "*.*" -o -name "*.a" -o -name "*.o" | xargs rm diff --git a/lib/Makefile b/lib/Makefile index 618f0a3e..22158d47 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -40,4 +40,5 @@ pubnub_dns_codec_unit_test: pubnub_dns_codec.c pubnub_dns_codec_unit_test.c $(GCOVR) -r . --html --html-details -o coverage.html clean: - rm pubnub_parse_ipv6_addr_unit_test.so pubnub_dns_codec_unit_test.so *.gcda *.gcno *.html + find . -type d -iname "*.dSYM" -exec rm -rf {} \+ + find . -type f -name "*.so" -o -name "*.gcda" -o -name "*.gcno" -o -name "*.html" | xargs rm diff --git a/openssl/posix.mk b/openssl/posix.mk index 39616c76..958d196c 100644 --- a/openssl/posix.mk +++ b/openssl/posix.mk @@ -241,4 +241,5 @@ pubnub_console_callback: $(CONSOLE_SOURCEFILES) ../core/samples/console/pnc_ops_ clean: - rm pubnub_sync_sample pubnub_sync_grant_token_sample pubnub_sync_revoke_token_sample pubnub_objects_secretkey_sample metadata pubnub_sync_subloop_sample cancel_subscribe_sync_sample pubnub_publish_via_post_sample pubnub_publish_via_post_secretkey_sample pubnub_callback_sample subscribe_publish_callback_sample pubnub_fntest pubnub_console_sync pubnub_console_callback pubnub_crypto_sync_sample pubnub_sync.a pubnub_sync_dynamiciv.a pubnub_callback.a pubnub_callback_subloop_sample subscribe_publish_from_callback publish_callback_subloop_sample publish_queue_callback_subloop *.o *.dSYM + find . -type d -iname "*.dSYM" -exec rm -rf {} \+ + find . -type f ! -name "*.*" -o -name "*.a" -o -name "*.o" | xargs rm diff --git a/posix/posix.mk b/posix/posix.mk index 2fbb76cb..56c22bee 100644 --- a/posix/posix.mk +++ b/posix/posix.mk @@ -201,6 +201,6 @@ pubnub_console_sync: $(CONSOLE_SOURCEFILES) ../core/samples/console/pnc_ops_sync pubnub_console_callback: $(CONSOLE_SOURCEFILES) ../core/samples/console/pnc_ops_callback.c pubnub_callback.a $(CC) -o $@ $(CFLAGS) $(CFLAGS_CALLBACK) -D PUBNUB_CALLBACK_API $(INCLUDES) $(CONSOLE_SOURCEFILES) ../core/samples/console/pnc_ops_callback.c pubnub_callback.a $(LDLIBS) - clean: - rm pubnub_advanced_history_sample pubnub_fetch_history_sample pubnub_sync_sample pubnub_sync_subloop_sample cancel_subscribe_sync_sample pubnub_sync_publish_retry pubnub_publish_via_post_sample pubnub_callback_sample pubnub_callback_subloop_sample subscribe_publish_callback_sample pubnub_fntest pubnub_console_sync pubnub_console_callback pubnub_sync.a pubnub_callback.a subscribe_publish_from_callback publish_callback_subloop_sample publish_queue_callback_subloop *.o *.dSYM + find . -type d -iname "*.dSYM" -exec rm -rf {} \+ + find . -type f ! -name "*.*" -o -name "*.a" -o -name "*.o" | xargs rm From 9abdf0acb33a4151bc6fca027e2e4fd7f22172f0 Mon Sep 17 00:00:00 2001 From: Serhii Mamontov Date: Thu, 1 Dec 2022 18:54:37 +0100 Subject: [PATCH 26/40] fix(github-actions): remove redundant 'secrets' field from job top level --- .github/workflows/run-tests.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 64c1b156..c2f837bc 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -23,7 +23,6 @@ jobs: with: os: ubuntu version: 1.6.0 - secrets: inherit tests-macos: name: Integration and Unit tests (macOS) runs-on: macos-latest From 823dcfc70dceb6a9a3be4f2f5261b867cc2d3516 Mon Sep 17 00:00:00 2001 From: Serhii Mamontov Date: Thu, 1 Dec 2022 18:56:20 +0100 Subject: [PATCH 27/40] fix(github-actions): fix paths to local actions --- .../composite/unit-integration-test-runner/action.yaml | 2 +- .github/workflows/run-tests.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/composite/unit-integration-test-runner/action.yaml b/.github/workflows/composite/unit-integration-test-runner/action.yaml index d5258e93..0673f69e 100644 --- a/.github/workflows/composite/unit-integration-test-runner/action.yaml +++ b/.github/workflows/composite/unit-integration-test-runner/action.yaml @@ -14,7 +14,7 @@ runs: using: "composite" steps: - name: Pull Unit Test framework ('${{ inputs.os }}' gcc, clang) - uses: .github/workflows/composite/unit-test-framework@test/switch-to-actions + uses: ./.github/workflows/composite/unit-test-framework with: os: ${{ inputs.os }} version: ${{ inputs.version }} diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index c2f837bc..b09f783e 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -19,7 +19,7 @@ jobs: with: token: ${{ secrets.GH_TOKEN }} - name: Build and run tests - uses: .github/workflows/composite/unit-integration-test-runner@test/switch-to-actions + uses: ./.github/workflows/composite/unit-integration-test-runner with: os: ubuntu version: 1.6.0 @@ -32,7 +32,7 @@ jobs: with: token: ${{ secrets.GH_TOKEN }} - name: Build and run tests - uses: .github/workflows/composite/unit-integration-test-runner@test/switch-to-actions + uses: ./.github/workflows/composite/unit-integration-test-runner with: os: macos version: 1.6.0 From fae5252e7cb3d8b643e2ad66e52e6c344ce034c3 Mon Sep 17 00:00:00 2001 From: Serhii Mamontov Date: Thu, 1 Dec 2022 18:59:40 +0100 Subject: [PATCH 28/40] fix(github-actions): fix YML syntax --- .../composite/unit-integration-test-runner/action.yaml | 2 +- .github/workflows/composite/unit-test-framework/action.yaml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/composite/unit-integration-test-runner/action.yaml b/.github/workflows/composite/unit-integration-test-runner/action.yaml index 0673f69e..3a58b3a8 100644 --- a/.github/workflows/composite/unit-integration-test-runner/action.yaml +++ b/.github/workflows/composite/unit-integration-test-runner/action.yaml @@ -7,7 +7,7 @@ inputs: description: Environment in which framework should be built. required: true version: - description: "Which version of 'cgreen' should be built". + description: "Which version of 'cgreen' should be built." required: true runs: diff --git a/.github/workflows/composite/unit-test-framework/action.yaml b/.github/workflows/composite/unit-test-framework/action.yaml index ad4270d7..cc86894d 100644 --- a/.github/workflows/composite/unit-test-framework/action.yaml +++ b/.github/workflows/composite/unit-test-framework/action.yaml @@ -7,10 +7,10 @@ inputs: description: Environment in which framework should be built. required: true version: - description: "Which version of 'cgreen' should be built". + description: "Which version of 'cgreen' should be built." required: true compilers: - description: "Coma-separated list of currently supported C compilers to be used during build (gcc, clang)". + description: "Coma-separated list of currently supported C compilers to be used during build (gcc, clang)." required: true runs: From 5ae7f4d4635c180ba1220da81d0f5675d3fcb1f7 Mon Sep 17 00:00:00 2001 From: Serhii Mamontov Date: Thu, 1 Dec 2022 19:01:58 +0100 Subject: [PATCH 29/40] fix(github-actions): return missing clone step --- .../workflows/composite/unit-test-framework/action.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/composite/unit-test-framework/action.yaml b/.github/workflows/composite/unit-test-framework/action.yaml index cc86894d..e0114ddc 100644 --- a/.github/workflows/composite/unit-test-framework/action.yaml +++ b/.github/workflows/composite/unit-test-framework/action.yaml @@ -25,6 +25,13 @@ runs: key: ${{ inputs.os }}-cgreen-${{ inputs.version }}-1 restore-keys: | ${{ inputs.os }}-cgreen-${{ inputs.version }}- + - name: Checkout Unit Test framework + if: steps.unit-test-framework.outputs.cache-hit != 'true' + uses: actions/checkout@v3 + with: + repository: cgreen-devs/cgreen + ref: ${{ matrix.cgreen }} + path: cgreen - name: Build Unit Test frameworks if: steps.unit-test-framework.outputs.cache-hit != 'true' shell: bash From 4d6a5e40809857852deace5980e52117535e2bb4 Mon Sep 17 00:00:00 2001 From: Serhii Mamontov Date: Thu, 1 Dec 2022 19:18:43 +0100 Subject: [PATCH 30/40] debug(github-actions): added directories content output --- .../unit-test-framework/build-framework.sh | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/.github/workflows/composite/unit-test-framework/build-framework.sh b/.github/workflows/composite/unit-test-framework/build-framework.sh index 1a0e6118..ca5717f5 100755 --- a/.github/workflows/composite/unit-test-framework/build-framework.sh +++ b/.github/workflows/composite/unit-test-framework/build-framework.sh @@ -1,12 +1,11 @@ #!/bin/bash -echo "'$0'" -echo "'$1'" -echo "'$2'" - # Identify make tool which depends from environment. [[ $1 =~ (ubuntu|macos) ]] && MAKE_TOOL=make || MAKE_TOOL=$(MAKE) +echo "BEFORE:" +ls -la "$GITHUB_WORKSPACE" + # Iterating over list of passed compilers. for compiler in ${2//,/ } do @@ -25,8 +24,14 @@ do fi echo "::debug title=cgreen::Prepare folders structure" - ! [[ -d "$GITHUB_WORKSPACE/cgreen-tmp/$compiler" ]] && - mkdir -p "$GITHUB_WORKSPACE/cgreen-tmp/$compiler" + if ! [[ -d "$GITHUB_WORKSPACE/cgreen-tmp/$compiler" ]]; then + echo "$GITHUB_WORKSPACE/cgreen-tmp/$compiler DOESN'T EXISTS. CREATE" + mkdir -p "$GITHUB_WORKSPACE/cgreen-tmp/$compiler" + echo "COMPILER FOLDER CREATE:" + ls -la "$GITHUB_WORKSPACE" + echo "COMPILER FOLDER INSIDE:" + ls -la "$GITHUB_WORKSPACE/cgreen-tmp" + fi mkdir -p build && cd build # Enable 'gcov' only for build on Ubuntu. @@ -54,6 +59,9 @@ do echo "::endgroup::" done +echo "AFTER:" +ls -la "$GITHUB_WORKSPACE" + echo "::debug title=cgreen::Prepare files for caching" rm -rf cgreen mv cgreen-tmp cgreen \ No newline at end of file From b105c8dbfecb3450c15969631fba9684d326e9c0 Mon Sep 17 00:00:00 2001 From: Serhii Mamontov Date: Thu, 1 Dec 2022 19:22:59 +0100 Subject: [PATCH 31/40] fix(github-actions): bash script folder copy path --- .../unit-test-framework/build-framework.sh | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/.github/workflows/composite/unit-test-framework/build-framework.sh b/.github/workflows/composite/unit-test-framework/build-framework.sh index ca5717f5..a4787492 100755 --- a/.github/workflows/composite/unit-test-framework/build-framework.sh +++ b/.github/workflows/composite/unit-test-framework/build-framework.sh @@ -3,9 +3,6 @@ # Identify make tool which depends from environment. [[ $1 =~ (ubuntu|macos) ]] && MAKE_TOOL=make || MAKE_TOOL=$(MAKE) -echo "BEFORE:" -ls -la "$GITHUB_WORKSPACE" - # Iterating over list of passed compilers. for compiler in ${2//,/ } do @@ -24,14 +21,8 @@ do fi echo "::debug title=cgreen::Prepare folders structure" - if ! [[ -d "$GITHUB_WORKSPACE/cgreen-tmp/$compiler" ]]; then - echo "$GITHUB_WORKSPACE/cgreen-tmp/$compiler DOESN'T EXISTS. CREATE" + ! [[ -d "$GITHUB_WORKSPACE/cgreen-tmp/$compiler" ]] && mkdir -p "$GITHUB_WORKSPACE/cgreen-tmp/$compiler" - echo "COMPILER FOLDER CREATE:" - ls -la "$GITHUB_WORKSPACE" - echo "COMPILER FOLDER INSIDE:" - ls -la "$GITHUB_WORKSPACE/cgreen-tmp" - fi mkdir -p build && cd build # Enable 'gcov' only for build on Ubuntu. @@ -59,9 +50,6 @@ do echo "::endgroup::" done -echo "AFTER:" -ls -la "$GITHUB_WORKSPACE" - echo "::debug title=cgreen::Prepare files for caching" rm -rf cgreen -mv cgreen-tmp cgreen \ No newline at end of file +mv "$GITHUB_WORKSPACE/cgreen-tmp" "$GITHUB_WORKSPACE/cgreen" \ No newline at end of file From b7a5ed294529e9671d4b7ef383fbbf89805f6544 Mon Sep 17 00:00:00 2001 From: Serhii Mamontov Date: Thu, 1 Dec 2022 19:27:41 +0100 Subject: [PATCH 32/40] debug(github-actions): added directories content output --- .../composite/unit-integration-test-runner/action.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/composite/unit-integration-test-runner/action.yaml b/.github/workflows/composite/unit-integration-test-runner/action.yaml index 3a58b3a8..50f21957 100644 --- a/.github/workflows/composite/unit-integration-test-runner/action.yaml +++ b/.github/workflows/composite/unit-integration-test-runner/action.yaml @@ -22,8 +22,12 @@ runs: - name: Prepare Unit Test framework ('${{ inputs.os }}' gcc) shell: bash run: | + ls -la "$GITHUB_WORKSPACE" + ls -la "$GITHUB_WORKSPACE/cgreen" mv "$GITHUB_WORKSPACE/cgreen" "$GITHUB_WORKSPACE/cgreen-universal" - cp -r "$GITHUB_WORKSPACE/cgreen-universal/gcc" "$GITHUB_WORKSPACE/cgreen-universal/cgreen" + ls -la "$GITHUB_WORKSPACE/cgreen-universal" + cp -r "$GITHUB_WORKSPACE/cgreen-universal/gcc" "$GITHUB_WORKSPACE/cgreen" + ls -la "$GITHUB_WORKSPACE/cgreen" - name: Run unit tests ('${{ inputs.os }}' gcc) shell: bash env: From 70a477b60f736fe4c61c3f6df0dba8e124250dc8 Mon Sep 17 00:00:00 2001 From: Serhii Mamontov Date: Thu, 1 Dec 2022 19:32:44 +0100 Subject: [PATCH 33/40] debug(github-actions): added directories content output --- .../composite/unit-test-framework/build-framework.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/composite/unit-test-framework/build-framework.sh b/.github/workflows/composite/unit-test-framework/build-framework.sh index a4787492..2c8537e5 100755 --- a/.github/workflows/composite/unit-test-framework/build-framework.sh +++ b/.github/workflows/composite/unit-test-framework/build-framework.sh @@ -50,6 +50,12 @@ do echo "::endgroup::" done +ls -la "$GITHUB_WORKSPACE" +ls -la "$GITHUB_WORKSPACE/cgreen" +ls -la "$GITHUB_WORKSPACE/cgreen-tmp" + echo "::debug title=cgreen::Prepare files for caching" rm -rf cgreen -mv "$GITHUB_WORKSPACE/cgreen-tmp" "$GITHUB_WORKSPACE/cgreen" \ No newline at end of file +mv "$GITHUB_WORKSPACE/cgreen-tmp" "$GITHUB_WORKSPACE/cgreen" +ls -la "$GITHUB_WORKSPACE/cgreen" +echo "--------------------" \ No newline at end of file From 5f29d91df91f6d6797885846549cf59e3a123306 Mon Sep 17 00:00:00 2001 From: Serhii Mamontov Date: Thu, 1 Dec 2022 19:35:22 +0100 Subject: [PATCH 34/40] debug(github-actions): remove debug information --- .../composite/unit-integration-test-runner/action.yaml | 4 ---- .../composite/unit-test-framework/build-framework.sh | 10 ++-------- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/.github/workflows/composite/unit-integration-test-runner/action.yaml b/.github/workflows/composite/unit-integration-test-runner/action.yaml index 50f21957..7b0ad05d 100644 --- a/.github/workflows/composite/unit-integration-test-runner/action.yaml +++ b/.github/workflows/composite/unit-integration-test-runner/action.yaml @@ -22,12 +22,8 @@ runs: - name: Prepare Unit Test framework ('${{ inputs.os }}' gcc) shell: bash run: | - ls -la "$GITHUB_WORKSPACE" - ls -la "$GITHUB_WORKSPACE/cgreen" mv "$GITHUB_WORKSPACE/cgreen" "$GITHUB_WORKSPACE/cgreen-universal" - ls -la "$GITHUB_WORKSPACE/cgreen-universal" cp -r "$GITHUB_WORKSPACE/cgreen-universal/gcc" "$GITHUB_WORKSPACE/cgreen" - ls -la "$GITHUB_WORKSPACE/cgreen" - name: Run unit tests ('${{ inputs.os }}' gcc) shell: bash env: diff --git a/.github/workflows/composite/unit-test-framework/build-framework.sh b/.github/workflows/composite/unit-test-framework/build-framework.sh index 2c8537e5..a11f2b34 100755 --- a/.github/workflows/composite/unit-test-framework/build-framework.sh +++ b/.github/workflows/composite/unit-test-framework/build-framework.sh @@ -50,12 +50,6 @@ do echo "::endgroup::" done -ls -la "$GITHUB_WORKSPACE" -ls -la "$GITHUB_WORKSPACE/cgreen" -ls -la "$GITHUB_WORKSPACE/cgreen-tmp" - echo "::debug title=cgreen::Prepare files for caching" -rm -rf cgreen -mv "$GITHUB_WORKSPACE/cgreen-tmp" "$GITHUB_WORKSPACE/cgreen" -ls -la "$GITHUB_WORKSPACE/cgreen" -echo "--------------------" \ No newline at end of file +rm -rf "$GITHUB_WORKSPACE/cgreen" +mv "$GITHUB_WORKSPACE/cgreen-tmp" "$GITHUB_WORKSPACE/cgreen" \ No newline at end of file From 6303c9523f5b5c8b69a82bdb030f5668d474a728 Mon Sep 17 00:00:00 2001 From: Serhii Mamontov Date: Thu, 1 Dec 2022 19:42:22 +0100 Subject: [PATCH 35/40] fix(build): fix 'rm' calls with 'find' in 'clean' target --- core/Makefile | 2 +- cpp/posix.mk | 2 +- cpp/posix_openssl.mk | 2 +- lib/Makefile | 2 +- openssl/posix.mk | 2 +- posix/posix.mk | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/core/Makefile b/core/Makefile index 31cdedc2..abc0ba3b 100644 --- a/core/Makefile +++ b/core/Makefile @@ -78,4 +78,4 @@ pubnub_proxy_unittest: $(PROJECT_SOURCEFILES) $(PROXY_PROJECT_SOURCEFILES) pubnu clean: find . -type d -iname "*.dSYM" -exec rm -rf {} \+ - find . -type f -name "*.so" -o -name "*.gcda" -o -name "*.gcno" -o -name "*.html" | xargs rm + find . -type f -name "*.so" -o -name "*.gcda" -o -name "*.gcno" -o -name "*.html" | xargs -r rm -rf diff --git a/cpp/posix.mk b/cpp/posix.mk index 326d174d..053d9420 100644 --- a/cpp/posix.mk +++ b/cpp/posix.mk @@ -172,4 +172,4 @@ fntest_runner: fntest/pubnub_fntest_runner.cpp $(SOURCEFILES) $(SYNC_INTF_SOURCE clean: find . -type d -iname "*.dSYM" -exec rm -rf {} \+ - find . -type f ! -name "*.*" -o -name "*.a" -o -name "*.o" | xargs rm + find . -type f ! -name "*.*" -o -name "*.a" -o -name "*.o" | xargs -r rm -rf diff --git a/cpp/posix_openssl.mk b/cpp/posix_openssl.mk index ea203c59..56a2f3c0 100644 --- a/cpp/posix_openssl.mk +++ b/cpp/posix_openssl.mk @@ -192,4 +192,4 @@ openssl/futres_nesting_callback_cpp11: samples/futres_nesting.cpp $(SOURCEFILES) clean: find openssl -type d -iname "*.dSYM" -exec rm -rf {} \+ - find openssl -type f ! -name "*.*" -o -name "*.a" -o -name "*.o" | xargs rm + find openssl -type f ! -name "*.*" -o -name "*.a" -o -name "*.o" | xargs -r rm -rf diff --git a/lib/Makefile b/lib/Makefile index 22158d47..bc725511 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -41,4 +41,4 @@ pubnub_dns_codec_unit_test: pubnub_dns_codec.c pubnub_dns_codec_unit_test.c clean: find . -type d -iname "*.dSYM" -exec rm -rf {} \+ - find . -type f -name "*.so" -o -name "*.gcda" -o -name "*.gcno" -o -name "*.html" | xargs rm + find . -type f -name "*.so" -o -name "*.gcda" -o -name "*.gcno" -o -name "*.html" | xargs -r rm -rf diff --git a/openssl/posix.mk b/openssl/posix.mk index 958d196c..235cd2af 100644 --- a/openssl/posix.mk +++ b/openssl/posix.mk @@ -242,4 +242,4 @@ pubnub_console_callback: $(CONSOLE_SOURCEFILES) ../core/samples/console/pnc_ops_ clean: find . -type d -iname "*.dSYM" -exec rm -rf {} \+ - find . -type f ! -name "*.*" -o -name "*.a" -o -name "*.o" | xargs rm + find . -type f ! -name "*.*" -o -name "*.a" -o -name "*.o" | xargs -r rm -rf -rf diff --git a/posix/posix.mk b/posix/posix.mk index 56c22bee..9b915dff 100644 --- a/posix/posix.mk +++ b/posix/posix.mk @@ -203,4 +203,4 @@ pubnub_console_callback: $(CONSOLE_SOURCEFILES) ../core/samples/console/pnc_ops_ clean: find . -type d -iname "*.dSYM" -exec rm -rf {} \+ - find . -type f ! -name "*.*" -o -name "*.a" -o -name "*.o" | xargs rm + find . -type f ! -name "*.*" -o -name "*.a" -o -name "*.o" | xargs -r rm -rf From fbea70df44d19b7279a7c8571f13e2fe5878ec49 Mon Sep 17 00:00:00 2001 From: Serhii Mamontov Date: Fri, 2 Dec 2022 08:37:42 +0100 Subject: [PATCH 36/40] fix(github-actions): pass secrets properly to composite action --- .../unit-integration-test-runner/action.yaml | 30 ++++++++++++++++++- .../unit-test-framework/build-framework.sh | 18 +++++------ .github/workflows/run-tests.yml | 4 +++ 3 files changed, 42 insertions(+), 10 deletions(-) diff --git a/.github/workflows/composite/unit-integration-test-runner/action.yaml b/.github/workflows/composite/unit-integration-test-runner/action.yaml index 7b0ad05d..661a5511 100644 --- a/.github/workflows/composite/unit-integration-test-runner/action.yaml +++ b/.github/workflows/composite/unit-integration-test-runner/action.yaml @@ -9,10 +9,21 @@ inputs: version: description: "Which version of 'cgreen' should be built." required: true + pubNubPubKey: + description: "PubNub publish keys which should be used with integration tests" + required: true + pubNubSubKey: + description: "PubNub subscribe keys which should be used with integration tests" + required: true runs: using: "composite" steps: + - name: Prepare environments + shell: bash + run: | + echo "PUBNUB_PUBKEY=${{ inputs.pubNubPubKey }}" >> $GITHUB_ENV + echo "PUBNUB_KEYSUB=${{ inputs.pubNubSubKey }}" >> $GITHUB_ENV - name: Pull Unit Test framework ('${{ inputs.os }}' gcc, clang) uses: ./.github/workflows/composite/unit-test-framework with: @@ -44,7 +55,15 @@ runs: run: | echo "::group::Run integration tests ('${{ inputs.os }}' gcc)" cd "$GITHUB_WORKSPACE" - make -f posix.mk clean all + + if ! build="$(make -f posix.mk clean all 2>&1)"; then + echo "::error file=posix.mk::Unable to build test suite: $build" + exit 1 + fi + [[ "$build" =~ "deprecated" ]] && echo "::warning title=deprecated::There is deprecated functions used in code." + [[ "$build" =~ "not used" ]] && echo "::warning title=unused::There is unused variables and / or functions in code." + echo "::debug title=build log::Integration tests build log: $build" + posix/pubnub_fntest openssl/pubnub_fntest cpp/fntest_runner @@ -75,6 +94,15 @@ runs: run: | echo "::group::Run integration tests ('${{ inputs.os }}' clang)" cd "$GITHUB_WORKSPACE" + + if ! build="$(make -f posix.mk clean all 2>&1)"; then + echo "::error file=posix.mk::Unable to build test suite: $build" + exit 1 + fi + [[ "$build" =~ "deprecated" ]] && echo "::warning title=deprecated::There is deprecated functions used in code." + [[ "$build" =~ "not used" ]] && echo "::warning title=unused::There is unused variables and / or functions in code." + echo "::debug title=build log::Integration tests build log: $build" + make -f posix.mk clean all posix/pubnub_fntest openssl/pubnub_fntest diff --git a/.github/workflows/composite/unit-test-framework/build-framework.sh b/.github/workflows/composite/unit-test-framework/build-framework.sh index a11f2b34..be419dea 100755 --- a/.github/workflows/composite/unit-test-framework/build-framework.sh +++ b/.github/workflows/composite/unit-test-framework/build-framework.sh @@ -17,10 +17,10 @@ do export CC="$compiler" [[ $compiler == "gcc" ]] && export CXX="g++" || export CXX="$compiler++" else - echo "::notice::Here should be some setup for Windows compiler" + echo "::warning title=compiler flags::Here should be some setup for Windows compiler" fi - echo "::debug title=cgreen::Prepare folders structure" + echo "::notice title=cgreen::Prepare folders structure" ! [[ -d "$GITHUB_WORKSPACE/cgreen-tmp/$compiler" ]] && mkdir -p "$GITHUB_WORKSPACE/cgreen-tmp/$compiler" mkdir -p build && cd build @@ -28,20 +28,20 @@ do # Enable 'gcov' only for build on Ubuntu. [[ "$1" == "ubuntu" ]] && WITH_GCOV=ON || WITH_GCOV=OFF if [[ "$WITH_GCOV" == ON ]]; then - echo "::debug title=gcov::Installing 'gcov' for code coverage." + echo "::notice title=gcov::Installing 'gcov' for code coverage." pip install --user gcovr else - echo "::notice title=gcov::'gcov' doesn't work as expected on $1." - echo "::notice title=gcov::Configure 'cgreen' without 'gcov' support" + echo "::warning title=gcov::'gcov' doesn't work as expected on $1." + echo "::warning title=gcov::Configure 'cgreen' without 'gcov' support" fi - echo "::debug title=cgreen::Configure 'cgreen' build" + echo "::notice title=cgreen::Configure 'cgreen' build" cmake -E env LDFLAGS="-lm" cmake -DCGREEN_INTERNAL_WITH_GCOV:BOOL=$WITH_GCOV .. - echo "::debug title=cgreen::Build 'cgreen' framework" + echo "::notice title=cgreen::Build 'cgreen' framework" make -j2 - echo "::debug::Move built results to compiler specific colder" + echo "::notice::Move built results to compiler specific colder" mv "$GITHUB_WORKSPACE/cgreen/build" "$GITHUB_WORKSPACE/cgreen-tmp/$compiler/build" cp -r "$GITHUB_WORKSPACE/cgreen/include" "$GITHUB_WORKSPACE/cgreen-tmp/$compiler/include" @@ -50,6 +50,6 @@ do echo "::endgroup::" done -echo "::debug title=cgreen::Prepare files for caching" +echo "::notice title=cgreen::Prepare files for caching" rm -rf "$GITHUB_WORKSPACE/cgreen" mv "$GITHUB_WORKSPACE/cgreen-tmp" "$GITHUB_WORKSPACE/cgreen" \ No newline at end of file diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index b09f783e..305aaa80 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -23,6 +23,8 @@ jobs: with: os: ubuntu version: 1.6.0 + pubNubPubKey: ${{ secrets.PUBNUB_PUBKEY }} + pubNubSubKey: ${{ secrets.PUBNUB_KEYSUB }} tests-macos: name: Integration and Unit tests (macOS) runs-on: macos-latest @@ -36,6 +38,8 @@ jobs: with: os: macos version: 1.6.0 + pubNubPubKey: ${{ secrets.PUBNUB_PUBKEY }} + pubNubSubKey: ${{ secrets.PUBNUB_KEYSUB }} acceptance: name: Acceptance tests runs-on: ubuntu-latest From f37e6d391b3687853bc255373cc20a2c0b90032c Mon Sep 17 00:00:00 2001 From: Serhii Mamontov Date: Fri, 2 Dec 2022 17:23:52 +0100 Subject: [PATCH 37/40] refactor(github-actions): move code from action to files Move unit / integration test suite calling code from action into corresponding bash files. --- .../unit-integration-test-runner/action.yaml | 53 ++----------------- .../run-integration-tests.sh | 37 +++++++++++++ .../run-unit-tests.sh | 8 +++ .../unit-test-framework/build-framework.sh | 6 ++- 4 files changed, 54 insertions(+), 50 deletions(-) create mode 100755 .github/workflows/composite/unit-integration-test-runner/run-integration-tests.sh create mode 100755 .github/workflows/composite/unit-integration-test-runner/run-unit-tests.sh diff --git a/.github/workflows/composite/unit-integration-test-runner/action.yaml b/.github/workflows/composite/unit-integration-test-runner/action.yaml index 661a5511..84ef9968 100644 --- a/.github/workflows/composite/unit-integration-test-runner/action.yaml +++ b/.github/workflows/composite/unit-integration-test-runner/action.yaml @@ -40,35 +40,13 @@ runs: env: CC: gcc CXX: "g++" - run: | - echo "::group::Run unit tests ('${{ inputs.os }}' gcc)" - cd "$GITHUB_WORKSPACE/core" - make clean generate_report - cd "$GITHUB_WORKSPACE/lib" - make clean generate_report - echo "::endgroup::" + run: .github/workflows/composite/unit-integration-test-runner/run-unit-tests.sh - name: Run integration tests ('${{ inputs.os }}' gcc) shell: bash env: CC: gcc CXX: "g++" - run: | - echo "::group::Run integration tests ('${{ inputs.os }}' gcc)" - cd "$GITHUB_WORKSPACE" - - if ! build="$(make -f posix.mk clean all 2>&1)"; then - echo "::error file=posix.mk::Unable to build test suite: $build" - exit 1 - fi - [[ "$build" =~ "deprecated" ]] && echo "::warning title=deprecated::There is deprecated functions used in code." - [[ "$build" =~ "not used" ]] && echo "::warning title=unused::There is unused variables and / or functions in code." - echo "::debug title=build log::Integration tests build log: $build" - - posix/pubnub_fntest - openssl/pubnub_fntest - cpp/fntest_runner - cpp/openssl/fntest_runner - echo "::endgroup::" + run: .github/workflows/composite/unit-integration-test-runner/run-integration-tests.sh ${{ inputs.os }} - name: Prepare Unit Test framework ('${{ inputs.os }}' clang) shell: bash run: | @@ -79,36 +57,13 @@ runs: env: CC: clang CXX: "clang++" - run: | - echo "::group::Run unit tests ('${{ inputs.os }}' clang)" - cd "$GITHUB_WORKSPACE/core" - make clean generate_report - cd "$GITHUB_WORKSPACE/lib" - make clean generate_report - echo "::endgroup::" + run: .github/workflows/composite/unit-integration-test-runner/run-unit-tests.sh - name: Run integration tests ('${{ inputs.os }}' clang) shell: bash env: CC: clang CXX: "clang++" - run: | - echo "::group::Run integration tests ('${{ inputs.os }}' clang)" - cd "$GITHUB_WORKSPACE" - - if ! build="$(make -f posix.mk clean all 2>&1)"; then - echo "::error file=posix.mk::Unable to build test suite: $build" - exit 1 - fi - [[ "$build" =~ "deprecated" ]] && echo "::warning title=deprecated::There is deprecated functions used in code." - [[ "$build" =~ "not used" ]] && echo "::warning title=unused::There is unused variables and / or functions in code." - echo "::debug title=build log::Integration tests build log: $build" - - make -f posix.mk clean all - posix/pubnub_fntest - openssl/pubnub_fntest - cpp/fntest_runner - cpp/openssl/fntest_runner - echo "::endgroup::" + run: .github/workflows/composite/unit-integration-test-runner/run-integration-tests.sh ${{ inputs.os }} - name: Restore Unit Test framework ('${{ inputs.os }}' gcc,clang) shell: bash run: | diff --git a/.github/workflows/composite/unit-integration-test-runner/run-integration-tests.sh b/.github/workflows/composite/unit-integration-test-runner/run-integration-tests.sh new file mode 100755 index 00000000..f07c1b88 --- /dev/null +++ b/.github/workflows/composite/unit-integration-test-runner/run-integration-tests.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +INFO_BG="\033[0m\033[48;2;5;49;70m" +INFO_FG="\033[38;2;19;181;255m" +BOLD_INFO_FG="${INFO_FG}\033[1m" +SUCCESS_BG="\033[0m\033[48;2;5;49;70m" +SUCCESS_FG="\033[38;2;19;181;255m" +BOLD_SUCCESS_FG="${SUCCESS_FG}\033[1m" +CLEAR="\033[0m" + +echo "::group::Run integration tests ('$1' $CC / $CXX)" +cd "$GITHUB_WORKSPACE" + +if ! build="$(make -f posix.mk clean all 2>&1)"; then + echo "::error file=posix.mk::Unable to build test suite: $build" + exit 1 +else + echo -e "${SUCCESS_BG}Test suit is built 🎉${CLEAR}" +fi +echo "::debug title=build::Integration tests build log: $build" + +[[ "$build" =~ "deprecated" ]] && echo "::warning title=deprecated::There is deprecated functions used in code." +[[ "$build" =~ "not used" ]] && echo "::warning title=unused::There is unused variables and / or functions in code." + +echo -e "${INFO_BG}${INFO_FG}Running ${BOLD_INFO_FG}POSIX ${INFO_BG}${INFO_FG}integration tests...${CLEAR}" +posix/pubnub_fntest +echo -e "${SUCCESS_BG}${BOLD_SUCCESS_FG}POSIX ${SUCCESS_BG}${SUCCESS_FG}integration tests completed 🎉${CLEAR}" +echo -e "${INFO_BG}${INFO_FG}Running ${BOLD_INFO_FG}OpenSSL ${INFO_BG}${INFO_FG}integration tests${CLEAR}" +openssl/pubnub_fntest +echo -e "${SUCCESS_BG}${BOLD_SUCCESS_FG}POSIX ${SUCCESS_BG}${SUCCESS_FG}integration tests completed 🎉${CLEAR}" +echo -e "${INFO_BG}${INFO_FG}Running ${BOLD_INFO_FG}C++ ${INFO_BG}${INFO_FG}integration tests${CLEAR}" +cpp/fntest_runner +echo -e "${SUCCESS_BG}${BOLD_SUCCESS_FG}POSIX ${SUCCESS_BG}${SUCCESS_FG}integration tests completed 🎉${CLEAR}" +echo -e "${INFO_BG}${INFO_FG}Running ${BOLD_INFO_FG}C++ OpenSSL ${INFO_BG}${INFO_FG}integration tests${CLEAR}" +cpp/openssl/fntest_runner +echo -e "${SUCCESS_BG}${BOLD_SUCCESS_FG}POSIX ${SUCCESS_BG}${SUCCESS_FG}integration tests completed 🎉${CLEAR}" +echo "::endgroup::" diff --git a/.github/workflows/composite/unit-integration-test-runner/run-unit-tests.sh b/.github/workflows/composite/unit-integration-test-runner/run-unit-tests.sh new file mode 100755 index 00000000..cd858dbf --- /dev/null +++ b/.github/workflows/composite/unit-integration-test-runner/run-unit-tests.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +echo "::group::Run unit tests ('${{ inputs.os }}' gcc)" +cd "$GITHUB_WORKSPACE/core" +make clean generate_report +cd "$GITHUB_WORKSPACE/lib" +make clean generate_report +echo "::endgroup::" \ No newline at end of file diff --git a/.github/workflows/composite/unit-test-framework/build-framework.sh b/.github/workflows/composite/unit-test-framework/build-framework.sh index be419dea..2325792f 100755 --- a/.github/workflows/composite/unit-test-framework/build-framework.sh +++ b/.github/workflows/composite/unit-test-framework/build-framework.sh @@ -29,7 +29,11 @@ do [[ "$1" == "ubuntu" ]] && WITH_GCOV=ON || WITH_GCOV=OFF if [[ "$WITH_GCOV" == ON ]]; then echo "::notice title=gcov::Installing 'gcov' for code coverage." - pip install --user gcovr + if ! install="$(pip install --user gcovr)"; then + echo "::error title=gcov::Unable to install 'gcov':$install" + else + echo "::notice title=gcov::Installing 'gcov' for code coverage." + fi else echo "::warning title=gcov::'gcov' doesn't work as expected on $1." echo "::warning title=gcov::Configure 'cgreen' without 'gcov' support" From 12a8e1f9651b8258baa56e6d97c89e91ccfef282 Mon Sep 17 00:00:00 2001 From: Serhii Mamontov Date: Fri, 2 Dec 2022 17:29:53 +0100 Subject: [PATCH 38/40] refactor(github-actions): remove debug build output because it always printed --- .../unit-integration-test-runner/run-integration-tests.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/composite/unit-integration-test-runner/run-integration-tests.sh b/.github/workflows/composite/unit-integration-test-runner/run-integration-tests.sh index f07c1b88..2ba70ec2 100755 --- a/.github/workflows/composite/unit-integration-test-runner/run-integration-tests.sh +++ b/.github/workflows/composite/unit-integration-test-runner/run-integration-tests.sh @@ -17,7 +17,6 @@ if ! build="$(make -f posix.mk clean all 2>&1)"; then else echo -e "${SUCCESS_BG}Test suit is built 🎉${CLEAR}" fi -echo "::debug title=build::Integration tests build log: $build" [[ "$build" =~ "deprecated" ]] && echo "::warning title=deprecated::There is deprecated functions used in code." [[ "$build" =~ "not used" ]] && echo "::warning title=unused::There is unused variables and / or functions in code." From e6724b0cefb71ad2be7b72c16d4b1aeed2b02d44 Mon Sep 17 00:00:00 2001 From: Serhii Mamontov Date: Fri, 2 Dec 2022 18:04:54 +0100 Subject: [PATCH 39/40] fix(github-actions): fix echo bad substitution error --- .../unit-integration-test-runner/run-integration-tests.sh | 4 ++-- .../composite/unit-integration-test-runner/run-unit-tests.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/composite/unit-integration-test-runner/run-integration-tests.sh b/.github/workflows/composite/unit-integration-test-runner/run-integration-tests.sh index 2ba70ec2..a89779a3 100755 --- a/.github/workflows/composite/unit-integration-test-runner/run-integration-tests.sh +++ b/.github/workflows/composite/unit-integration-test-runner/run-integration-tests.sh @@ -3,8 +3,8 @@ INFO_BG="\033[0m\033[48;2;5;49;70m" INFO_FG="\033[38;2;19;181;255m" BOLD_INFO_FG="${INFO_FG}\033[1m" -SUCCESS_BG="\033[0m\033[48;2;5;49;70m" -SUCCESS_FG="\033[38;2;19;181;255m" +SUCCESS_BG="\033[0m\033[48;2;30;69;1m" +SUCCESS_FG="\033[38;2;95;215;0m" BOLD_SUCCESS_FG="${SUCCESS_FG}\033[1m" CLEAR="\033[0m" diff --git a/.github/workflows/composite/unit-integration-test-runner/run-unit-tests.sh b/.github/workflows/composite/unit-integration-test-runner/run-unit-tests.sh index cd858dbf..0da15bf5 100755 --- a/.github/workflows/composite/unit-integration-test-runner/run-unit-tests.sh +++ b/.github/workflows/composite/unit-integration-test-runner/run-unit-tests.sh @@ -1,6 +1,6 @@ #!/bin/bash -echo "::group::Run unit tests ('${{ inputs.os }}' gcc)" +echo "::group::Run unit tests ('$1' $CC / $CXX)" cd "$GITHUB_WORKSPACE/core" make clean generate_report cd "$GITHUB_WORKSPACE/lib" From 7545d9dc7faebdc7d2c2aeb0642b08e822709210 Mon Sep 17 00:00:00 2001 From: Serhii Mamontov Date: Fri, 2 Dec 2022 18:29:39 +0100 Subject: [PATCH 40/40] fix(github-actions): add missing input to unit test script --- .../composite/unit-integration-test-runner/action.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/composite/unit-integration-test-runner/action.yaml b/.github/workflows/composite/unit-integration-test-runner/action.yaml index 84ef9968..ae7cd5aa 100644 --- a/.github/workflows/composite/unit-integration-test-runner/action.yaml +++ b/.github/workflows/composite/unit-integration-test-runner/action.yaml @@ -40,7 +40,7 @@ runs: env: CC: gcc CXX: "g++" - run: .github/workflows/composite/unit-integration-test-runner/run-unit-tests.sh + run: .github/workflows/composite/unit-integration-test-runner/run-unit-tests.sh ${{ inputs.os }} - name: Run integration tests ('${{ inputs.os }}' gcc) shell: bash env: @@ -57,7 +57,7 @@ runs: env: CC: clang CXX: "clang++" - run: .github/workflows/composite/unit-integration-test-runner/run-unit-tests.sh + run: .github/workflows/composite/unit-integration-test-runner/run-unit-tests.sh ${{ inputs.os }} - name: Run integration tests ('${{ inputs.os }}' clang) shell: bash env: