Skip to content

Commit

Permalink
Finish restore of Codecov
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ktomk committed Dec 22, 2022
1 parent f432701 commit dc1c61b
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 56 deletions.
31 changes: 28 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
23 changes: 0 additions & 23 deletions build/circleci/source.sh

This file was deleted.

22 changes: 0 additions & 22 deletions build/circleci/test.sh

This file was deleted.

20 changes: 13 additions & 7 deletions build/circleci/dependencies_pre.sh → build/codecov/codecov.lib.sh
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand All @@ -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
2 changes: 1 addition & 1 deletion build/circleci/smoke.sh → build/codecov/smokerun.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 -- "${@}"
Expand Down

0 comments on commit dc1c61b

Please sign in to comment.