From a0ee3efa0f3f7d90da380930ceee4d8a4673c87c Mon Sep 17 00:00:00 2001 From: diosmosis Date: Tue, 24 Oct 2023 07:48:25 -0700 Subject: [PATCH] add wdio tests as github action --- .github/workflows/tests.yml | 35 +++++++++++++++++++++++++++------ scripts/local-dev-entrypoint.sh | 6 ++++-- 2 files changed, 33 insertions(+), 8 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 1ab530f7c..2fd8c7994 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -105,23 +105,46 @@ jobs: strategy: fail-fast: false matrix: - wp-versions: [ 'latest', 'trunk' ] # TODO + wp-versions: [ 'latest', 'trunk' ] php-versions: [ '7.2', '8.1' ] permissions: contents: read # <--- allows to read repo steps: + - uses: actions/checkout@v3 + with: + lfs: true + persist-credentials: false + # setup firefox - uses: browser-actions/setup-firefox@v1 - run: firefox --version - # create .env file - # TODO + # setup node + - uses: actions/setup-node@v3 + with: + node-version: 16 + cache: npm + cache-dependency-path: '**/package-lock.json' - # start local environment via docker-compose - # TODO + # docker-compose up + - uses: isbang/compose-action@v1.5.1 + with: + services: wordpress + env: + PHP_VERSION: ${{ matrix.php-versions }} + WOOCOMMERCE: 1 + WORDPRESS_FOLDER: test + RESET_DATABASE: 1 + WORDPRESS_VERSION: ${{ matrix.wp-versions }} # run tests - # TODO + - run: npm run wdio + env: + PHP_VERSION: ${{ matrix.php-versions }} + WOOCOMMERCE: 1 + WORDPRESS_FOLDER: test + RESET_DATABASE: 1 + WORDPRESS_VERSION: ${{ matrix.wp-versions }} checkstyle: runs-on: 'ubuntu-20.04' diff --git a/scripts/local-dev-entrypoint.sh b/scripts/local-dev-entrypoint.sh index f78722fa9..3e93bd25a 100755 --- a/scripts/local-dev-entrypoint.sh +++ b/scripts/local-dev-entrypoint.sh @@ -19,14 +19,16 @@ chmod +x /var/www/html/wp-cli.phar # TODO: switch download to use wp-cli instead of just curling (also can use wp db create instead of raw php) # install wordpress if not present -WORDPRESS_VERSION=${WORDPRESS_VERSION:-$LATEST_WORDPRESS_VERSION} +if [[ "$WORDPRESS_VERSION" = "latest" || -z "$WORDPRESS_VERSION" ]]; then + WORDPRESS_VERSION="$LATEST_WORDPRESS_VERSION" +fi WORDPRESS_FOLDER=${WORDPRESS_FOLDER:-$WORDPRESS_VERSION} # TODO: handle trunk () if [ ! -d "/var/www/html/$WORDPRESS_FOLDER" ]; then WORDPRESS_URL="https://wordpress.org/wordpress-$WORDPRESS_VERSION.zip" - if [ "$WORDPRESS_FOLDER" = "trunk" ]; then + if [ "$WORDPRESS_VERSION" = "trunk" ]; then WORDPRESS_URL="https://wordpress.org/nightly-builds/wordpress-latest.zip" fi