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/composite/unit-integration-test-runner/action.yaml b/.github/workflows/composite/unit-integration-test-runner/action.yaml new file mode 100644 index 00000000..ae7cd5aa --- /dev/null +++ b/.github/workflows/composite/unit-integration-test-runner/action.yaml @@ -0,0 +1,71 @@ +--- +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 + 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: + 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" + - name: Run unit tests ('${{ inputs.os }}' gcc) + shell: bash + env: + CC: gcc + CXX: "g++" + run: .github/workflows/composite/unit-integration-test-runner/run-unit-tests.sh ${{ inputs.os }} + - name: Run integration tests ('${{ inputs.os }}' gcc) + shell: bash + env: + CC: gcc + CXX: "g++" + 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: | + 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: .github/workflows/composite/unit-integration-test-runner/run-unit-tests.sh ${{ inputs.os }} + - name: Run integration tests ('${{ inputs.os }}' clang) + shell: bash + env: + CC: clang + CXX: "clang++" + 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: | + 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-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..a89779a3 --- /dev/null +++ b/.github/workflows/composite/unit-integration-test-runner/run-integration-tests.sh @@ -0,0 +1,36 @@ +#!/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;30;69;1m" +SUCCESS_FG="\033[38;2;95;215;0m" +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 + +[[ "$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..0da15bf5 --- /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 ('$1' $CC / $CXX)" +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/action.yaml b/.github/workflows/composite/unit-test-framework/action.yaml new file mode 100644 index 00000000..e0114ddc --- /dev/null +++ b/.github/workflows/composite/unit-test-framework/action.yaml @@ -0,0 +1,38 @@ +--- +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: 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 + 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..2325792f --- /dev/null +++ b/.github/workflows/composite/unit-test-framework/build-framework.sh @@ -0,0 +1,59 @@ +#!/bin/bash + +# 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 "::warning title=compiler flags::Here should be some setup for Windows compiler" + fi + + 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 + + # Enable 'gcov' only for build on Ubuntu. + [[ "$1" == "ubuntu" ]] && WITH_GCOV=ON || WITH_GCOV=OFF + if [[ "$WITH_GCOV" == ON ]]; then + echo "::notice title=gcov::Installing 'gcov' for code coverage." + 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" + fi + + echo "::notice title=cgreen::Configure 'cgreen' build" + cmake -E env LDFLAGS="-lm" cmake -DCGREEN_INTERNAL_WITH_GCOV:BOOL=$WITH_GCOV .. + + echo "::notice title=cgreen::Build 'cgreen' framework" + make -j2 + + 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" + + # Clean up configured environments. + unset CC && unset CXX + echo "::endgroup::" +done + +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/release.yml b/.github/workflows/release.yml index 03ea21cb..cf3280dd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -15,25 +15,25 @@ 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 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 }} 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..305aaa80 --- /dev/null +++ b/.github/workflows/run-tests.yml @@ -0,0 +1,120 @@ +name: Tests + +concurrency: + group: ${{ github.ref }} + cancel-in-progress: true + +on: + push: + workflow_dispatch: + + +jobs: + tests-ubuntu: + 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 + 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 + 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 + with: + os: macos + version: 1.6.0 + pubNubPubKey: ${{ secrets.PUBNUB_PUBKEY }} + pubNubSubKey: ${{ secrets.PUBNUB_KEYSUB }} + 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' + 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 + 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 + shell: bash + 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 + shell: bash + 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 diff --git a/core/Makefile b/core/Makefile index a201baf3..abc0ba3b 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 -r rm -rf diff --git a/cpp/posix.mk b/cpp/posix.mk index 15581a14..053d9420 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 -r rm -rf diff --git a/cpp/posix_openssl.mk b/cpp/posix_openssl.mk index a9dc8466..56a2f3c0 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 -r rm -rf diff --git a/lib/Makefile b/lib/Makefile index 618f0a3e..bc725511 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 -r rm -rf diff --git a/openssl/posix.mk b/openssl/posix.mk index 39616c76..235cd2af 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 -r rm -rf -rf diff --git a/posix/posix.mk b/posix/posix.mk index 2fbb76cb..9b915dff 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 -r rm -rf