-
Notifications
You must be signed in to change notification settings - Fork 274
132 lines (119 loc) · 4.48 KB
/
Copy pathon-master-commit.yaml
File metadata and controls
132 lines (119 loc) · 4.48 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
name: Master / Release CI
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
run-e2e-tests:
name: E2E Tests
uses: ./.github/workflows/test-e2e.yaml
permissions:
contents: read
secrets: inherit
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
- run-e2e-tests
- 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
trigger_internal_ci: true
notify-slack:
name: Notify Slack
needs:
- publish-docker-image
- generate-tags
- license-check
- lint
- module-check
- run-unit-tests
- run-e2e-tests
if: github.ref_name == 'master' && always() && (
needs.publish-docker-image.result != 'success' ||
needs.run-unit-tests.result != 'success' ||
needs.lint.result != 'success' ||
needs.run-e2e-tests.result != 'success' ||
needs.license-check.result != 'success' ||
needs.module-check.result != 'success')
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- 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@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.run-e2e-tests.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' }}"
}