From 862a83e9ff7d87a14315c88dcb283e37144b52c5 Mon Sep 17 00:00:00 2001 From: Spuds Date: Mon, 15 Apr 2024 08:29:28 -0500 Subject: [PATCH 1/3] ! cleanup test scripts --- .github/setup-database.sh | 2 -- .github/setup-elkarte.sh | 5 +---- .github/setup-failure.sh | 7 +------ .github/setup-nginx.sh | 8 ++------ .github/setup-results.sh | 9 ++------- .github/setup-selenium.sh | 4 ---- .github/workflows/tests.yaml | 14 +++++++------- 7 files changed, 13 insertions(+), 36 deletions(-) diff --git a/.github/setup-database.sh b/.github/setup-database.sh index 02724a510d..412054e09d 100755 --- a/.github/setup-database.sh +++ b/.github/setup-database.sh @@ -3,8 +3,6 @@ set -e set -x -DB=$1 - # Setup a Database if [[ "$DB" == "postgres" ]] then diff --git a/.github/setup-elkarte.sh b/.github/setup-elkarte.sh index 340f7cb0e9..11d7496fb3 100755 --- a/.github/setup-elkarte.sh +++ b/.github/setup-elkarte.sh @@ -3,9 +3,6 @@ set -e set -x -DB=$1 -PHP_VERSION=$2 - # Refresh package list upfront sudo apt-get update -qq @@ -15,7 +12,7 @@ sudo apt-get install coreutils memcached -qq > /dev/null # Webserver setup if [[ "$DB" != "none" ]] then - if [[ "$WEBSERVER" != "none" ]]; then .github/setup-nginx.sh $DB $PHP_VERSION; fi + if [[ "$WEBSERVER" != "none" ]]; then .github/setup-nginx.sh "$DB" "$PHP_VERSION"; fi # Start a memcached service on localhost and the default port so we can test cache engines memcached -p 11212 -d diff --git a/.github/setup-failure.sh b/.github/setup-failure.sh index 55167298bd..ee7b4f5e6a 100755 --- a/.github/setup-failure.sh +++ b/.github/setup-failure.sh @@ -7,13 +7,8 @@ set -e set +x -# Passed params -DB=$1 -PHP_VERSION=$2 -CODECOV_TOKEN=$3 - # Agents will merge all coverage data... if [[ "${GITHUB_EVENT_NAME}" == "pull_request" ]] then - bash <(curl -s https://codecov.io/bash) -s "/tmp" -f '*.xml' -t "${CODECOV_TOKEN}" + bash <(curl -s https://codecov.io/bash) -s "/tmp" -f '*.xml' -t "$CODECOV_TOKEN" fi \ No newline at end of file diff --git a/.github/setup-nginx.sh b/.github/setup-nginx.sh index 82e98281f1..67027ea996 100755 --- a/.github/setup-nginx.sh +++ b/.github/setup-nginx.sh @@ -3,9 +3,6 @@ set -e set -x -DB=$1 -PHP_VERSION=$2 - DIR=$(dirname "$0") USER=$(whoami) ELKARTE_ROOT_PATH=$(realpath "$DIR/../elkarte") @@ -43,11 +40,10 @@ echo " security.limit_extensions = .php php_admin_value[memory_limit] = 128M -" > $PHP_FPM_CONF +" > "$PHP_FPM_CONF" # Add our pool config to PHP-FPM -sudo $PHP_FPM_BIN \ - --fpm-config "$DIR/php-fpm.conf" +sudo "$PHP_FPM_BIN" --fpm-config "$DIR/php-fpm.conf" # Default Nginx conf needs to be updated with correct user sudo sed -i "s/user www-data;/user $USER;/g" $NGINX_CONF diff --git a/.github/setup-results.sh b/.github/setup-results.sh index 00ca6c57f7..46b5624342 100755 --- a/.github/setup-results.sh +++ b/.github/setup-results.sh @@ -5,13 +5,8 @@ set -e set +x -# Passed params -DB=$1 -PHP_VERSION=$2 -CODECOV_TOKEN=$3 - # Build a config string for PHPUnit -CONFIG="--verbose --configuration .github/phpunit-${DB}.xml" +CONFIG="--verbose --configuration .github/phpunit-$DB.xml" # Running PHPUnit tests vendor/bin/phpunit ${CONFIG} @@ -19,5 +14,5 @@ vendor/bin/phpunit ${CONFIG} # Agents will merge all coverage data... if [[ "${GITHUB_EVENT_NAME}" == "pull_request" ]] then - bash <(curl -s https://codecov.io/bash) -s "/tmp" -f '*.xml' -t "${CODECOV_TOKEN}" + bash <(curl -s https://codecov.io/bash) -s "/tmp" -f '*.xml' -t "$CODECOV_TOKEN" fi diff --git a/.github/setup-selenium.sh b/.github/setup-selenium.sh index f11aa53eaf..d138c8b4d1 100755 --- a/.github/setup-selenium.sh +++ b/.github/setup-selenium.sh @@ -6,10 +6,6 @@ set -e set -x -# Access passed params -DB=$1 -PHP_VERSION=$2 - # Some vars to make this easy to change SELENIUM_HUB_URL='http://127.0.0.1:4444' SELENIUM_JAR=/usr/share/selenium/selenium-server-standalone.jar diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index e8f1f2d3b0..551b401d92 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -91,7 +91,7 @@ jobs: DB: ${{ matrix.db }} PHP_VERSION: ${{ matrix.php }} CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - run: .github/setup-failure.sh $DB $PHP_VERSION $CODECOV_TOKEN + run: .github/setup-failure.sh working-directory: ./elkarte - name: Server Error Log @@ -223,14 +223,14 @@ jobs: env: DB: ${{steps.database-type.outputs.db}} PHP_VERSION: ${{ matrix.php }} - run: .github/setup-elkarte.sh $DB $PHP_VERSION + run: .github/setup-elkarte.sh working-directory: ./elkarte - name: Install Database env: DB: ${{steps.database-type.outputs.db}} PHP_VERSION: ${{ matrix.php }} - run: .github/setup-database.sh $DB $PHP_VERSION + run: .github/setup-database.sh working-directory: ./elkarte - name: Run Unit Tests @@ -238,7 +238,7 @@ jobs: DB: ${{steps.database-type.outputs.db}} PHP_VERSION: ${{ matrix.php }} CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - run: .github/setup-results.sh $DB $PHP_VERSION $CODECOV_TOKEN + run: .github/setup-results.sh working-directory: ./elkarte # END MySQL and MariaDB Job @@ -303,14 +303,14 @@ jobs: env: DB: ${{steps.database-type.outputs.db}} PHP_VERSION: ${{ matrix.php }} - run: .github/setup-elkarte.sh $DB $PHP_VERSION + run: .github/setup-elkarte.sh working-directory: ./elkarte - name: Install Database env: DB: ${{steps.database-type.outputs.db}} PHP_VERSION: ${{ matrix.php }} - run: .github/setup-database.sh $DB $PHP_VERSION + run: .github/setup-database.sh working-directory: ./elkarte - name: Run Unit Tests @@ -318,6 +318,6 @@ jobs: DB: ${{steps.database-type.outputs.db}} PHP_VERSION: ${{ matrix.php }} CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - run: .github/setup-results.sh $DB $PHP_VERSION $CODECOV_TOKEN + run: .github/setup-results.sh working-directory: ./elkarte # END Postgres Job \ No newline at end of file From 8918b7c084a4e2e6042185c2c6f3bb41d082ed6f Mon Sep 17 00:00:00 2001 From: Spuds Date: Mon, 15 Apr 2024 09:00:44 -0500 Subject: [PATCH 2/3] ! try action --- .github/phpunit-mariadb.xml | 2 +- .github/phpunit-mysql.xml | 2 +- .github/phpunit-postgres.xml | 2 +- .github/phpunit-webtest.xml | 2 +- .github/setup-failure.sh | 8 ++++---- .github/setup-results.sh | 8 ++++---- .github/workflows/tests.yaml | 37 +++++++++++++++++++++++++----------- 7 files changed, 38 insertions(+), 23 deletions(-) diff --git a/.github/phpunit-mariadb.xml b/.github/phpunit-mariadb.xml index 8302528b29..6b0bc8e993 100644 --- a/.github/phpunit-mariadb.xml +++ b/.github/phpunit-mariadb.xml @@ -30,7 +30,7 @@ ../sources/ext - + diff --git a/.github/phpunit-mysql.xml b/.github/phpunit-mysql.xml index 65a5e24e36..6b0bc8e993 100644 --- a/.github/phpunit-mysql.xml +++ b/.github/phpunit-mysql.xml @@ -30,7 +30,7 @@ ../sources/ext - + diff --git a/.github/phpunit-postgres.xml b/.github/phpunit-postgres.xml index f1880e8393..0d274d4225 100644 --- a/.github/phpunit-postgres.xml +++ b/.github/phpunit-postgres.xml @@ -30,7 +30,7 @@ ../sources/ext - + diff --git a/.github/phpunit-webtest.xml b/.github/phpunit-webtest.xml index 9ed0021c28..2d400fb107 100644 --- a/.github/phpunit-webtest.xml +++ b/.github/phpunit-webtest.xml @@ -26,7 +26,7 @@ ../sources/ext - + diff --git a/.github/setup-failure.sh b/.github/setup-failure.sh index ee7b4f5e6a..287c120d1c 100755 --- a/.github/setup-failure.sh +++ b/.github/setup-failure.sh @@ -8,7 +8,7 @@ set -e set +x # Agents will merge all coverage data... -if [[ "${GITHUB_EVENT_NAME}" == "pull_request" ]] -then - bash <(curl -s https://codecov.io/bash) -s "/tmp" -f '*.xml' -t "$CODECOV_TOKEN" -fi \ No newline at end of file +#if [[ "${GITHUB_EVENT_NAME}" == "pull_request" ]] +#then +# bash <(curl -s https://codecov.io/bash) -s "/tmp" -f '*.xml' -t "$CODECOV_TOKEN" +#fi \ No newline at end of file diff --git a/.github/setup-results.sh b/.github/setup-results.sh index 46b5624342..e1f0bf667c 100755 --- a/.github/setup-results.sh +++ b/.github/setup-results.sh @@ -12,7 +12,7 @@ CONFIG="--verbose --configuration .github/phpunit-$DB.xml" vendor/bin/phpunit ${CONFIG} # Agents will merge all coverage data... -if [[ "${GITHUB_EVENT_NAME}" == "pull_request" ]] -then - bash <(curl -s https://codecov.io/bash) -s "/tmp" -f '*.xml' -t "$CODECOV_TOKEN" -fi +#if [[ "${GITHUB_EVENT_NAME}" == "pull_request" ]] +#then +# bash <(curl -s https://codecov.io/bash) -s "/tmp" -f '*.xml' -t "$CODECOV_TOKEN" +#fi diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 551b401d92..9981b6c0d5 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -75,24 +75,24 @@ jobs: DB: ${{ matrix.db }} PHP_VERSION: ${{ matrix.php }} WEBSERVER: 'nginx' - run: .github/setup-elkarte.sh $DB $PHP_VERSION + run: .github/setup-elkarte.sh working-directory: ./elkarte - name: Run Unit Tests env: DB: ${{ matrix.db }} PHP_VERSION: ${{ matrix.php }} - run: .github/setup-selenium.sh $DB $PHP_VERSION + run: .github/setup-selenium.sh working-directory: ./elkarte continue-on-error: true - - name: Code Coverage - env: - DB: ${{ matrix.db }} - PHP_VERSION: ${{ matrix.php }} - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - run: .github/setup-failure.sh - working-directory: ./elkarte + - name: Send Coverage Reports + if: ${{ github.event_name == 'pull_request' }} + uses: codecov/codecov-action@v4 + with: + files: /home/runner/work/Elkarte/Elkarte/elkarte/tmp/web.xml + token: ${{ secrets.CODECOV_TOKEN }} + verbose: false - name: Server Error Log env: @@ -138,7 +138,7 @@ jobs: env: DB: ${{ matrix.db }} PHP_VERSION: ${{ matrix.php }} - run: .github/setup-elkarte.sh $DB $PHP_VERSION + run: .github/setup-elkarte.sh working-directory: ./elkarte - name: Install NodeJS @@ -237,9 +237,16 @@ jobs: env: DB: ${{steps.database-type.outputs.db}} PHP_VERSION: ${{ matrix.php }} - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} run: .github/setup-results.sh working-directory: ./elkarte + + - name: Send Coverage Reports + if: ${{ github.event_name == 'pull_request' }} + uses: codecov/codecov-action@v4 + with: + files: /home/runner/work/Elkarte/Elkarte/elkarte/tmp/db.xml + token: ${{ secrets.CODECOV_TOKEN }} + verbose: false # END MySQL and MariaDB Job # START Postgres Tests @@ -320,4 +327,12 @@ jobs: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} run: .github/setup-results.sh working-directory: ./elkarte + + - name: Send Coverage Reports + if: ${{ github.event_name == 'pull_request' }} + uses: codecov/codecov-action@v4 + with: + files: /home/runner/work/Elkarte/Elkarte/elkarte/tmp/db.xml + token: ${{ secrets.CODECOV_TOKEN }} + verbose: false # END Postgres Job \ No newline at end of file From 1ed00a81273beaafa5790febbff3221de9b72e34 Mon Sep 17 00:00:00 2001 From: Spuds Date: Mon, 15 Apr 2024 12:22:17 -0500 Subject: [PATCH 3/3] ! remove the old way of sending coverage data --- .github/setup-failure.sh | 14 -------------- .github/setup-results.sh | 6 ------ 2 files changed, 20 deletions(-) delete mode 100755 .github/setup-failure.sh diff --git a/.github/setup-failure.sh b/.github/setup-failure.sh deleted file mode 100755 index 287c120d1c..0000000000 --- a/.github/setup-failure.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash -# -# "since failure is always an option" -# Perform various actions if things don't go as expected during the test -# currently only used with GHA selenium to always send coverage - -set -e -set +x - -# Agents will merge all coverage data... -#if [[ "${GITHUB_EVENT_NAME}" == "pull_request" ]] -#then -# bash <(curl -s https://codecov.io/bash) -s "/tmp" -f '*.xml' -t "$CODECOV_TOKEN" -#fi \ No newline at end of file diff --git a/.github/setup-results.sh b/.github/setup-results.sh index e1f0bf667c..c2ff2fdbe9 100755 --- a/.github/setup-results.sh +++ b/.github/setup-results.sh @@ -10,9 +10,3 @@ CONFIG="--verbose --configuration .github/phpunit-$DB.xml" # Running PHPUnit tests vendor/bin/phpunit ${CONFIG} - -# Agents will merge all coverage data... -#if [[ "${GITHUB_EVENT_NAME}" == "pull_request" ]] -#then -# bash <(curl -s https://codecov.io/bash) -s "/tmp" -f '*.xml' -t "$CODECOV_TOKEN" -#fi