This repository has been archived by the owner on Mar 25, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
152 lines (131 loc) · 4.31 KB
/
build.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
name: "Build, Test & Deploy"
on:
pull_request_target:
types:
- opened
- edited
- synchronize
- reopened
- ready_for_review
env:
branch_name: ${{ github.head_ref || github.ref_name }}
jobs:
build:
name: "Build and test"
runs-on: ubuntu-latest
timeout-minutes: 15
concurrency:
group: ${{ github.event.pull_request.number || github.ref }}-build
cancel-in-progress: true
steps:
- name: Check out the repository code
uses: actions/checkout@v3
- name: Setup and start DDEV
uses: ddev/github-action-setup-ddev@v1
- name: Provide information
run: |
echo "- Docker info"
docker info
echo "- Docker images"
docker images
echo "- DDEV information"
ddev version
echo "- PHP information"
ddev php --version
echo "- Composer information"
ddev composer --version
- name: Validate composer.json and composer.lock
run: ddev composer validate --strict
- name: Composer install
run: |
if [[ ${{ env.branch_name }} == "master" ]]; then
ddev composer install --no-dev --no-interaction --optimize-autoloader
else
ddev composer install --no-interaction --optimize-autoloader
fi
- name: Create symlinks
run: |
if [ ! -d html/sites/default/files ]; then
mkdir -pm 755 html/sites/default/files
fi
if [ ! -d html/sites/default/files/translations ]; then
mkdir -pm 755 html/sites/default/files/translations
fi
if [ ! -d html/sites/default/private ]; then
mkdir -pm 755 html/sites/default/private
fi
- name: Download and import the sanitized database
run: ddev composer import-sanitized
- name: Run drush deploy commands
run: ddev drush deploy
- name: Enable stage_file_proxy
run: |
if [[ ${{ env.branch_name }} == "master" ]]; then
composer require --dev drupal/stage_file_proxy
fi
ddev drush pm:enable stage_file_proxy --yes
ddev drush config:set stage_file_proxy.settings origin "https://www.drupalnorge.no" --yes
ddev drush config:set stage_file_proxy.settings hotlink true --yes
- name: Run test
run: ddev composer test
- name: Screenshots permissions
run: '(test -d screenshots && sudo chmod -R 777 screenshots) || echo "No screenshots found"'
if: ${{ failure() }}
- name: Upload screenshots
uses: actions/upload-artifact@v3
if: ${{ failure() }}
with:
name: screenshots
path: screenshots
- name: Disable stage_file_proxy
run: |
ddev drush pm:uninstall stage_file_proxy --yes
ddev drush cache:rebuild
if [[ ${{ env.branch_name }} == "master" ]]; then
composer remove --dev drupal/stage_file_proxy
fi
- name: Sanitized database
run: |
ddev drush sql:sanitize --yes
- name: Database dump
run: ddev drush sql:dump > html/sanitized.db
- name: Upload the sanitized database
uses: actions/upload-artifact@v3
if: ${{ success() }}
with:
name: sanitized.db
path: html/sanitized.db
if-no-files-found: error
- name: Creating an artifact
if: ${{ success() }}
run: >
tar
--exclude="./html/sites/default/files/*"
--exclude="./html/sites/default/private/*"
--exclude="./html/sites/default/.gitignore"
--exclude="./html/sites/default/settings.ddev.php"
-zcvf /tmp/artifact.tar.gz
./.ddev/config.yaml
./.ddev/docker-compose.chromedriver.yaml
./.git
./.github
./bin
./config
./drush
./html
./tests
./vendor
./.editorconfig
./.gitattributes
./.gitignore
./behat.yml.dist
./composer.json
./composer.lock
./phpcs.xml.dist
./README.md
- name: Uploading artifact
uses: actions/upload-artifact@v3
with:
name: artifact
path: /tmp/artifact.tar.gz
if-no-files-found: error