COMCL-670: Fix Token Usage #209
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Tests | |
on: pull_request | |
jobs: | |
run-unit-tests: | |
runs-on: ubuntu-latest | |
container: compucorp/civicrm-buildkit:1.3.1-php8.0-chrome | |
env: | |
CIVICRM_EXTENSIONS_DIR: site/web/sites/all/modules/civicrm/tools/extensions | |
GITHUB_BASE_REF: ${{ github.base_ref }} | |
GITHUB_HEAD_REF: ${{ github.head_ref }} | |
services: | |
mysql: | |
image: mysql:5.7 | |
env: | |
MYSQL_ROOT_PASSWORD: root | |
ports: | |
- 3306 | |
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 | |
steps: | |
- name: Config mysql database as per CiviCRM requirement | |
run: echo "SET GLOBAL sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));" | mysql -u root --password=root --host=mysql | |
- name: Composer version downgrade 2.2.5 | |
run: composer self-update 2.2.5 | |
- name: Config amp | |
run : amp config:set --mysql_dsn=mysql://root:root@mysql:3306 | |
- name: Build Drupal site | |
run: civibuild create drupal-clean --civi-ver 5.75.0 --cms-ver 7.79 --web-root $GITHUB_WORKSPACE/site | |
- uses: compucorp/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
repo: compucorp/civicrm-core | |
version: 5.75.0 | |
path: site/web/sites/all/modules/civicrm | |
- uses: actions/checkout@v2 | |
with: | |
path: ${{ env.CIVICRM_EXTENSIONS_DIR }}/uk.co.compucorp.certificate | |
- name: Download Certificate dependencies | |
working-directory: ${{ env.CIVICRM_EXTENSIONS_DIR }} | |
run: | | |
git clone --depth 1 https://github.com/civicrm/org.civicrm.shoreditch.git | |
git clone --depth 1 -b 4.2.0-dev --no-single-branch https://github.com/compucorp/uk.co.compucorp.civicase.git | |
git clone --depth 1 -b 2.1.0-dev https://github.com/compucorp/uk.co.compucorp.usermenu.git | |
- name: Setup Test DB | |
run: echo "CREATE DATABASE civicrm_test;" | mysql -u root --password=root --host=mysql | |
- name: Update civicrm.settings.php | |
run: | | |
FILE_PATH="$GITHUB_WORKSPACE/site/web/sites/default/civicrm.settings.php" | |
INSERT_LINE="\$GLOBALS['_CV']['TEST_DB_DSN'] = 'mysql://root:root@mysql:3306/civicrm_test?new_link=true';" | |
TMP_FILE=$(mktemp) | |
while IFS= read -r line | |
do | |
echo "$line" >> "$TMP_FILE" | |
if [ "$line" = "<?php" ]; then | |
echo "$INSERT_LINE" >> "$TMP_FILE" | |
fi | |
done < "$FILE_PATH" | |
mv "$TMP_FILE" "$FILE_PATH" | |
echo "File modified successfully." | |
- name: Install Certificate and its dependencies | |
working-directory: ${{ env.CIVICRM_EXTENSIONS_DIR }} | |
run: | | |
cv en shoreditch usermenu civicase | |
cv en uk.co.compucorp.certificate | |
- name: Run JS unit tests | |
working-directory: ${{ env.CIVICRM_EXTENSIONS_DIR }}/uk.co.compucorp.certificate | |
run: | | |
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" | |
nvm install | |
nvm use | |
npm ci | |
npx gulp test | |
- name: Run phpunit tests | |
if: ${{ always() }} | |
working-directory: ${{ env.CIVICRM_EXTENSIONS_DIR }}/uk.co.compucorp.certificate | |
run: phpunit8 |