Skip to content

Updated dependencies #1945

Updated dependencies

Updated dependencies #1945

Workflow file for this run

name: Unit Tests
on:
push:
pull_request:
env:
MYSQL_DATABASE: app
MYSQL_ROOT_PASSWORD: 'Database Password for Continuous Integration'
#CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
CC_TEST_REPORTER_ID: 8948074581c1ffe7f4e47995c65d7d303882310256edd73536723d7c92adb1e3
jobs:
test-unit:
strategy:
fail-fast: false
matrix:
interpreter:
- image: php:7.4
- image: php:8.1
- image: php:8.2
- image: php:8.3
db:
- image: mysql:5.5
- image: bitnami/mysql:8.0
- image: mariadb:10.0
- image: mariadb:10.6
- image: mariadb:10.11
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'
MYSQL_AUTHENTICATION_PLUGIN: 'mysql_native_password'
MYSQL_CHARACTER_SET: 'utf8mb3'
options: >-
--health-cmd "mysqladmin ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Enable Debian backports
run: |
if ! apt-get update; then
sed -i 's#/\(deb\|security\)\.debian\.org/#/archive.debian.org/#g' /etc/apt/sources.list
sed -r -i '/^[^\s#]*[^\s]+\s+[^\s]+\s+[^#]*-updates/d' /etc/apt/sources.list
echo 'Acquire::Check-Valid-Until "false";' > /etc/apt/apt.conf.d/99ignore-obsolete
echo 'Acquire::AllowInsecureRepositories "true";' >> /etc/apt/apt.conf.d/99ignore-obsolete
echo 'APT::Get::AllowUnauthenticated "true";' >> /etc/apt/apt.conf.d/99ignore-obsolete
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get -y full-upgrade
fi
apt-get install -y debian-archive-keyring
grep -m1 -P '^deb http://(deb|archive).debian.org/debian [a-z]+ main' /etc/apt/sources.list |
awk '$3 = $3"-backports"' >> /etc/apt/sources.list
- name: Update operating system software repository
run: apt-get update
- name: Install operating system dependencies
run: |
. /etc/os-release
DEBIAN_RELEASE="$(echo "$VERSION" | grep -oP '^[^(]+\(\K[^)]+')"
USE_GIT_BPO="$(test $VERSION_ID -lt 10 && echo "-t ${DEBIAN_RELEASE}-backports" || echo)"
apt-get $USE_GIT_BPO install -y git zip libzip-dev libbz2-dev libpng-dev libjpeg-dev libwebp-dev libvpx-dev libicu-dev
- name: Configure PHP gd extension with default bundle
run: |
if [ $(php -r 'printf(version_compare(PHP_VERSION, "7.4.0", ">=") ? 1 : 0);') = '1' ]
then
docker-php-ext-configure gd --with-jpeg --with-webp
elif [ $(php -r 'printf(version_compare(PHP_VERSION, "7.0.0", ">=") ? 1 : 0);') = '1' ]
then
docker-php-ext-configure gd --with-jpeg-dir=/usr --with-webp-dir=/usr
else
docker-php-ext-configure gd --with-jpeg-dir=/usr --with-vpx-dir=/usr
fi
- name: Install necessary PHP extensions
run: |
docker-php-ext-install -j "$(nproc)" \
zip bz2 gd pdo_mysql mysqli intl
- name: PECL install xdebug
run: |
if [ $(php -r 'printf(version_compare(PHP_VERSION, "8.2.99", ">=") ? 1 : 0);') = '1' ]
then
pecl install https://xdebug.org/files/xdebug-3.3.0alpha2.tgz
elif [ $(php -r 'printf(version_compare(PHP_VERSION, "8.0.0", ">=") ? 1 : 0);') = '1' ]
then
pecl install xdebug
elif [ $(php -r 'printf(version_compare(PHP_VERSION, "7.2.0", ">=") ? 1 : 0);') = '1' ]
then
pecl install xdebug-3.1.6
elif [ $(php -r 'printf(version_compare(PHP_VERSION, "7.1.0", ">=") ? 1 : 0);') = '1' ]
then
pecl install xdebug-2.9.8
elif [ $(php -r 'printf(version_compare(PHP_VERSION, "7.0.0", ">=") ? 1 : 0);') = '1' ]
then
pecl install xdebug-2.7.2
else
pecl install xdebug-2.5.5
fi
docker-php-ext-enable xdebug
- uses: actions/checkout@v3
- name: Install Composer
run: curl -sSL https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin/ --filename=composer
- name: Install test dependencies
run: composer update --prefer-dist --no-progress
working-directory: ./e107_tests/
- name: Opt out of CVE-2022-24765 mitigation
run: git config --global safe.directory '*'
- 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.unit.ci.yml ./e107_tests/config.yml
- name: Download Code Climate test reporter
run: |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
chmod +x ./cc-test-reporter
working-directory: ./e107_tests/vendor/bin/
continue-on-error: true
- name: Code Climate report before build
run: ./e107_tests/vendor/bin/cc-test-reporter before-build
continue-on-error: true
- name: Build Codeception
run: php ./vendor/bin/codecept build
working-directory: ./e107_tests/
continue-on-error: false
- name: Run unit tests
run: |
if [ $(php -r 'printf(extension_loaded("xdebug") ? 1 : 0);') = '1' ]
then
php -d xdebug.mode=coverage ./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/
- name: Send code coverage report to Code Climate
run: |
./e107_tests/vendor/bin/cc-test-reporter format-coverage \
--input-type clover \
--output ./e107_tests/tests/_output/coverage/codeclimate.json \
./e107_tests/tests/_output/coverage.xml
./e107_tests/vendor/bin/cc-test-reporter upload-coverage \
--input ./e107_tests/tests/_output/coverage/codeclimate.json
continue-on-error: true
- name: Set artifact name
id: set_artifact_name
run: |
TIMESTAMP=$(date +%Y%m%d%H%M%S)
INTERPRETER_IMAGE=$(echo "${{ matrix.interpreter.image }}" | sed 's/[:/]/_/g')
DB_IMAGE=$(echo "${{ matrix.db.image }}" | sed 's/[:/]/_/g')
ARTIFACT_NAME="tests_output_${{ github.run_id }}_${INTERPRETER_IMAGE}_${DB_IMAGE}_${TIMESTAMP}"
echo "ARTIFACT_NAME=${ARTIFACT_NAME}" >> $GITHUB_ENV
- name: Upload test output
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARTIFACT_NAME }}
path: ./e107_tests/tests/_output/