Merge pull request #332 from moreonion/messages-app-runtime-compiler #287
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
on: | |
push: | |
branches: [ 7.x-2.x ] | |
pull_request: | |
branches: [ 7.x-2.x ] | |
jobs: | |
phpunit: | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
php-versions: ["7.3", "7.4"] | |
name: phpunit on PHP ${{ matrix.php-versions }} | |
env: | |
DB_DATABASE: drupal | |
DB_USER: root | |
DB_PASSWORD: root | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup PHP ${{ matrix.php-versions }} | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-versions }} | |
- name: Start MySQL | |
run: | | |
sudo systemctl start mysql | |
mysql -e 'CREATE DATABASE ${{ env.DB_DATABASE }};' -u${{ env.DB_USER }} -p${{ env.DB_PASSWORD }} | |
mysql -e "ALTER USER '${{ env.DB_USER }}'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root';" -u${{ env.DB_USER }} -p${{ env.DB_PASSWORD }} | |
- name: Set env | |
run: | | |
echo "REPO=`pwd`" >> $GITHUB_ENV | |
echo "COMPOSER_HOME=${HOME}/.config/composer" >> $GITHUB_ENV | |
echo "ROOT=${HOME}/drupal-root" >> $GITHUB_ENV | |
- name: Get Composer Cache Directory | |
id: composer-cache | |
run: | | |
echo "::set-output name=dir::$(composer config cache-files-dir)" | |
- uses: actions/cache@v2 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer- | |
restore-keys: | | |
${{ runner.os }}-composer- | |
- name: Install composer packages | |
run: | | |
mkdir -p $COMPOSER_HOME | |
cd $COMPOSER_HOME | |
composer require drush/drush:8.3.* phpunit/phpunit:^8 torotil/upal:2.0.0-RC1 | |
- name: Bootstrap drupal | |
run: | | |
php -d sendmail_path=`which true` $COMPOSER_HOME/vendor/bin/drush.php --yes core-quick-drupal --core=drupal-7.82 --profile=testing --no-server --db-url=mysql://${{ env.DB_USER }}:${{ env.DB_PASSWORD }}@127.0.0.1:3306/${{ env.DB_DATABASE }} --root=$ROOT | |
ln -s $REPO $ROOT/sites/all/modules/module_under_test | |
cd $ROOT | |
curl https://www.drupal.org/files/issues/1891356-drupal_static_reset-on-module-changes-30-D7.patch | patch -p1 | |
drush dl --cache-duration-releasexml=0 little_helpers-2.0-alpha12 | |
drush --yes pm-enable campaignion_test | |
- name: Run phpunit tests | |
run: UPAL_ROOT=$ROOT UPAL_WEB_URL=http://127.0.0.1 XDEBUG_MODE=coverage phpunit --bootstrap=$COMPOSER_HOME/vendor/torotil/upal/bootstrap.php --coverage-clover=coverage.xml . | |
- uses: codecov/codecov-action@v1 | |
yarn: | |
env: | |
APP_DIRS: campaignion_email_to_target/datasets_app campaignion_email_to_target/messages_app campaignion_wizard/redirects_app | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: "Setup node" | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18.12.1' | |
cache: 'yarn' | |
cache-dependency-path: '**/yarn.lock' | |
- name: Set env | |
run: | | |
echo "REPO=`pwd`" >> $GITHUB_ENV | |
- name: Get yarn cache directory path | |
id: yarn-cache-dir-path | |
run: echo "::set-output name=dir::$(yarn cache dir)" | |
- uses: actions/cache@v3 | |
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) | |
with: | |
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- name: yarn install | |
run: | | |
for d in ${{ env.APP_DIRS }} | |
do | |
cd $REPO/$d | |
yarn install --frozen-lockfile | |
done | |
- name: yarn unit | |
run: | | |
for d in ${{ env.APP_DIRS }} | |
do | |
cd $REPO/$d | |
yarn unit | |
done | |
- uses: codecov/codecov-action@v1 |