Skip to content

Commit

Permalink
#299 Add Yarn 4 to tests (#383)
Browse files Browse the repository at this point in the history
  • Loading branch information
justafish authored Feb 16, 2024
1 parent ae54824 commit c362eae
Show file tree
Hide file tree
Showing 4 changed files with 204 additions and 12 deletions.
112 changes: 109 additions & 3 deletions .github/workflows/TestFunctional.yml
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,59 @@ jobs:
name: test_result
path: test_result

Test-Yarn-4-Node-Linker:
runs-on: ubuntu-22.04
needs: Build
steps:
- uses: actions/download-artifact@v3
with:
name: test-functional-build

- name: Restore Workspace
run: |
cd ../
mv ${{ github.workspace }}/drainpipe.zip /tmp/drainpipe.zip
unzip -o /tmp/drainpipe.zip -d ${{ github.workspace }}
cd ${{ github.workspace }}
- uses: ./drainpipe/scaffold/github/actions/common/set-env

- name: Install DDEV
uses: ./drainpipe/scaffold/github/actions/common/ddev
with:
git-name: Drainpipe Bot
git-email: no-reply@example.com#

- name: Start DDEV
run: ddev start

- name: Setup Nightwatch
run: |
ddev config --nodejs-version=21
ddev restart
ddev yarn set version berry
ddev yarn set version 4
ddev yarn init -y
yarn config set nodeLinker node-modules
ddev yarn add nightwatch nightwatch-accessibility @lullabot/nightwatch-drupal-commands lodash --dev
- name: Install Drupal
run: |
ddev drush --yes site:install
ddev drush --uri=https://drupal_firefox --yes site:install
ddev drush --uri=https://drupal_chrome --yes site:install
ddev drush config:export --yes
- name: Run Functional Tests
run: ddev task test:functional

- name: Upload test artifacts
if: ${{ always() }}
uses: actions/upload-artifact@v3
with:
name: test_result
path: test_result

Test-Yarn-3:
runs-on: ubuntu-22.04
needs: Build
Expand Down Expand Up @@ -250,10 +303,63 @@ jobs:
echo ' "nightwatch@*":' >> .yarnrc.yml
echo ' dependencies:' >> .yarnrc.yml
echo ' ws: "*"' >> .yarnrc.yml
echo ' lodash: "*"' >> .yarnrc.yml
echo ' rimraf: "*"' >> .yarnrc.yml
ddev yarn add nightwatch nightwatch-axe-verbose @lullabot/nightwatch-drupal-commands --dev
yarn
- name: Install Drupal
run: |
ddev drush --yes site:install
ddev drush --uri=https://drupal_firefox --yes site:install
ddev drush --uri=https://drupal_chrome --yes site:install
ddev drush config:export --yes
- name: Run Functional Tests
run: ddev task test:functional

- name: Upload test artifacts
if: ${{ always() }}
uses: actions/upload-artifact@v3
with:
name: test_result
path: test_result

Test-Yarn-4:
runs-on: ubuntu-22.04
needs: Build
steps:
- uses: actions/download-artifact@v3
with:
name: test-functional-build

- name: Restore Workspace
run: |
cd ../
mv ${{ github.workspace }}/drainpipe.zip /tmp/drainpipe.zip
unzip -o /tmp/drainpipe.zip -d ${{ github.workspace }}
cd ${{ github.workspace }}
- uses: ./drainpipe/scaffold/github/actions/common/set-env

- name: Install DDEV
uses: ./drainpipe/scaffold/github/actions/common/ddev
with:
git-name: Drainpipe Bot
git-email: no-reply@example.com#

- name: Start DDEV
run: ddev start

- name: Setup Nightwatch
run: |
ddev config --nodejs-version=21
ddev restart
ddev yarn set version berry
ddev yarn init -y
echo "packageExtensions:" >> .yarnrc.yml
echo ' "nightwatch@*":' >> .yarnrc.yml
echo ' dependencies:' >> .yarnrc.yml
echo ' ws: "*"' >> .yarnrc.yml
ddev yarn cache clear
ddev yarn add nightwatch nightwatch-axe-verbose @lullabot/nightwatch-drupal-commands --dev
- name: Install Drupal
run: |
Expand Down
83 changes: 81 additions & 2 deletions .github/workflows/TestMetapackages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ jobs:
- name: Compile Sass
run: ddev task sass

Test-Sass-Yarn-Berry:
Test-Sass-Yarn-3:
runs-on: ubuntu-22.04
needs: Build
steps:
Expand Down Expand Up @@ -169,6 +169,45 @@ jobs:
- name: Compile Sass
run: ddev task sass

Test-Sass-Yarn-4:
runs-on: ubuntu-22.04
needs: Build
steps:
- uses: actions/download-artifact@v3
with:
name: test-metapackage-build

- name: Restore Workspace
run: |
cd ../
mv ${{ github.workspace }}/drainpipe.zip /tmp/drainpipe.zip
unzip -o /tmp/drainpipe.zip -d ${{ github.workspace }}
cd ${{ github.workspace }}
- uses: ./drainpipe/scaffold/github/actions/common/set-env

- name: Install DDEV
uses: ./drainpipe/scaffold/github/actions/common/ddev
with:
git-name: Drainpipe Bot
git-email: no-reply@example.com#

