Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kyletaylored committed Jun 25, 2024
1 parent 063465e commit 5bdb2ff
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
21 changes: 16 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
name: tests
name: Tests
on:
pull_request:
push:
branches: [ main ]

schedule:
- cron: '25 08 * * *'

workflow_dispatch:
inputs:
debug_enabled:
Expand All @@ -32,8 +29,22 @@ jobs:

runs-on: ubuntu-latest

# Define a job-level environment variable to check for the secret
env:
DD_API_KEY: ${{ secrets.DD_API_KEY }}

steps:
- uses: ddev/github-action-add-on-test@v2
# Step to check if the secret is provided
- name: Check for DD_API_KEY
if: ${{ env.DD_API_KEY == '' }}
run: |
echo "Error: DD_API_KEY secret is not set. Please provide the secret in the repository settings." >&2
exit 1
# Step to run the test only if the secret is available
- name: Run DDEV Add-on Test
uses: ddev/github-action-add-on-test@v2
if: ${{ env.DD_API_KEY != '' }}
with:
ddev_version: ${{ matrix.ddev_version }}
token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
1 change: 0 additions & 1 deletion install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ pre_install_actions:
#ddev-description:Configure API key
DDEV_APPROOT=$(ddev describe -j | jq -r .raw.approot)
ENV_FILE="$DDEV_APPROOT/.ddev/.env"
DD_API_KEY=""
# Function to read a specific variable from .env file
get_env_var() {
Expand Down
2 changes: 2 additions & 0 deletions tests/test.bats
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ setup() {
ddev delete -Oy ${PROJNAME} >/dev/null 2>&1 || true
cd "${TESTDIR}"
ddev config --project-name=${PROJNAME}
touch .ddev/.env
echo "DD_API_KEY=$DD_API_KEY" > .ddev/.env
ddev start -y >/dev/null
}

Expand Down

0 comments on commit 5bdb2ff

Please sign in to comment.