forked from Islandora-Devops/isle-dc
-
Notifications
You must be signed in to change notification settings - Fork 6
191 lines (171 loc) · 7.12 KB
/
ci.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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
name: CI
on:
push:
branches:
- main
- development
tags:
- v*
pull_request:
branches:
- main
- development
jobs:
build:
name: build
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.excludes-matrix.outputs.matrix }}
steps:
# Check out current commit
- name: Checkout
uses: actions/checkout@v3
# Make sure buildkit is enabled
- name: Enable buildkit
shell: bash
run: |
echo '{"experimental": "enabled"}' > ~/.docker/config.json
# Build and Export image for push to github container registry
- name: Build and export drupal image
run: make static-drupal-image-export
# Build and run the static environment
- name: Build Static
run: make static-docker-compose.yml up
- uses: actions/upload-artifact@v2
with:
name: drupal-image
path: images
- name: Generate Test Matrix
id: test-matrix
uses: jhu-idc/[email protected]
with:
key: suite
- name: Exclude nightly jobs
id: excludes-matrix
uses: jhu-idc/[email protected]
with:
key: suite
glob: '*nightly*.sh'
exclude: true
matrix: ${{ steps.test-matrix.outputs.matrix }}
#- name: Notify Slack
# uses: 8398a7/action-slack@v3
# with:
# status: ${{ job.status }}
# fields: repo,message,commit,author,action,eventName,ref,workflow,job,took,pullRequest # selectable (default: repo,message)
# env:
# SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} # required
# if: failure()
test:
name: test
runs-on: ubuntu-latest
if: false # Don/Tim: disable testing for now
needs: build
strategy:
matrix: ${{ fromJSON(needs.build.outputs.matrix) }}
fail-fast: false
steps:
# Check out current commit
- name: Checkout
uses: actions/checkout@v3
- name: Download Drupal Image
uses: actions/download-artifact@v2
with:
name: drupal-image
path: images
- name: Load Drupal Image
run: docker load < images/static-drupal.tar
- name: Use static docker-compose file, to test static image
run: make static-docker-compose.yml
- name: Up
run: make up
- name: test
run: |
mkdir -p end-to-end/reports
chmod a+rwx end-to-end/reports
make test test=${{ matrix.suite }}
- name: reports
if: always()
run: |
mkdir -p end-to-end/reports/${{ matrix.suite }}
docker ps
docker logs idc_drupal_1 2>&1 | tee end-to-end/reports/${{ matrix.suite }}/drupal-${{ matrix.suite }}.log
docker logs idc_alpaca_1 2>&1 | tee end-to-end/reports/${{ matrix.suite }}/alpaca-${{ matrix.suite }}.log
docker logs idc_homarus_1 2>&1 | tee end-to-end/reports/${{ matrix.suite }}/homarus-${{ matrix.suite }}.log
docker logs idc_crayfits_1 2>&1 | tee end-to-end/reports/${{ matrix.suite }}/crayfits-${{ matrix.suite }}.log
docker logs idc_fits_1 2>&1 | tee end-to-end/reports/${{ matrix.suite }}/fits-${{ matrix.suite }}.log
docker logs idc_houdini_1 2>&1 | tee end-to-end/reports/${{ matrix.suite }}/houdini-${{ matrix.suite }}.log
docker logs idc_dlq_1 2>&1 | tee end-to-end/reports/${{ matrix.suite }}/dlq-${{ matrix.suite }}.log
- name: upload reports
if: always()
uses: actions/upload-artifact@v2
with:
name: reports-${{ matrix.suite }}
path: end-to-end/reports/${{ matrix.suite }}
- name: upload screenshots
if: always()
uses: actions/upload-artifact@v2
with:
name: reports-screenshots
path: end-to-end/reports/screenshots
#- name: Notify Slack
# uses: 8398a7/action-slack@v3
# with:
# status: ${{ job.status }}
# fields: repo,message,commit,author,action,eventName,ref,workflow,job,took,pullRequest # selectable (default: repo,message)
# env:
# SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} # required
# MATRIX_CONTEXT: ${{ toJson(matrix) }} # required
# if: failure()
deploy:
name: Deploy
runs-on: ubuntu-latest
needs: [ build ] # Tim, Don: removing test dependency
env:
DOCKER_USER: ${{secrets.DOCKER_USER}}
DOCKER_PUSH_REPOSITORY: ${{secrets.DOCKER_PUSH_REPOSITORY}}
steps:
# Check out current commit
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Docker Login
if: ${{ github.event_name != 'pull_request' && env.DOCKER_USER }}
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ env.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASS }}
- name: Download Drupal Image
if: ${{ github.event_name != 'pull_request' && env.DOCKER_USER }}
uses: actions/download-artifact@v2
with:
name: drupal-image
path: images
- name: Load Drupal Image
if: ${{ github.event_name != 'pull_request' && env.DOCKER_USER }}
run: docker load < images/static-drupal.tar
- name: Use static docker-compose file, to deploy image
run: make static-docker-compose.yml
# The primary purpose of this step is to make sure all the non-drupal images are
# downloaded.
- name: Load the irest of the stack
run: docker-compose up -d
# Push docker images, if we are on the appropriate branch or tag
- name: Docker Push
if: ${{ github.event_name != 'pull_request' && env.DOCKER_USER }}
run: sh tag_and_push_images.sh
# Experimental way to delete artifact
- name: Delete Temporary Images
uses: geekyeggo/delete-artifact@v1
with:
name: drupal-image
#- name: Notify Slack
# uses: 8398a7/action-slack@v3
# with:
# status: ${{ job.status }}
# fields: repo,message,commit,author,action,eventName,ref,workflow,job,took,pullRequest # selectable (default: repo,message)
# env:
# SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} # required
# if: failure()