-
Notifications
You must be signed in to change notification settings - Fork 22
145 lines (131 loc) · 4 KB
/
test-scaffold.yml
File metadata and controls
145 lines (131 loc) · 4 KB
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
name: Test scaffold
on:
push:
branches:
- main
- develop
pull_request:
types:
- opened
- reopened
- ready_for_review
- synchronize
schedule:
# Sunday 2 AM Melbourne time.
- cron: '0 16 * * SUN'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
GOVCMS_VERSION: 10
jobs:
test:
runs-on: ubuntu-latest
strategy:
max-parallel: 2
matrix:
govcms_image:
- "10.x-latest"
- "10.x-edge"
- "11.x-latest"
- "11.x-edge"
project_type:
- saas
- paas
fail-fast: false
env:
# Enable BuildKit for additional_contexts support.
DOCKER_BUILDKIT: 1
COMPOSE_DOCKER_CLI_BUILD: 1
steps:
-
name: Checkout the repo
uses: actions/checkout@main
-
name: Check Docker and Compose version
run: |
echo "[INFO] Docker version."
docker version
echo "[INFO] Docker Compose version."
docker compose version
-
name: Install Ahoy
run: |
sudo wget -qO /usr/local/bin/ahoy https://github.com/ahoy-cli/ahoy/releases/latest/download/ahoy-bin-linux-amd64
sudo chmod +x /usr/local/bin/ahoy
ahoy --version
-
name: Setup Docker network
run: docker network prune -f >/dev/null 2>&1 && docker network inspect amazeeio-network >/dev/null 2>&1 || docker network create amazeeio-network >/dev/null 2>&1 || true
-
name: Process codebase to run in CI
run: |
find . -name "docker-compose.yml" -print0 | xargs -0 -I {} sh -c "sed -i -e ''/###/d'' {} && sed -i -e ''s/##//'' {} && sed -i -e 's#- .:/app:delegated#[]#' {}"
-
name: Init scaffold
run: ahoy init scaffold-test ${{ matrix.project_type }} ${{ env.GOVCMS_VERSION }}
-
name: Build project
run: ahoy up
env:
GOVCMS_IMAGE_VERSION: ${{ matrix.govcms_image }}
GOVCMS_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-
name: Install GovCMS profile
run: ahoy install
notify:
runs-on: ubuntu-latest
needs: [ test ]
if: ${{ !cancelled() }}
steps:
-
name: Notify failures to Slack
id: failure_slack
if: ${{ contains(needs.*.result, 'failure') }}
uses: slackapi/slack-github-action@v1.27.0
with:
# See https://github.com/slackapi/slack-github-action?tab=readme-ov-file
channel-id: ${{ secrets.SLACK_CHANNEL }}
payload: |
{
"attachments": [
{
"color": "#ff0000",
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": "GovCMS Scaffold test failure"
}
},
{
"type": "context",
"elements": [
{
"type": "mrkdwn",
"text": "Some jobs were not successful, please view the pipeline and rerun."
}
]
},
{
"type": "actions",
"block_id": "view_pipeline",
"elements": [
{
"type": "button",
"text": {
"type": "plain_text",
"text": "View pipeline"
},
"url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
}
]
}
]
}
]
}
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}