From dc1c61ba8251cdef4d4bbeb8a54393e4fb30a96b Mon Sep 17 00:00:00 2001 From: Tom Klingenberg Date: Thu, 22 Dec 2022 19:30:43 +0100 Subject: [PATCH] Finish restore of Codecov Back in Dec 2020 Circleci was sunset (#1152) and Codecov restored. It could benefit to untangle some files still thought. Codecov is https://app.codecov.io/github/netz98/n98-magerun . This: - makes it a port to Github actions. - gets rid of circleci naming - this is now gone since two years. --- .github/workflows/ci.yml | 31 +++++++++++++++++-- build/circleci/source.sh | 23 -------------- build/circleci/test.sh | 22 ------------- .../codecov.lib.sh} | 20 +++++++----- .../smoke.sh => codecov/smokerun.sh} | 2 +- 5 files changed, 42 insertions(+), 56 deletions(-) delete mode 100644 build/circleci/source.sh delete mode 100755 build/circleci/test.sh rename build/{circleci/dependencies_pre.sh => codecov/codecov.lib.sh} (59%) mode change 100755 => 100644 rename build/{circleci/smoke.sh => codecov/smokerun.sh} (91%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6d62501e6..0e7390936 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -183,13 +183,38 @@ jobs: composer-${{ hashFiles('composer.lock') }}- composer- - - name: run circle.yml scripts + - name: codecov env: SETUP_DB_PASS: root MAGENTO_VERSION: magento-mirror-1.9.4.5 run: | - build/circleci/dependencies_pre.sh - build/circleci/test.sh + . build/codecov/codecov.lib.sh 2>&1 + + codecov_step "install composer dist packages" + composer --no-interaction install --prefer-dist + + codecov_step "install magento incl. sampledata with the installer" + magerun_install "${MAGENTO_VERSION}" "${INSTALL_SAMPLE_DATA}" + + codecov_step "prepare magerun phpunit testenvironment" + + grep -v 'remove uninstall test' phpunit.xml.dist > phpunit.xml + + php --version + + export N98_MAGERUN_TEST_MAGENTO_ROOT="./${MAGENTO_VERSION}" + echo "magento test root '${N98_MAGERUN_TEST_MAGENTO_ROOT}' exported as \$N98_MAGERUN_TEST_MAGENTO_ROOT." + + codecov_step "smokerun" + build/codecov/smokerun.sh + + codecov_step "run magerun phpunit testsuite" + php -f vendor/phpunit/phpunit/phpunit -- --coverage-clover "${CLOVER_XML}" \ + --log-junit "./build/coverage/junit/junit.xml" + + codecov_step "check coverage percentage" + php -f tests/check-coverage.php -- "${CLOVER_XML}" "${COVERAGE}" + - uses: codecov/codecov-action@v3 with: file: ./build/coverage/clover.xml # $CLOVER_XML diff --git a/build/circleci/source.sh b/build/circleci/source.sh deleted file mode 100644 index 63851e4e8..000000000 --- a/build/circleci/source.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash -set -euo pipefail -IFS=$'\n\t' - -buildecho() -{ - echo -en "\e[44m[CIRCLECI]\e[49m " - echo "${1}" -} - -buildsmokerun() -{ - buildecho "smokerun:" - build/circleci/smoke.sh -} - -export CLOVER_XML="./build/coverage/clover.xml" -buildecho "clover.xml: '${CLOVER_XML}', exported as \$CLOVER_XML." - -export MAGENTO_VERSION="${MAGENTO_VERSION-magento-mirror-1.9.2.1}" -export DB=mysql -export INSTALL_SAMPLE_DATA=yes -export COVERAGE=65 diff --git a/build/circleci/test.sh b/build/circleci/test.sh deleted file mode 100755 index c65dc9257..000000000 --- a/build/circleci/test.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -set -euo pipefail -IFS=$'\n\t' - -. build/circleci/source.sh - -grep -v 'remove uninstall test' phpunit.xml.dist > phpunit.xml - -buildecho "php version:" -php --version - -export N98_MAGERUN_TEST_MAGENTO_ROOT="./${MAGENTO_VERSION}" -buildecho "magento test root '${N98_MAGERUN_TEST_MAGENTO_ROOT}' exported as \$N98_MAGERUN_TEST_MAGENTO_ROOT." - -buildsmokerun - -buildecho "run magerun phpunit testsuite:" -php -f vendor/phpunit/phpunit/phpunit -- --coverage-clover "${CLOVER_XML}" \ - --log-junit "./build/coverage/junit/junit.xml" - -buildecho "check coverage percentage:" -php -f tests/check-coverage.php -- "${CLOVER_XML}" "${COVERAGE}" diff --git a/build/circleci/dependencies_pre.sh b/build/codecov/codecov.lib.sh old mode 100755 new mode 100644 similarity index 59% rename from build/circleci/dependencies_pre.sh rename to build/codecov/codecov.lib.sh index 4770f41b0..4f89bd164 --- a/build/circleci/dependencies_pre.sh +++ b/build/codecov/codecov.lib.sh @@ -2,9 +2,12 @@ set -euo pipefail IFS=$'\n\t' -. build/circleci/source.sh +codecov_step() +{ + printf '::group::\e[44m[codecov]\e[49m %s\n' "${1}" +} -# download and install mangento (by the git cloned magerun version itself) +# download and install magento (by the git cloned magerun version itself) magerun_install() { local version="${1}" @@ -22,9 +25,12 @@ magerun_install() --baseUrl="http://travis.magento.local/" } -# warumup composer dist packages -composer install --prefer-dist --no-interaction --quiet +codecov_step "environment" -# on circleci, the magento installation itself counts as a dependency as assets and it can be cached -buildecho "install magento incl. sampledata with the installer:" -magerun_install "${MAGENTO_VERSION}" "${INSTALL_SAMPLE_DATA}" +set -x +export CLOVER_XML="./build/coverage/clover.xml" +export MAGENTO_VERSION="${MAGENTO_VERSION-magento-mirror-1.9.2.1}" +export DB=mysql +export INSTALL_SAMPLE_DATA=yes +export COVERAGE=65 +set +x diff --git a/build/circleci/smoke.sh b/build/codecov/smokerun.sh similarity index 91% rename from build/circleci/smoke.sh rename to build/codecov/smokerun.sh index 0600e58c0..7d3c31e73 100755 --- a/build/circleci/smoke.sh +++ b/build/codecov/smokerun.sh @@ -5,7 +5,7 @@ IFS=$'\n\t' smokerun() { local exit_status=0 - echo -e "\e[43m smokerun \e[49m n98-magerun.phar ""${@}" + echo -e "\e[43m smokerun \e[49m n98-magerun.phar" "${@}" if [ -z ${N98_MAGERUN_TEST_MAGENTO_ROOT+x} ]; then php -f bin/n98-magerun -- "${@}"