diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 772186c8c..3fb7c3b96 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -32,6 +32,8 @@ jobs: runs-on: ubuntu-20.04 + if: ${{ contains(github.event.pull_request.labels.*.name, 'test-regular') || github.event_name == 'schedule' }} + services: mysql: image: mariadb:latest @@ -103,6 +105,8 @@ jobs: runs-on: ubuntu-20.04 + if: ${{ contains(github.event.pull_request.labels.*.name, 'test-regular') || github.event_name == 'schedule' }} + services: mysql: image: mariadb:latest @@ -182,7 +186,7 @@ jobs: matrix: PHP_VERSION: [ '7.4' ] - if: ${{ contains(github.event.pull_request.labels.*.name, 'test-upgrade') || github.event_name == 'schedule' }} +# if: ${{ contains(github.event.pull_request.labels.*.name, 'test-upgrade') || github.event_name == 'schedule' }} env: DRUPAL_TESTING_TEST_GROUP_EXCLUDE: "NoUpdate" @@ -234,20 +238,30 @@ jobs: composer update composer exec -- drush updb -y + composer exec -- drush sql:dump --extra-dump='--column-statistics=0' > docroot/dump.sql cd docroot php core/scripts/db-tools.php dump-database-d8-mysql > db-dump.php working-directory: /tmp/test/thunder/install - - name: Setup Apache - uses: thunder/apache-shiva-php-action@v1 - with: - php-version: ${{ matrix.PHP_VERSION }} - site-directory: /tmp/test/thunder/install/docroot - http-port: ${{ env.DRUPAL_TESTING_HTTP_PORT }} + - name: Zip build + run: cd /tmp/test; tar cfz upgrade-${{ matrix.PHP_VERSION }}.tgz thunder; mv upgrade-${{ matrix.PHP_VERSION }}.tgz ${GITHUB_WORKSPACE} - - name: Run tests suite - run: test-drupal-project run_tests + - name: Upload build + uses: actions/upload-artifact@v2 + with: + name: upgrade-${{ matrix.PHP_VERSION }} + path: upgrade-${{ matrix.PHP_VERSION }}.tgz + +# - name: Setup Apache +# uses: thunder/apache-shiva-php-action@v1 +# with: +# php-version: ${{ matrix.PHP_VERSION }} +# site-directory: /tmp/test/thunder/install/docroot +# http-port: ${{ env.DRUPAL_TESTING_HTTP_PORT }} +# +# - name: Run tests suite +# run: test-drupal-project run_tests test-min: @@ -324,67 +338,82 @@ jobs: - name: Run the tests run: test-drupal-project run_tests - test-performance: - needs: [build, test-max] + test-config: + needs: test-upgrade runs-on: ubuntu-20.04 - if: ${{ contains(github.event.pull_request.labels.*.name, 'test-performance') || github.event_name == 'schedule' }} + services: + mysql: + image: mariadb:latest + env: + MYSQL_ROOT_PASSWORD: root + ports: + - 3306:3306 + selenium: + image: selenium/standalone-chrome + options: --shm-size 2g --add-host=thunder-testing:host-gateway --name selenium + ports: + - 4444:4444 + strategy: + fail-fast: false + matrix: + PHP_VERSION: [ '7.4' ] steps: - uses: actions/checkout@v1 - with: - repository: thunder/docker-thunder-performance - path: thunder-distribution/docker-thunder-performance - ref: 'master' - - uses: shivammathur/setup-php@master + - uses: shivammathur/setup-php@v2 with: coverage: none - php-version: '7.4' - extensions: Imagick + php-version: ${{ matrix.PHP_VERSION }} + extensions: :sodium, Imagick, gd, PDO, mysql, pdo_mysql, mbstring, xmlwriter, pdo, date, dom, filter, hash, json, pcre, session, SimpleXML, SPL, tokenizer, xml, curl - - name: Download build + - name: Add host + run: echo "127.0.0.1 thunder-testing" | sudo tee -a /etc/hosts + + - name: Prepare fixtures + run: docker cp ./tests/fixtures selenium:/fixtures + + - name: Get build environment + run: composer global require thunder/drupal-testing:${DRUPAL_TESTING_VERSION} + + - name: Download upgrade build uses: actions/download-artifact@v1 with: - name: build-7.4 + name: upgrade-${{ matrix.PHP_VERSION }} - - name: Unzip build artifact - run: mkdir -p /tmp/test; tar xCfz /tmp/test build-7.4/build-7.4.tgz thunder; rm -rf build-7.4; mv /tmp/test/thunder/install ${GITHUB_WORKSPACE}/docker-thunder-performance/www + - name: Unzip upgrade build artifact + run: mkdir -p /tmp/test; tar xCfz /tmp/test upgrade-${{ matrix.PHP_VERSION }}/upgrade-${{ matrix.PHP_VERSION }}.tgz thunder; rm -rf upgrade-${{ matrix.PHP_VERSION }} - - name: Set variables - id: vars - # GITHUB_HEAD_REF is only defined in PRs. GITHUB_REF is on the default branch something like refs/heads/8.x-4.x. - # So if GITHUB_HEAD_REF is not defined we use GITHUB_REF and remove leading refs/heads/. On the result / will replaced by _ + - name: Load database dump + working-directory: /tmp/test/thunder/install run: | - echo ::set-output name=DOCKER_SANITIZED_BRANCH_NAME::$(echo ${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}} | sed 's/\//_/g') - echo ::set-output name=DOCKER_TAG::$(echo ${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}} | sed 's/\//_/g')-${{ github.run_id }} + vendor/bin/drush sql:create -y + vendor/bin/drush sql:cli < docroot/dump.sql - - name: Create image and push to registry - working-directory: docker-thunder-performance + - name: Link the distribution + working-directory: /tmp/test/thunder/install run: | - echo ${{ secrets.DOCKER_TOKEN }} | docker login -u thundertechnology --password-stdin - export DOCKER_IMAGE_TAG="burda/thunder-performance:${{ steps.vars.outputs.DOCKER_TAG }}" - chmod u+w www/docroot/sites/default - bash -x ./build.sh --tag "${DOCKER_IMAGE_TAG}" - docker push "${DOCKER_IMAGE_TAG}" + composer remove thunder/thunder-distribution --no-update + composer config name "drupal-testing-thunder/thunder-distribution" --working-dir="${GITHUB_WORKSPACE}" + composer require "drupal-testing-thunder/thunder-distribution:*" --no-update + composer require drupal/config_profile + rm -rf docroot/profiles/contrib/thunder-distribution + ln -s "${GITHUB_WORKSPACE}" docroot/profiles/contrib/thunder - - name: Start Thunder performance testing task for created image + - name: Setup tmate session + uses: mxschmitt/action-tmate@v3 + + - name: Check profile config + working-directory: /tmp/test/thunder/install run: | - API_CALL_HTTP_CODE=$(curl \ - --request POST \ - --insecure \ - "https://${{ secrets.THUNDER_PTM_HOST }}:3000/warmers" \ - --header "Authorization: Bearer ${{ secrets.THUNDER_PTM_TOKEN }}" \ - --header "Content-Type: application/json" \ - --data "{\"branchTag\":\"${{ steps.vars.outputs.DOCKER_SANITIZED_BRANCH_NAME }}\",\"imageTag\":\"${{ steps.vars.outputs.DOCKER_TAG }}\",\"composeType\":\"default\"}" \ - --output /dev/stderr \ - --write-out "%{http_code}" \ - ) - - if [[ "${API_CALL_HTTP_CODE}" != "200" ]]; then - exit 1 - fi + vendor/bin/drush -y en config_profile + vendor/bin/drush cex + + cd docroot/profiles/contrib/thunder + git clean -fd + git status # Start a debug session. # - name: Setup tmate session