-
Notifications
You must be signed in to change notification settings - Fork 46
165 lines (158 loc) · 4.74 KB
/
test.yml
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
name: 'build-test'
on:
push:
branches:
- main
- development
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: |
npm install
- run: |
npm run all
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./
with:
valueFile: '__tests__/fixtures/values.yaml'
propertyPath: 'backend.version'
masterBranchName: main
value: v1.0.1
branch: deployment/v1.0.1
targetBranch: main
createPR: 'false'
message: 'Update Image Version to v1.0.1'
token: ${{ secrets.GH_TOKEN }}
test-no-changes-did-not-fail:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./
with:
valueFile: '__tests__/fixtures/values.yaml'
propertyPath: 'backend.version'
masterBranchName: main
value: v1.2.0
branch: deployment/v1.2.0
targetBranch: main
createPR: 'false'
message: 'Update Image Version to v1.2.0'
token: ${{ secrets.GH_TOKEN }}
test-target-repository:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
path: infrastructure
- name: Update values.yaml
uses: ./infrastructure
with:
valueFile: '__tests__/fixtures/values.yaml'
propertyPath: 'backend.version'
value: v1.2.1
masterBranchName: main
branch: deployment/v1.2.1
targetBranch: main
createPR: 'false'
message: 'Update Image Version to v1.2.1'
workDir: infrastructure
token: ${{ secrets.GH_TOKEN }}
test-update-file:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Cat Original values.yaml
run: cat __tests__/fixtures/values.yaml
- name: Update values.yaml
uses: ./
with:
valueFile: '__tests__/fixtures/values.yaml'
propertyPath: 'backend.version'
value: v1.0.1
masterBranchName: main
commitChange: 'false'
updateFile: 'true'
- name: Cat Updated values.yaml
run: cat __tests__/fixtures/values.yaml
test-multiple-file-changes:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./
with:
branch: deployment/test-multi-file-update
masterBranchName: main
createPR: 'false'
targetBranch: main
description: Test GitHub Action
message: 'Update All Images'
title: 'Version Updates on all Environments'
changes: |
{
"__tests__/fixtures/values.json": {
"backend.version": "v1.0.1",
"frontend": true
},
"__tests__/fixtures/values.dev.yaml": {
"backend.version": "v1.0.1",
"frontend": true
},
"__tests__/fixtures/values.stage.yaml": {
"backend.version": "v1.0.1",
"frontend": true
},
"__tests__/fixtures/values.prod.yaml": {
"backend.version": "v1.0.1",
"frontend": true
}
}
test-value-types:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./
with:
valueFile: '__tests__/fixtures/values.yaml'
propertyPath: 'config.prod'
value: "!!bool 'true'"
branch: deployment/test-bool-value
masterBranchName: main
targetBranch: main
description: Test GitHub Action
message: 'Update Config'
title: 'Bool Update on all Environments'
token: ${{ secrets.GH_TOKEN }}
- uses: ./
with:
valueFile: '__tests__/fixtures/values.yaml'
propertyPath: 'config.version'
value: "!!int '1234'"
branch: deployment/test-int-value
masterBranchName: main
targetBranch: main
description: Test GitHub Action
message: 'Update Config'
title: 'Int Update on all Environments'
token: ${{ secrets.GH_TOKEN }}
cleanup:
runs-on: ubuntu-latest
needs:
- test-target-repository
- test-update-file
- test-multiple-file-changes
- test-value-types
steps:
- uses: actions/checkout@v3
- name: Delete test branches
uses: dawidd6/action-delete-branch@v3
with:
token: ${{ secrets.GH_TOKEN }}
branches: deployment/v1.2.1,deployment/v1.0.1,deployment/test-bool-value,deployment/test-int-value,deployment/test-multi-file-update