From b904f320dec7295552d5ae4f7389b806bbd5dc9b Mon Sep 17 00:00:00 2001 From: Yuriy Bakhtin Date: Thu, 14 Mar 2024 13:01:27 +0100 Subject: [PATCH] Fix tests --- .github/workflows/php-test-develop.yml | 12 ++ .github/workflows/php-test-main.yml | 12 ++ .github/workflows/php-test-master.yml | 10 ++ .github/workflows/php-test.yml | 151 ------------------------- 4 files changed, 34 insertions(+), 151 deletions(-) create mode 100644 .github/workflows/php-test-develop.yml create mode 100644 .github/workflows/php-test-main.yml create mode 100644 .github/workflows/php-test-master.yml delete mode 100644 .github/workflows/php-test.yml diff --git a/.github/workflows/php-test-develop.yml b/.github/workflows/php-test-develop.yml new file mode 100644 index 0000000..d88f646 --- /dev/null +++ b/.github/workflows/php-test-develop.yml @@ -0,0 +1,12 @@ +name: PHP Codeception Tests - develop + +on: + push: + schedule: + - cron: "0 0 * * 0" + +jobs: + tests: + uses: humhub/actions/.github/workflows/module-tests-develop.yml@main + with: + module-id: example-basic diff --git a/.github/workflows/php-test-main.yml b/.github/workflows/php-test-main.yml new file mode 100644 index 0000000..37c01c4 --- /dev/null +++ b/.github/workflows/php-test-main.yml @@ -0,0 +1,12 @@ +name: PHP Codeception Tests - next + +on: + push: + schedule: + - cron: "0 0 * * 0" + +jobs: + tests: + uses: humhub/actions/.github/workflows/module-tests-next.yml@main + with: + module-id: example-basic diff --git a/.github/workflows/php-test-master.yml b/.github/workflows/php-test-master.yml new file mode 100644 index 0000000..16a16c5 --- /dev/null +++ b/.github/workflows/php-test-master.yml @@ -0,0 +1,10 @@ +name: PHP Codeception Tests - master + +on: + push: + +jobs: + tests: + uses: humhub/actions/.github/workflows/module-tests-master.yml@main + with: + module-id: example-basic diff --git a/.github/workflows/php-test.yml b/.github/workflows/php-test.yml deleted file mode 100644 index 3883d5e..0000000 --- a/.github/workflows/php-test.yml +++ /dev/null @@ -1,151 +0,0 @@ -name: PHP Codeception Tests - -on: - push: - branches: - - master - - main - - develop - pull_request: - branches: - - master - - main - - develop - -jobs: - tests: - name: PHP ${{ matrix.php-version }}-mysql-${{ matrix.mysql-version }}-humhub-${{ matrix.humhub-ref }} - env: - module-id: example-basic - extensions: curl, intl, pdo, pdo_mysql, zip, exif, fileinfo, mbstring, gd - key: cache-v1 - - runs-on: ${{ matrix.os }} - - strategy: - matrix: - os: - - ubuntu-latest - - php-version: - - "7.4" - - "8.0" - - humhub-ref: - - "develop" - - "master" - - mysql-version: - - "5.7" - - services: - mysql: - image: mysql:${{ matrix.mysql-version }} - env: - MYSQL_DATABASE: humhub_test - MYSQL_ROOT_PASSWORD: root - ports: - - 3306:3306 - options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 - - steps: - - uses: actions/setup-node@v1 - - - name: Checkout HumHub Core - uses: actions/checkout@v2 - with: - repository: humhub/humhub - ref: ${{ matrix.humhub-ref }} - - - name: Checkout Module - uses: actions/checkout@v2 - with: - path: protected/modules/${{ env.module-id }} - - - name: Setup cache environment - id: cache-env - uses: shivammathur/cache-extensions@v1 - with: - php-version: ${{ matrix.php-version }} - extensions: ${{ env.extensions }} - key: ${{ env.key }} - - - name: Cache extensions - uses: actions/cache@v1 - with: - path: ${{ steps.cache-env.outputs.dir }} - key: ${{ steps.cache-env.outputs.key }} - restore-keys: ${{ steps.cache-env.outputs.key }} - - - name: Install PHP with extensions - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php-version }} - extensions: ${{ env.extensions }} - ini-values: date.timezone='UTC' - - - name: Determine composer cache directory - if: matrix.os == 'ubuntu-latest' - run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV - - - name: Validate composer.json and composer.lock - run: composer validate - - - name: Cache dependencies installed with composer - uses: actions/cache@v1 - with: - path: ${{ env.COMPOSER_CACHE_DIR }} - key: php${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.json') }} - restore-keys: | - php${{ matrix.php-version }}-composer-${{ matrix.dependencies }}- - - - name: Install dependencies with composer - run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi - - - name: Verify MySQL connection from host - run: | - sudo apt-get install -y mysql-client - mysql --host 127.0.0.1 --port ${{ job.services.mysql.ports['3306'] }} -uroot -proot -e "SHOW DATABASES" - - - name: Install npm dependencies - run: npm install - - - name: Build production assets - run: grunt build-assets - - - name: Run migrations - run: php protected/humhub/tests/codeception/bin/yii migrate/up --includeModuleMigrations=1 --interactive=0 - - - name: Run installer - run: php protected/humhub/tests/codeception/bin/yii installer/auto - - - name: Rebuild search index - run: php protected/humhub/tests/codeception/bin/yii search/rebuild - - - name: Build codeception core files - run: | - cd $GITHUB_WORKSPACE/protected/humhub/tests - php ../../vendor/bin/codecept build - - - name: Run test server - run: | - # Temporary condition while branch "master" doesn't use pretty URLs on acceptance tests - if cat $GITHUB_WORKSPACE/.github/workflows/php-test.yml | grep -q ":8080 index-test.php" - then - php --server 127.0.0.1:8080 index-test.php &>/tmp/phpserver.log & - else - php --server 127.0.0.1:8080 &>/tmp/phpserver.log & - fi - - - name: Setup chromedriver - run: chromedriver --url-base=/wd/hub & - - - name: Valdiate test server - run: sleep 5 && curl --fail --head http://127.0.0.1:8080/index-test.php - - - name: Run test suite - run: | - export HUMHUB_PATH=$GITHUB_WORKSPACE - cd $GITHUB_WORKSPACE/protected/modules/${{ env.module-id }}/tests - php $GITHUB_WORKSPACE/protected/vendor/bin/codecept build - php $GITHUB_WORKSPACE/protected/vendor/bin/codecept run --env github