Skip to content

Commit

Permalink
Update automated testing workflows.
Browse files Browse the repository at this point in the history
  • Loading branch information
laceysanderson committed Mar 30, 2024
1 parent 6e19c12 commit 35f41ac
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 29 deletions.
32 changes: 21 additions & 11 deletions .github/workflows/ALL-PHPUnit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,37 @@ jobs:
fail-fast: false
matrix:
php-version:
- "8.0"
- "8.1"
- "8.2"
- "8.3"
pgsql-version:
- "13"
- "16"
drupal-version:
- "9.3.x-dev"
- "9.4.x-dev"
- "9.5.x-dev"
# - "10.0.x-dev"
# exclude:
# - php-version: "8.0"
# pgsql-version: "13"
# drupal-version: "10.0.x-dev"
- "10.0.x-dev"
- "10.1.x-dev"
- "10.2.x-dev"
exclude:
- php-version: "8.3"
pgsql-version: "13"
drupal-version: "10.0.x-dev"
- php-version: "8.3"
pgsql-version: "13"
drupal-version: "10.1.x-dev"
- php-version: "8.3"
pgsql-version: "16"
drupal-version: "10.0.x-dev"
- php-version: "8.3"
pgsql-version: "16"
drupal-version: "10.1.x-dev"

steps:
# Check out the repo
- name: Checkout Repository
uses: actions/checkout@v3
uses: actions/checkout@v4
# Here we pull the development tripaldocker image for this combo in our matrix
- name: Run Automated testing
uses: tripal/test-tripal-action@v1.0
uses: tripal/test-tripal-action@v1.5
with:
directory-name: $PKG_NAME
modules: $MODULES
Expand Down
36 changes: 18 additions & 18 deletions .github/workflows/ALL-testCoverage-codeclimate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ on: [push]
env:
PKG_NAME: tripal_blast
MODULES: "tripal_blast"
IMAGE_TAG: drupal9.5.x-dev-php8.1-pgsql13
IMAGE_TAG: drupal10.2.x-dev-php8.2-pgsql16
SIMPLETEST_BASE_URL: "http://localhost"
SIMPLETEST_DB: "pgsql://drupaladmin:drupal9developmentonlylocal@localhost/sitedb"
BROWSER_OUTPUT_DIRECTORY: "/var/www/drupal9/web/sites/default/files/simpletest"
SIMPLETEST_DB: "pgsql://drupaladmin:drupaldevelopmentonlylocal@localhost/sitedb"
BROWSER_OUTPUT_DIRECTORY: "/var/www/drupal/web/sites/default/files/simpletest"

jobs:
# Job 1: 'build'
Expand All @@ -20,7 +20,7 @@ jobs:
steps:
# Check out the repo
- name: Checkout Repository
uses: actions/checkout@v3
uses: actions/checkout@v4
# Here we pull the development tripaldocker image for this combo in our matrix
- name: Pull TripalDocker Image
run: |
Expand All @@ -30,45 +30,45 @@ jobs:
- name: Spin up Docker locally
run: |
docker run --publish=80:80 --name=tripaldocker -tid \
--volume=`pwd`:/var/www/drupal9/web/modules/contrib/$PKG_NAME tripalproject/tripaldocker:$IMAGE_TAG
--volume=`pwd`:/var/www/drupal/web/modules/contrib/$PKG_NAME tripalproject/tripaldocker:$IMAGE_TAG
# Install the modules
- name: Install our package in Docker
run: |
docker exec tripaldocker service postgresql restart
docker exec tripaldocker drush en $MODULES --yes
# Ensure we have the variables we need.
- name: Inject slug/short variables
uses: rlespinasse/github-slug-action@v3.x
uses: rlespinasse/github-slug-action@v4
# Prepare for code coverage.
- name: Prepare for Code Coverage
run: |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
docker cp cc-test-reporter tripaldocker:/var/www/drupal9/web/modules/contrib/$PKG_NAME
docker exec tripaldocker chmod a+x /var/www/drupal9/web/modules/contrib/$PKG_NAME/cc-test-reporter
docker exec --workdir=/var/www/drupal9/web/modules/contrib/$PKG_NAME tripaldocker ./cc-test-reporter before-build --debug
docker cp cc-test-reporter tripaldocker:/var/www/drupal/web/modules/contrib/$PKG_NAME
docker exec tripaldocker chmod a+x /var/www/drupal/web/modules/contrib/$PKG_NAME/cc-test-reporter
docker exec --workdir=/var/www/drupal/web/modules/contrib/$PKG_NAME tripaldocker ./cc-test-reporter before-build --debug
# Runs the PHPUnit tests.
# https://github.com/mheap/phpunit-github-actions-printer is used
# to report PHPUnit fails in a meaningful way to github in PRs.
# Stopped using mheap due to warning w/ phpunit8->9
- name: Run Tests for Coverage
env:
SIMPLETEST_BASE_URL: "http://localhost"
SIMPLETEST_DB: "pgsql://drupaladmin:drupal9developmentonlylocal@localhost/sitedb"
BROWSER_OUTPUT_DIRECTORY: "/var/www/drupal9/web/sites/default/files/simpletest"
SIMPLETEST_DB: "pgsql://drupaladmin:drupaldevelopmentonlylocal@localhost/sitedb"
BROWSER_OUTPUT_DIRECTORY: "/var/www/drupal/web/sites/default/files/simpletest"
run: |
docker exec tripaldocker service postgresql restart
docker exec -e SIMPLETEST_BASE_URL=$SIMPLETEST_BASE_URL \
-e SIMPLETEST_DB=$SIMPLETEST_DB \
-e BROWSER_OUTPUT_DIRECTORY=$BROWSER_OUTPUT_DIRECTORY \
--workdir=/var/www/drupal9/web/modules/contrib/$PKG_NAME \
--workdir=/var/www/drupal/web/modules/contrib/$PKG_NAME \
tripaldocker phpunit --coverage-text \
--coverage-clover /var/www/drupal9/web/modules/contrib/$PKG_NAME/clover.xml
docker exec tripaldocker ls /var/www/drupal9/web/modules/contrib/$PKG_NAME
--coverage-clover /var/www/drupal/web/modules/contrib/$PKG_NAME/clover.xml
docker exec tripaldocker ls /var/www/drupal/web/modules/contrib/$PKG_NAME
- name: Publish code coverage to Code Climate
run: |
docker exec --workdir=/var/www/drupal9/web/modules/contrib/$PKG_NAME tripaldocker \
git config --global --add safe.directory /var/www/drupal9/web/modules/contrib/$PKG_NAME
docker exec --workdir=/var/www/drupal9/web/modules/contrib/$PKG_NAME \
docker exec --workdir=/var/www/drupal/web/modules/contrib/$PKG_NAME tripaldocker \
git config --global --add safe.directory /var/www/drupal/web/modules/contrib/$PKG_NAME
docker exec --workdir=/var/www/drupal/web/modules/contrib/$PKG_NAME \
tripaldocker ./cc-test-reporter after-build clover.xml \
--id ${{ secrets.CODECLIMATE_TEST_REPORTER_ID }} \
--debug -t clover -p /var/www/drupal9/web/modules/contrib/$PKG_NAME
--debug -t clover -p /var/www/drupal/web/modules/contrib/$PKG_NAME

0 comments on commit 35f41ac

Please sign in to comment.