Skip to content

Commit

Permalink
Move .env file creation after cloning and ensure directory exists
Browse files Browse the repository at this point in the history
- Reorder the .env file creation step to occur after cloning GV Tooling.
- Add a command to explicitly create the $HOME/tooling/docker-unit-tests directory.
- Export ENV_FILE before running tests to ensure proper sourcing.
- This resolves the "No such file or directory" error when creating the .env file.
  • Loading branch information
zackkatz committed Feb 17, 2025
1 parent d9ffbb8 commit 15d66fc
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,6 @@ jobs:
- name: Checkout Code
uses: actions/checkout@v4

# Create a default .env file in docker-unit-tests folder if missing.
- name: Create .env file in docker-unit-tests if missing
run: |
if [ ! -f "$HOME/tooling/docker-unit-tests/.env" ]; then
echo "PLUGIN_DIR=$HOME" > "$HOME/tooling/docker-unit-tests/.env"
echo "WP_LATEST_TESTS_DIR=./wordpress-latest-tests-lib" >> "$HOME/tooling/docker-unit-tests/.env"
echo "PHPUNIT_DIR=./phpunit" >> "$HOME/tooling/docker-unit-tests/.env"
echo "GF_PLUGIN_DIR=./gravityforms" >> "$HOME/tooling/docker-unit-tests/.env"
echo "GH_AUTH_TOKEN=${{ secrets.GH_ACCESS_TOKEN }}" >> "$HOME/tooling/docker-unit-tests/.env"
fi
- name: Install Docker Compose
run: |
sudo apt-get update
Expand All @@ -41,6 +30,18 @@ jobs:
- name: Clone GV Tooling
run: gh repo clone GravityKit/Tooling $HOME/tooling

# Ensure the docker-unit-tests directory exists and create the .env file there.
- 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 "WP_LATEST_TESTS_DIR=./wordpress-latest-tests-lib" >> "$HOME/tooling/docker-unit-tests/.env"
echo "PHPUNIT_DIR=./phpunit" >> "$HOME/tooling/docker-unit-tests/.env"
echo "GF_PLUGIN_DIR=./gravityforms" >> "$HOME/tooling/docker-unit-tests/.env"
echo "GH_AUTH_TOKEN=${{ secrets.GH_ACCESS_TOKEN }}" >> "$HOME/tooling/docker-unit-tests/.env"
fi
- name: Authenticate GitHub for Composer
env:
GH_ACCESS_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }}
Expand Down

0 comments on commit 15d66fc

Please sign in to comment.