forked from chaos-mesh/chaos-mesh
-
Notifications
You must be signed in to change notification settings - Fork 0
125 lines (106 loc) · 3.84 KB
/
ci.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
name: CI
on:
pull_request:
push:
branches:
- master
jobs:
calculate-tag:
uses: ./.github/workflows/calculate_tag.yaml
check-md-links:
uses: ./.github/workflows/check_md_links.yaml
check-license:
uses: ./.github/workflows/check_license.yaml
unit-test:
uses: ./.github/workflows/unit_test.yaml
changed-files:
uses: ./.github/workflows/changed_files.yaml
build-targets:
needs: [changed-files, calculate-tag]
if: needs.changed-files.outputs.only_changed == 'false'
uses: ./.github/workflows/build_targets.yaml
with:
tag: ${{needs.calculate-tag.outputs.tag }}
e2e-test:
needs: build-targets
uses: ./.github/workflows/e2e_test.yaml
with:
images-artifact-name: ${{ needs.build-targets.outputs.images-artifact-name }}
e2e-binary-name: ${{ needs.build-targets.outputs.e2e-binary-artifact-name }}
integration-test:
needs: build-targets
uses: ./.github/workflows/integration_test.yaml
with:
images-artifact-name: ${{ needs.build-targets.outputs.images-artifact-name }}
pass:
if: always()
needs:
- changed-files
- unit-test
- integration-test
- e2e-test
name: All Checks Pass
runs-on: ubuntu-20.04
steps:
- run: |
result="${{ needs.changed-files.result }}"
if [[ ! $result == "success" ]]; then
echo "changed-files has failed"
exit 1
fi
result="${{ needs.unit-test.result }}"
if [[ ! ($result == "success" || $result == "skipped") ]]; then
echo "unit-test has failed"
exit 1
fi
result="${{ needs.integration-test.result }}"
if [[ ! ($result == "success" || $result == "skipped") ]]; then
echo "integration-test has failed"
exit 1
fi
result="${{ needs.e2e-test.result }}"
if [[ ! ($result == "success" || $result == "skipped") ]]; then
echo "e2e-test has failed"
exit 1
fi
release:
runs-on: ubuntu-20.04
needs: [calculate-tag, build-targets]
permissions: write-all
steps:
- name: Download saved images
id: download-images
uses: actions/download-artifact@v4
with:
name: ${{ needs.build-targets.outputs.images-artifact-name }}
path: ./output/${{ needs.build-targets.outputs.images-artifact-name }}
- name: Download chart
id: download-chart
uses: actions/download-artifact@v4
with:
name: ${{ needs.build-targets.outputs.chart-artifact-name }}
path: ./output/${{ needs.build-targets.outputs.chart-artifact-name }}
- name: Create GH release
uses: softprops/action-gh-release@v1
id: release
with:
generate_release_notes: true
target_commitish: "${{ github.base_ref }}"
tag_name: ${{ needs.calculate-tag.outputs.tag }}
prerelease: "${{ github.event_name == 'pull_request' }}"
files: |
./output/${{ needs.build-targets.outputs.images-artifact-name }}/*
./output/${{ needs.build-targets.outputs.chart-artifact-name }}/*
- name: Comment release
uses: actions/github-script@v6
if: github.event_name == 'pull_request'
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `### Created new release based on commit https://github.com/${{ github.repository }}/pull/${{ github.event.number }}/commits/${{github.sha}}
**Release tag**: ${{ needs.calculate-tag.outputs.tag }}
[**Link to release**](https://github.com/${{ github.repository }}/releases/tag/${{ needs.calculate-tag.outputs.tag }})`
})