- name: Start DDEV
run: ddev start

- name: Setup Sass
run: |
ddev config --nodejs-version=21
ddev restart
ddev yarn set version berry
ddev yarn set version 4
ddev yarn init -y
ddev yarn cache clear
ddev yarn add ./drainpipe/metapackages/sass --dev
- name: Compile Sass
run: ddev task sass

Test-JavaScript-NPM:
runs-on: ubuntu-22.04
needs: Build
Expand Down Expand Up @@ -240,7 +279,7 @@ jobs:
- name: Compile JavaScript
run: ddev task javascript

Test-JavaScript-Yarn-Berry:
Test-JavaScript-Yarn-3:
runs-on: ubuntu-22.04
needs: Build
steps:
Expand Down Expand Up @@ -276,3 +315,43 @@ jobs:
- name: Compile JavaScript
run: ddev task javascript

Test-JavaScript-Yarn-4:
runs-on: ubuntu-22.04
needs: Build
steps:
- uses: actions/download-artifact@v3
with:
name: test-metapackage-build

- name: Restore Workspace
run: |
cd ../
mv ${{ github.workspace }}/drainpipe.zip /tmp/drainpipe.zip
unzip -o /tmp/drainpipe.zip -d ${{ github.workspace }}
cd ${{ github.workspace }}
- uses: ./drainpipe/scaffold/github/actions/common/set-env

- name: Install DDEV
uses: ./drainpipe/scaffold/github/actions/common/ddev
with:
git-name: Drainpipe Bot
git-email: no-reply@example.com#

- name: Start DDEV
run: ddev start

- name: Setup Sass
run: |
ddev config --nodejs-version=21
ddev restart
ddev yarn set version berry
ddev yarn set version 4
ddev yarn init -y
ddev yarn cache clear
ddev yarn add focus-trap@^6.7.3
ddev yarn add ./drainpipe/metapackages/javascript --dev
- name: Compile JavaScript
run: ddev task javascript
16 changes: 12 additions & 4 deletions tasks/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,9 @@ tasks:
interactive: true
cmds:
- |
PACKAGES="nightwatch nightwatch-axe-verbose @lullabot/nightwatch-drupal-commands"
PACKAGES="nightwatch @lullabot/nightwatch-drupal-commands"
if [ ! -f "package.json" ]; then
echo -n "No package.json exists, would you like to use yarn1, npm, or yarn? "
echo -n "No package.json exists, would you like to use yarn1, npm, yarn3 (node <= 20), or yarn (node >= 21)? "
read -r PACKAGE_MANAGER
if [ "$PACKAGE_MANAGER" == "npm" ]; then
if [ "$IS_DDEV_PROJECT" == "true" ]; then
Expand All @@ -219,15 +219,23 @@ tasks:
yarn set version classic
yarn init -y
yarn add $PACKAGES lodash --dev
elif [ "$PACKAGE_MANAGER" == "yarn" ]; then
elif [ "$PACKAGE_MANAGER" == "yarn3" ]; then
yarn set version berry
yarn set version 3
yarn init
echo "packageExtensions:" >> .yarnrc.yml
echo ' "nightwatch@*":' >> .yarnrc.yml
echo ' dependencies:' >> .yarnrc.yml
echo ' ws: "*"' >> .yarnrc.yml
echo ' lodash: "*"' >> .yarnrc.yml
yarn add $PACKAGES --dev
elif [ "$PACKAGE_MANAGER" == "yarn" ]; then
yarn set version berry
yarn init
echo "packageExtensions:" >> .yarnrc.yml
echo ' "nightwatch@*":' >> .yarnrc.yml
echo ' dependencies:' >> .yarnrc.yml
echo ' ws: "*"' >> .yarnrc.yml
yarn cache clear
yarn add $PACKAGES --dev
else
echo "Sorry I'm not aware of that package manager. Please first init package.json with it yourself manually."
Expand Down
5 changes: 2 additions & 3 deletions tests/local-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,16 @@ echo " - exec: mysql -uroot -proot -hdb -e \"CREATE DATABASE IF NOT EXISTS fi
echo " - exec: mysql -uroot -proot -hdb -e \"CREATE DATABASE IF NOT EXISTS chrome; GRANT ALL ON chrome.* TO 'db'@'%';\"" >> .ddev/config.yaml
ddev config --web-environment="NIGHTWATCH_DRUPAL_URL_FIREFOX=https://drupal_firefox,NIGHTWATCH_DRUPAL_URL_CHROME=https://drupal_chrome"
ddev config --additional-hostnames="*.drainpipe"
ddev config --nodejs-version=21
ddev restart

ddev yarn set version berry
ddev yarn set version 3
ddev yarn init -y
ddev yarn cache clear
echo "packageExtensions:" >> .yarnrc.yml
echo ' "nightwatch@*":' >> .yarnrc.yml
echo ' dependencies:' >> .yarnrc.yml
echo ' ws: "*"' >> .yarnrc.yml
echo ' lodash: "*"' >> .yarnrc.yml
echo ' rimraf: "*"' >> .yarnrc.yml
ddev yarn add nightwatch nightwatch-axe-verbose @lullabot/nightwatch-drupal-commands --dev
yarn

Expand Down

0 comments on commit c362eae

Please sign in to comment.