-
Notifications
You must be signed in to change notification settings - Fork 14
147 lines (141 loc) · 5.46 KB
/
test-released-all.yaml
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
name: "Test Release: ALL - Trigger Release Build Tests"
on:
workflow_dispatch:
inputs:
version:
description: "Version to test"
required: true
default: "9.0.0"
release:
types: [published]
env:
# C07QZDJFF89 == #release-coordination
SLACK_BOT_CHANNEL_ID: "C07QZDJFF89"
jobs:
notification-start:
name: Send Slack notification
runs-on: ubuntu-latest
outputs:
update-ts: ${{ steps.slack.outputs.ts }}
steps:
- id: slack
uses: slackapi/[email protected]
with:
method: chat.postMessage
token: ${{ secrets.SLACK_BOT_TOKEN }}
payload: |
channel: "${{ env.SLACK_BOT_CHANNEL_ID }}"
text: "GitHub Actions Run"
attachments:
- color: "#FFFF00"
blocks:
- type: "section"
fields:
- type: "mrkdwn"
text: "<${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }}/attempts/${{ github.run_attempt }}|${{ github.workflow }}>"
- type: "mrkdwn"
text: "*Status:*\n`In Progress`"
setup:
runs-on: ubuntu-latest
needs: notification-start
name: 'Unify Inputs'
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set Version (Workflow Dispatch)
if: github.event_name == 'workflow_dispatch'
run: |
echo VERSION=${{ inputs.version }} >> $GITHUB_ENV
- name: Set Version (Release Event)
if: github.event_name == 'release'
run: |
echo VERSION=${{ github.event.release.tag_name }} >> $GITHUB_ENV
- name: Unified Version
id: version
run: |
INPUT_NAME=${{ inputs.name }}
if [[ ${INPUT_NAME} == '' ]]; then
echo "Name is empty, using default"
echo "name=mondoo" >> $GITHUB_OUTPUT
else
echo "Name: ${INPUT_NAME}"
echo "name=${INPUT_NAME}" >> $GITHUB_OUTPUT
fi
V=$(echo $VERSION | sed 's/v//')
echo "Version: $V"
echo "version=${V}" >> $GITHUB_OUTPUT
# wait at least for one package to be published, otherwise tests will fail directly
- name: Wait for packages to be published (Release Event)
if: github.event_name == 'release'
id: check_release_file
uses: nick-fields/retry@v3
with:
retry_wait_seconds: 10
timeout_seconds: 5
max_attempts: 60
retry_on: error
# error on HTTP code different to 200
command: |
vSEMVER=${{ steps.version.outputs.version }}
SEMVER="${vSEMVER//v}"
curl -o /dev/null -s -w "%{http_code}\n" "https://releases.mondoo.com/mondoo/${SEMVER}/mondoo_${SEMVER}_windows_amd64.msi" | grep 200
test-arch:
needs: [setup, notification-start]
uses: ./.github/workflows/test-released-archlinux.yaml
with:
version: ${{ needs.setup.outputs.version }}
test-docker:
needs: [setup, notification-start]
uses: ./.github/workflows/test-released-docker.yaml
with:
version: ${{ needs.setup.outputs.version }}
test-install-sh:
needs: [setup, notification-start]
uses: ./.github/workflows/test-released-install-sh.yaml
with:
version: ${{ needs.setup.outputs.version }}
test-install-ps1:
needs: [setup, notification-start]
uses: ./.github/workflows/test-released-install-ps1.yaml
with:
version: ${{ needs.setup.outputs.version }}
test-osx-pkg:
needs: [setup, notification-start]
uses: ./.github/workflows/test-released-osx-pkg.yaml
with:
version: ${{ needs.setup.outputs.version }}
test-brew:
needs: [setup, notification-start]
uses: ./.github/workflows/test-released-brew.yaml
with:
version: ${{ needs.setup.outputs.version }}
notification:
runs-on: ubuntu-latest
name: Update Slack notification
needs: [test-arch, test-docker, test-install-sh, test-install-ps1, test-osx-pkg, test-brew, notification-start, setup]
if: ${{ always() }}
steps:
- name: Set status
id: status
run: |
echo "status_success=${{ needs.setup.result == 'success' && needs.test-arch.result == 'success' && needs.test-docker.result == 'success' && needs.test-install-sh.result == 'success' && needs.test-install-ps1.result == 'success' && needs.test-osx-pkg.result == 'success' && needs.test-brew.result == 'success' }}" >> $GITHUB_OUTPUT
- uses: slackapi/[email protected]
if : ${{ always() }}
with:
method: chat.update
token: ${{ secrets.SLACK_BOT_TOKEN }}
payload: |
channel: "${{ env.SLACK_BOT_CHANNEL_ID }}"
ts: "${{ needs.notification-start.outputs.update-ts }}"
text: "GitHub Actions Run"
attachments:
- color: "${{ steps.status.outputs.status_success == 'true' && '#00FF00' || '#FF0000' }}"
blocks:
- type: "section"
fields:
- type: "mrkdwn"
text: "<${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }}/attempts/${{ github.run_attempt }}|${{ github.workflow }}>"
- type: "mrkdwn"
text: "*Status:*\n`${{ steps.status.outputs.status_success == 'true' && 'Success' || 'Failed' }}`"