Skip to content

Commit

Permalink
Persist test suites and set PLUGIN_DIR to GITHUB_WORKSPACE
Browse files Browse the repository at this point in the history
- Update .env file creation to set PLUGIN_DIR=${GITHUB_WORKSPACE} so that plugin files (e.g. phpunit.xml) are found in the repository.
- Persist the wordpress-latest-tests-lib directory in the workspace artifact to ensure test suite configuration is available.
- Enable inclusion of hidden files in the workspace artifact upload.
- Add verification steps to check for the existence of the .env file and wp-tests-config.php before running tests.
  • Loading branch information
zackkatz committed Feb 17, 2025
1 parent 5b58977 commit 7297115
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ jobs:
- name: Clone GV Tooling
run: gh repo clone GravityKit/Tooling $HOME/tooling

# Create .env file in docker-unit-tests folder with absolute WP_LATEST_TESTS_DIR
# Create .env file in docker-unit-tests folder using GITHUB_WORKSPACE for PLUGIN_DIR
- name: Create .env file in docker-unit-tests if missing
run: |
mkdir -p "$HOME/tooling/docker-unit-tests"
if [ ! -f "$HOME/tooling/docker-unit-tests/.env" ]; then
echo "PLUGIN_DIR=$HOME" > "$HOME/tooling/docker-unit-tests/.env"
echo "PLUGIN_DIR=${GITHUB_WORKSPACE}" > "$HOME/tooling/docker-unit-tests/.env"
echo "WP_LATEST_TESTS_DIR=$HOME/wordpress-latest-tests-lib" >> "$HOME/tooling/docker-unit-tests/.env"
echo "PHPUNIT_DIR=$HOME/phpunit" >> "$HOME/tooling/docker-unit-tests/.env"
echo "GF_PLUGIN_DIR=$HOME/gravityforms" >> "$HOME/tooling/docker-unit-tests/.env"
Expand All @@ -46,7 +46,6 @@ jobs:
GH_ACCESS_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }}
run: composer config --global --auth github-oauth.github.com "$GH_ACCESS_TOKEN"

# Ensure test_dependencies directory exists before caching
- name: Ensure test_dependencies directory exists
run: mkdir -p $HOME/test_dependencies

Expand All @@ -71,7 +70,7 @@ jobs:
GH_AUTH_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }}
run: bash $HOME/tooling/docker-unit-tests/docker-unit-tests.sh prepare_all

# Persist workspace artifact including the test suites folder
# Persist workspace artifact including test suites
- name: Prepare Workspace Artifact
run: |
mkdir -p workspace_artifact
Expand Down Expand Up @@ -118,7 +117,6 @@ jobs:
rsync -a /tmp/workspace/ $HOME/
fi
# Ensure .env file in docker-unit-tests exists (should be present from prepare job)
- name: Verify .env file in docker-unit-tests exists
run: |
if [ -f "$HOME/tooling/docker-unit-tests/.env" ]; then
Expand Down Expand Up @@ -167,12 +165,11 @@ jobs:
exit 1
fi
# (Optionally) Verify that the test suite is configured
- name: Check Test Suite Configuration
run: |
source $HOME/tooling/docker-unit-tests/.env
if [ ! -f "$WP_LATEST_TESTS_DIR/wp-tests-config.php" ]; then
echo "Test suite not configured!" >&2
echo "wp-tests-config.php not found!" >&2
exit 1
else
echo "Test suite is configured."
Expand Down

0 comments on commit 7297115

Please sign in to comment.