diff --git a/.github/codecov.yml b/.github/codecov.yml new file mode 100644 index 000000000..fbed9aa68 --- /dev/null +++ b/.github/codecov.yml @@ -0,0 +1,2 @@ +ignore: + - "./e107_tests/**/*" \ No newline at end of file diff --git a/.github/workflows/test-e107.yml b/.github/workflows/test-e107.yml new file mode 100644 index 000000000..02150ee4c --- /dev/null +++ b/.github/workflows/test-e107.yml @@ -0,0 +1,105 @@ +name: Test e107 + +on: + push: + pull_request: + +env: + MYSQL_DATABASE: app + MYSQL_ROOT_PASSWORD: 'Database Password for Continuous Integration' + +jobs: + test: + strategy: + fail-fast: false + matrix: + interpreter: + - image: php:5.6 + - image: php:7.1 + - image: php:7.2 + - image: php:7.3 + - image: php:7.4 + db: + - image: mysql:5.5 + - image: mysql:5.6 + - image: mysql:5.7 + - image: mariadb:10.4 + runs-on: ubuntu-latest + container: + image: ${{ matrix.interpreter.image }} + services: + db: + image: ${{ matrix.db.image }} + env: + MYSQL_ROOT_PASSWORD: 'Database Password for Continuous Integration' + MYSQL_DATABASE: 'app' + options: >- + --health-cmd "mysqladmin ping" + --health-interval 10s + --health-timeout 5s + --health-retries 5 + + steps: + - uses: actions/checkout@v1 + + - name: Update operating system software repository + run: apt-get update + + - name: Install operating system dependencies + run: apt-get install -y git zip libzip-dev + + - name: PECL zip + run: docker-php-ext-install zip + + - name: PECL xdebug + run: | + if [ $(php -r 'printf(version_compare(PHP_VERSION, "7.0.0", ">=") ? 1 : 0);') = '1' ] + then + pecl install xdebug + docker-php-ext-enable xdebug + else + echo "Not applicable; PHP version $(php -r 'printf(PHP_VERSION);') is too old" + fi + + - name: Install PHP pdo_mysql extension + run: docker-php-ext-install pdo_mysql + + - name: Install Composer + run: curl -sSL https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin/ --filename=composer + + - name: Install dependencies + run: composer install --prefer-dist --no-progress --no-suggest + working-directory: ./e107_tests/ + + - name: Download Git submodule dependencies + run: git submodule update --init --recursive --remote + + - name: Install the CI test configuration file + run: cp ./e107_tests/lib/ci/config.ci.yml ./e107_tests/config.yml + + - name: Run unit tests + run: | + if [ $(php -r 'printf(extension_loaded("xdebug") ? 1 : 0);') = '1' ] + then + php ./vendor/bin/codecept run unit --steps --debug --coverage --coverage-xml #--coverage-html + else + echo "Warning: xdebug not available; skipping coverage..." + php ./vendor/bin/codecept run unit --steps --debug + fi + working-directory: ./e107_tests/ + continue-on-error: true + + - name: Send code coverage report to Codecov + uses: codecov/codecov-action@v1 + with: + token: ${{ secrets.CODECOV_TOKEN }} + file: ./e107_tests/tests/_output/coverage.xml + flags: unittests + name: ${{ matrix.interpreter.image }}-${{ matrix.db.image }} + continue-on-error: true + + - name: Upload test output + uses: actions/upload-artifact@v1 + with: + name: tests_output + path: ./e107_tests/tests/_output/ diff --git a/e107_tests/composer.json b/e107_tests/composer.json index c76a7856b..8bd10c022 100644 --- a/e107_tests/composer.json +++ b/e107_tests/composer.json @@ -1,4 +1,7 @@ { + "name": "e107inc/e107-test", + "description": "Test harness for e107", + "license": "GPL-3.0-or-later", "require-dev": { "codeception/codeception": "^2.5", "twig/twig": ">=1.28" diff --git a/e107_tests/lib/ci/config.ci.yml b/e107_tests/lib/ci/config.ci.yml index 46216a8f5..dd25927a2 100644 --- a/e107_tests/lib/ci/config.ci.yml +++ b/e107_tests/lib/ci/config.ci.yml @@ -2,7 +2,7 @@ deployer: 'local' url: 'http://set-this-to-your-acceptance-test-url.local/' db: - host: 'mysql' + host: 'db' dbname: 'app' user: 'root' password: 'Database Password for Continuous Integration'