Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
0f75b87
Update ops.site.deploy.ddev.yml to use run-with-summary.
jonpugh Oct 4, 2025
d39a48b
Update ops.site.deploy.ddev.yml
jonpugh Oct 4, 2025
98cd83a
Use right version
jonpugh Oct 4, 2025
b9b0ac8
Update ops.site.deploy.ddev.yml
jonpugh Oct 4, 2025
c7c9fa6
Update ops.site.deploy.ddev.yml
jonpugh Oct 4, 2025
022b59d
Update ops.site.deploy.ddev.yml
jonpugh Oct 4, 2025
066c9dd
Update ops.site.deploy.ddev.yml
jonpugh Oct 4, 2025
ed0faa2
Update ops.site.deploy.ddev.yml
jonpugh Oct 4, 2025
a5c791d
Fix usage of goatscripts run-with-summary.
jonpugh Oct 8, 2025
2f4907d
Set message.
jonpugh Oct 8, 2025
3068657
Fix path.
jonpugh Oct 8, 2025
952de53
Set path.
jonpugh Oct 8, 2025
895c55a
Try to use run-with-summary when launching server.
jonpugh Oct 8, 2025
9e6d98c
Set path to allow commands.
jonpugh Oct 8, 2025
0bec64b
Set PATH at the top.
jonpugh Oct 8, 2025
29cd587
make identical,
jonpugh Oct 8, 2025
66d7efc
Add goatscripts to path.
jonpugh Oct 8, 2025
f8325cf
Add summary.
jonpugh Oct 8, 2025
042c6bb
Add summary.
jonpugh Oct 8, 2025
97bdc94
try again?
jonpugh Oct 8, 2025
d18e6ea
try again?
jonpugh Oct 8, 2025
f178444
try again?
jonpugh Oct 8, 2025
52c8891
Forgot to download scripts.
jonpugh Oct 8, 2025
dd9ef0e
print git log as well.
jonpugh Oct 8, 2025
a0c07ef
don't bother with summaries for github runners.
jonpugh Oct 8, 2025
a5974c8
Don't cancel in progress site preview deploy runs.
jonpugh Oct 8, 2025
983bf1f
Use run with summary for tests.
jonpugh Oct 8, 2025
f8903f6
Disable instrumentation.
jonpugh Oct 8, 2025
eb67e01
Sleep 4 just to make sure
jonpugh Oct 8, 2025
4ceee25
Curl
jonpugh Oct 8, 2025
5e64dda
Use versioned scripts.
jonpugh Oct 8, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 65 additions & 33 deletions .github/workflows/ops.site.deploy.ddev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,36 +92,41 @@ jobs:
runs-on: ${{ inputs.github_runs_on }}

steps:
- name: Hello world
run: |
echo "-----------------------------"
echo "Hello world!"
echo "-----------------------------"
echo "Who am I: $(whoami)"
echo "Hostname: $(hostname -f)"
echo "-----------------------------"
echo "Path: ${{ inputs.git_root }}"
echo "Git Reference: ${{ inputs.git_reference }}"
echo "Git Repository: ${{ inputs.git_repository }}"
echo "Sync Command: ${{ inputs.sync_command }}"
echo "Deploy Command: ${{ inputs.deploy_command }}"
echo "-----------------------------"

echo "DDEV Config:"
echo "${{ inputs.ddev_config }}"
echo "Project Name: ${{ inputs.ddev_project_name }}"
echo "Project TLD: ${{ inputs.ddev_project_tld }}"
echo "-----------------------------"

- uses: actions/checkout@v4
with:
repository: 'jonpugh/goatscripts'
ref: 'v1.1.0'
path: goatscripts

- name: Clone code
env:
SUCCESS: "Codebase successfully cloned :computer:"
ERROR: "Git clone failed :x:"
SUMMARY: |
- Repository: ${{ inputs.git_repository }}
- Reference: ${{ inputs.git_reference }}
- Root: ${{ inputs.git_root }}
- Environment: ${{ inputs.github_environment_name }}
- URL: ${{ inputs.github_environment_url }}
- Pull Request: ${{ github.event.pull_request.html_url }}

run: |
export PATH=$GITHUB_WORKSPACE/goatscripts/src:$PATH
echo $PATH
if [[ ! -d ${{ inputs.git_root }} ]]; then
git clone ${{ inputs.git_repository }} ${{ inputs.git_root }}
run-with-summary git clone ${{ inputs.git_repository }} ${{ inputs.git_root }}
fi
cd ${{ inputs.git_root }}
git checkout ${{ inputs.git_reference }}
echo -----------------------------
echo "Cloned code to ${{ inputs.git_root }}"

SUMMARY=""

SUCCESS="git status" \
run-with-summary git status

SUCCESS="git log" \
run-with-summary git log -1

start-site:
name: Start site
Expand Down Expand Up @@ -152,27 +157,38 @@ jobs:
exit 1
fi

