Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attempt to fix why coverage data is not found #3788

Merged
merged 1 commit into from
Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/setup-failure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ 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 '*.clover'
bash <(curl -s https://codecov.io/bash) -s "/tmp" -f '*.xml' -t "${CODECOV_TOKEN}"
fi
51 changes: 35 additions & 16 deletions .github/setup-selenium.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,45 @@
set -e
set -x

# Passed params
# Access passed params
DB=$1
PHP_VERSION=$2
CODECOV_TOKEN=$3

# Per actions in the tests.yaml file
#
# Current Versions for Ref
# Selenium 3.141.59 jar
# Chrome 123.0.6312.58
# ChromeDriver 123.0.6312.58

echo "Ensuring Selenium Started"
# 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
SELENIUM_DOWNLOAD_URL=https://selenium-release.storage.googleapis.com/3.141/selenium-server-standalone-3.141.59.jar

# Location of chromedriver for use as webdriver in xvfb
CHROMEDRIVER_ZIP=/tmp/chromedriver_linux64.zip

# Download Selenium
echo "Downloading Selenium"
sudo mkdir -p $(dirname "$SELENIUM_JAR")
sudo wget -nv -O "$SELENIUM_JAR" "$SELENIUM_DOWNLOAD_URL"
sudo chmod 777 "$SELENIUM_JAR"

# Install Chrome
echo "Installing Browser"

# Available Chrome Versions
CHROME_VERSION='123.0.6312.58-1'
wget https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_${CHROME_VERSION}_amd64.deb -q
sudo dpkg -i google-chrome-stable_${CHROME_VERSION}_amd64.deb

# Download Chrome Driver
# https://storage.googleapis.com/chrome-for-testing-public/123.0.6312.58/linux64/chromedriver-linux64.zip
echo "Downloading chromedriver"
CHROME_VERSION=$(google-chrome --version) \
&& wget -nv -O "$CHROMEDRIVER_ZIP" "https://storage.googleapis.com/chrome-for-testing-public/123.0.6312.58/linux64/chromedriver-linux64.zip" \
&& unzip "$CHROMEDRIVER_ZIP" \
&& sudo mv chromedriver-linux64/chromedriver /usr/local/bin/chromedriver \
&& sudo chmod +x /usr/local/bin/chromedriver \
&& chromedriver --version

# Start Selenium using default chosen webdriver
export DISPLAY=:99.0
xvfb-run --server-args="-screen 0, 2560x1440x24" java -Dwebdriver.chrome.driver=/usr/local/bin/chromedriver -jar "$SELENIUM_JAR" > /tmp/selenium.log &
wget --retry-connrefused --tries=120 --waitretry=3 --output-file=/dev/null "$SELENIUM_HUB_URL/wd/hub/status" -O /dev/null

# Test to see if the selenium server really did start
Expand All @@ -43,10 +68,4 @@ else

# Run the phpunit selenium tests
vendor/bin/phpunit --verbose --debug --configuration .github/phpunit-webtest.xml

# 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
fi
28 changes: 10 additions & 18 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,38 +78,30 @@ jobs:
run: .github/setup-elkarte.sh $DB $PHP_VERSION
working-directory: ./elkarte

- name: Download Selenium
run: |
sudo mkdir -p /usr/share/selenium
wget -nv -O /usr/share/selenium/selenium-server-standalone.jar https://selenium-release.storage.googleapis.com/3.141/selenium-server-standalone-3.141.59.jar
sudo chmod 777 /usr/share/selenium/selenium-server-standalone.jar

- name: Setup ChromeDriver
uses: nanasess/setup-chromedriver@v2

- name: Start ChromeDriver
run: |
export DISPLAY=:99.0
xvfb-run --server-args="-screen 0, 2560x1440x24" java -Dwebdriver.chrome.driver=/usr/local/bin/chromedriver -jar /usr/share/selenium/selenium-server-standalone.jar > /tmp/selenium.log &

- name: Run Unit Tests
env:
DB: ${{ matrix.db }}
PHP_VERSION: ${{ matrix.php }}
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
run: .github/setup-selenium.sh $DB $PHP_VERSION $CODECOV_TOKEN
run: .github/setup-selenium.sh $DB $PHP_VERSION
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 $DB $PHP_VERSION $CODECOV_TOKEN
working-directory: ./elkarte

- name: Server Error Log
env:
DB: ${{ matrix.db }}
PHP_VERSION: ${{ matrix.php }}
run: |
sudo cat /var/log/nginx/127.0.0.1.error.log
sudo cat /tmp/php_errors.log
# sudo cat /tmp/selenium.log
.github/setup-failure.sh $DB $PHP_VERSION
sudo cat /tmp/selenium.log
working-directory: ./elkarte
# End Selenium headless browser testing

Expand Down
Loading