Tests #11
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Tests | |
on: | |
pull_request: | |
push: | |
branches: [ main ] | |
workflow_dispatch: | |
inputs: | |
debug_enabled: | |
type: boolean | |
description: Debug with tmate | |
required: false | |
default: false | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
# This is required for "gautamkrishnar/keepalive-workflow", see "ddev/github-action-add-on-test" | |
permissions: | |
actions: write | |
jobs: | |
tests: | |
strategy: | |
matrix: | |
ddev_version: [stable, HEAD] | |
fail-fast: false | |
runs-on: ubuntu-latest | |
# Define a job-level environment variable to check for the secret | |
env: | |
DD_API_KEY: ${{ secrets.DD_API_KEY }} | |
steps: | |
# 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 }} | |
debug_enabled: ${{ github.event.inputs.debug_enabled }} | |
addon_repository: ${{ env.GITHUB_REPOSITORY }} | |
addon_ref: ${{ env.GITHUB_REF }} |