generated from drupal-composer/drupal-project
-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (51 loc) · 2.03 KB
/
pull-request.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
name: Deploy Pull Request Environments
on: [pull_request]
# Prevents DDEV from writing to local hosts file.
env:
# Used only for "job.environment" setting.
# Must match $DDEV_PROJECT_NAME.$DDEV_PROJECT_TLD for github environment links to work.
# @TODO: Update when on live server.
DDEV_PROJECT_DOMAIN: ${{ github.event.repository.name }}.pr${{ github.event.number }}.ci.thinkdrop.net
DDEV_PROJECT_PATH: "Sites/${{ github.repository }}/pr${{ github.event.number }}"
# Just to make sure the github runner user's PATH is set right.
PATH: /usr/bin:/usr/local/bin:/snap/bin
jobs:
deploy:
name: Deploy Site
environment:
name: ${{ github.event.repository.name }}/pr${{ github.event.number }}
url: http://${{ env.DDEV_PROJECT_DOMAIN }}?${{ github.run_id }}
# This tells github what runner to run this job on. Make sure your runner is configured to use this label.
runs-on: [email protected]
steps:
- name: Deploy site
uses: operations-platform/ddev-site@main
with:
sync: no
ssh-known-hosts: ${{ secrets.SSH_KNOWN_HOSTS }}
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
sync-command: |
ddev drush @live sql:dump > database.sql
ddev drush sql:query --file ../database.sql
test:
name: Run Tests
runs-on: [email protected]
needs: deploy
steps:
- name: Set environment
run: |
echo "DDEV_PROJECT_PATH_FULL=$HOME/$DDEV_PROJECT_PATH" >> "$GITHUB_ENV"
# Tests are failing before first load. Do a CURL to warm the caches.
- name: Pre-load URL
run: |
curl ${{ env.DDEV_PROJECT_DOMAIN }}
- name: Run Tests
working-directory: ${{ env.DDEV_PROJECT_PATH_FULL }}
run: |
ddev drush behat
- name: Archive artifacts
uses: actions/upload-artifact@v4
if: always()
with:
name: behat-test-output
path: ${{ env.DDEV_PROJECT_PATH_FULL }}/web/sites/default/files/test_artifacts