-
Notifications
You must be signed in to change notification settings - Fork 272
142 lines (129 loc) · 4.84 KB
/
on-master-commit.yaml
File metadata and controls
142 lines (129 loc) · 4.84 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
name: Master / Release CI
permissions:
contents: read
on:
push:
branches:
- 'master'
- 'release/*'
- 'releases/*'
concurrency:
group: 'master-commit-ci'
cancel-in-progress: false
jobs:
run-unit-tests:
name: Run Unit Tests
uses: ./.github/workflows/test.yaml
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
license-check:
name: License Check
uses: ./.github/workflows/license-check.yaml
lint:
name: Lint
uses: ./.github/workflows/lint-go.yaml
module-check:
name: Go Module Check
uses: ./.github/workflows/go-mod-check.yaml
scan-workflows:
name: Scan Workflows
uses: ./.github/workflows/scan-workflows.yaml
permissions:
contents: read
actions: read
checks: write
issues: write
pull-requests: write
secrets:
ZIZMOR_TOKEN: ${{ secrets.ZIZMOR_TOKEN }}
thor-docker-test-suite:
uses: ./.github/workflows/thor-docker-test-suite.yaml
secrets:
DRAUPNIR_TOKEN: ${{ secrets.DRAUPNIR_TOKEN }}
run-rosetta-tests:
name: Rosetta Tests
uses: ./.github/workflows/test-rosetta.yaml
with:
thor_version: ${{ github.sha }}
generate-tags:
name: Generate Docker Tags
runs-on: ubuntu-latest
outputs:
tag_date: ${{ steps.tag_date.outputs.tag_date }}
short_sha: ${{ steps.short_sha.outputs.short_sha }}
clean_ref_name: ${{ steps.clean_ref_name.outputs.clean_ref_name }}
steps:
- name: Generate Tag Date
id: tag_date
run: echo "tag_date=$(date +'%Y%m%d')" >> "$GITHUB_OUTPUT"
- name: Generate Short SHA
id: short_sha
run: echo "short_sha=$(echo $GITHUB_SHA | cut -c1-7)" >> "$GITHUB_OUTPUT"
- name: Clean Ref Name
id: clean_ref_name
# replace '/' with '-' in the case of release branches
run: echo "clean_ref_name=$(echo $GITHUB_REF_NAME | sed 's/\//-/g')" >> "$GITHUB_OUTPUT"
publish-docker-image:
name: Publish Docker Image
uses: ./.github/workflows/publish-docker-images.yaml
secrets: inherit
needs:
- run-unit-tests
- thor-docker-test-suite
- generate-tags
- lint
- license-check
permissions:
contents: read
packages: write
with:
images: |
ghcr.io/${{ github.repository }}
tags: |
type=raw,value=${{ needs.generate-tags.outputs.clean_ref_name }}-${{ needs.generate-tags.outputs.tag_date }}-${{ needs.generate-tags.outputs.short_sha }}
type=raw,value=${{ needs.generate-tags.outputs.clean_ref_name }}-latest
notify-slack:
name: Notify Slack
needs:
- publish-docker-image
- generate-tags
- license-check
- lint
- module-check
- run-unit-tests
- thor-docker-test-suite
if: github.ref_name == 'master' && always() && (
needs.publish-docker-image.result != 'success' ||
needs.run-unit-tests.result != 'success' ||
needs.lint.result != 'success' ||
needs.thor-docker-test-suite.result != 'success' ||
needs.license-check.result != 'success' ||
needs.module-check.result != 'success')
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Get the commit message
id: commit_message
# This is a workaround to get the first line of the commit message. Passing the entire message can cause the payload (JSON) to be invalid.
run: |
echo "commit_message=$(git show-branch --no-name HEAD)" >> "$GITHUB_ENV"
- name: Notify Slack
uses: slackapi/slack-github-action@6c661ce58804a1a20f6dc5fbee7f0381b469e001 # v1.25.0
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
with:
payload: |
{
"unit-test-status": "${{ needs.run-unit-tests.result != 'success' && ':alert: Failure' || ':white_check_mark: Success' }}",
"docker-publish-status": "${{ needs.publish-docker-image.result != 'success' && ':alert: Failure' || ':white_check_mark: Success' }}",
"commit-message": "${{ env.commit_message }}",
"commit-url": "${{ github.event.head_commit.url }}",
"e2e-test-status": "${{ needs.thor-docker-test-suite.result != 'success' && ':alert: Failure' || ':white_check_mark: Success' }}",
"branch": "${{ github.ref }}",
"repository": "${{ github.repository }}",
"commit-author": "${{ github.event.head_commit.author.name }}",
"lint-status": "${{ needs.lint.result != 'success' && ':alert: Failure' || ':white_check_mark: Success' }}",
"license-check": "${{ needs.license-check.result != 'success' && ':alert: Failure' || ':white_check_mark: Success' }}",
"module-check": "${{ needs.module-check.result != 'success' && ':alert: Failure' || ':white_check_mark: Success' }}"
}