# Install DDEV, if needed.
# This only works for runners by sudo users. Don't run it if ddev is already installed.
- name: Setup DDEV
uses: ddev/github-action-setup-ddev@v1
if: ${{ env.DDEV_INSTALLED == 'false' }}
with:
autostart: false

- name: Configure DDEV
working-directory: ${{ inputs.git_root }}/.ddev
run: |
ddev config global --instrumentation-opt-in=false
echo "# DDEV Config created by GitHub workflow https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" > ${{ inputs.ddev_config_filename }}
echo "name: ${{ inputs.ddev_project_name }}" >> ${{ inputs.ddev_config_filename }}
echo "project_tld: ${{ inputs.ddev_project_tld }}" >> ${{ inputs.ddev_config_filename }}
echo "${{ inputs.ddev_config }}" >> ${{ inputs.ddev_config_filename }}
echo "$GITHUB_WORKSPACE/goatscripts/src" >> $GITHUB_PATH

# Install DDEV, if needed.
# This only works for runners by sudo users. Don't run it if ddev is already installed.
- name: Setup DDEV
uses: ddev/github-action-setup-ddev@v1
if: ${{ env.DDEV_INSTALLED == 'false' }}
- uses: actions/checkout@v4
with:
autostart: false

repository: 'jonpugh/goatscripts'
ref: 'v1.1.0'
path: goatscripts

- name: Start site
working-directory: ${{ inputs.git_root }}
if: ${{ inputs.run_start_command }}
env:
SUCCESS: "Started DDEV Site :rocket:"
ERROR: "DDEV start failed :x:"
run: |
${{ inputs.start_command }}
run-with-summary ${{ inputs.start_command }}

# Import, sync, install, etc.
prepare-data:
Expand All @@ -187,14 +203,30 @@ jobs:

steps:

- uses: actions/checkout@v4
with:
repository: 'jonpugh/goatscripts'
ref: 'main'
path: goatscripts

- name: Set environment
run: |
echo "$GITHUB_WORKSPACE/goatscripts/src" >> $GITHUB_PATH

- name: Prepare data
working-directory: ${{ inputs.git_root }}
if: ${{ inputs.run_prepare_command }}
env:
SUCCESS: "Site data preparation successful :rocket:"
ERROR: "Site data preparation failed :x:"
run: |
${{ inputs.prepare_command }}
run-with-summary ${{ inputs.prepare_command }}

- name: Deploy command
working-directory: ${{ inputs.git_root }}
if: ${{ inputs.run_deploy_command }}
env:
SUCCESS: "Deploy successful :rocket:"
ERROR: "Deploy failed :x:"
run: |
${{ inputs.deploy_command }}
run-with-summary ${{ inputs.deploy_command }}
25 changes: 20 additions & 5 deletions .github/workflows/site.preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ env:

concurrency:
group: ${{ github.workflow }}-${{ github.event.number }}
cancel-in-progress: true
cancel-in-progress: false

jobs:
# This emulates a persistent server. The ddev.site.deploy.yml jobs require one.
Expand All @@ -24,19 +24,20 @@ jobs:

# Kick off the runner script over and over until there are no more queued jobs.
- name: "Launch runner script."

run: |
while [[ $(curl -s -H "Authorization: token ${GITHUB_TOKEN}" "https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/jobs" | jq -r '.jobs[] | select(.status=="queued") | .id' | wc -l) -gt 0 ]]; do
./github-runner-starter \
--run \
--name=github.actions.runner.${{ github.run_id }}.${{ matrix.runner }} \
--labels=github.actions.runner.${{ github.run_id }} \
--config-sh-options=--ephemeral
sleep 3
sleep 4
done

create-site:
name: Create Preview Site
uses: operations-project/github-action-ddev-runner/.github/workflows/ops.site.deploy.ddev.yml@feature/reusable-workflows
uses: operations-project/github-action-ddev-runner/.github/workflows/ops.site.deploy.ddev.yml@feature/run-with-summary
with:

# Configure your site here.
Expand Down Expand Up @@ -76,9 +77,23 @@ jobs:
needs: create-site
runs-on: github.actions.runner.${{ github.run_id }}
steps:

- uses: actions/checkout@v4
with:
repository: 'jonpugh/goatscripts'
ref: 'main'
path: goatscripts

- name: Set environment
run: |
echo "$GITHUB_WORKSPACE/goatscripts/src" >> $GITHUB_PATH

- name: Check homepage for Hello World.
env:
SUCCESS: "Tests passed! DDEV webserver is online. :boom:"
ERROR: "Unable to load DDEV website. :x:"
run: |
curl -s https://ddev-runner.ddev.site
run-with-summary curl https://ddev-runner.ddev.site
curl -s https://ddev-runner.ddev.site | grep "Hello World!"
# Not writing ddev config yet.
# curl -s http://pr${{ github.event.number }}.sites.thinkdrop.net
# curl -s http://pr${{ github.event.number }}.sites.thinkdrop.net