-
-
Notifications
You must be signed in to change notification settings - Fork 7
174 lines (143 loc) Β· 5.93 KB
/
workflow-tests.yml
File metadata and controls
174 lines (143 loc) Β· 5.93 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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
# This isn't a reusable workflow but an actual CI action for this repo itself - to test the workflows.
name: Workflow Tests
on:
push:
permissions:
contents: write
pull-requests: write
actions: write
jobs:
# Test PR creation scenario - should create a PR with specific version pattern
updater-pr-creation:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run updater action
id: updater
uses: ./updater
with:
path: updater/tests/sentry-cli.properties
name: WORKFLOW-TEST-DEPENDENCY-DO-NOT-MERGE
pattern: '^2\.0\.'
pr-strategy: update
api-token: ${{ github.token }}
- name: Validate PR creation outputs
env:
BASE_BRANCH: ${{ steps.updater.outputs.baseBranch }}
ORIGINAL_TAG: ${{ steps.updater.outputs.originalTag }}
LATEST_TAG: ${{ steps.updater.outputs.latestTag }}
PR_URL: ${{ steps.updater.outputs.prUrl }}
PR_BRANCH: ${{ steps.updater.outputs.prBranch }}
shell: pwsh
run: |
Write-Host "π Validating PR creation scenario outputs..."
Write-Host "Base Branch: '$env:BASE_BRANCH'"
Write-Host "Original Tag: '$env:ORIGINAL_TAG'"
Write-Host "Latest Tag: '$env:LATEST_TAG'"
Write-Host "PR URL: '$env:PR_URL'"
Write-Host "PR Branch: '$env:PR_BRANCH'"
# Validate base branch is main
$env:BASE_BRANCH | Should -Be "main"
# Validate original tag is expected test value
$env:ORIGINAL_TAG | Should -Be "2.0.0"
# Validate latest tag is a valid version
$env:LATEST_TAG | Should -Match "^[0-9]+\.[0-9]+\.[0-9]+$"
# Validate PR URL format
$env:PR_URL | Should -Match "^https://github\.com/getsentry/github-workflows/pull/[0-9]+$"
# Validate PR branch format
$env:PR_BRANCH | Should -Be "deps/updater/tests/sentry-cli.properties"
Write-Host "β
PR creation scenario validation passed!"
# Test target-branch functionality - should use specified branch as base
updater-target-branch:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run updater action with target-branch
id: updater
uses: ./updater
with:
path: updater/tests/sentry-cli.properties
name: TARGET-BRANCH-TEST-DO-NOT-MERGE
pattern: '^2\.0\.'
target-branch: test/nonbot-commits
pr-strategy: update
api-token: ${{ github.token }}
- name: Validate target-branch outputs
env:
BASE_BRANCH: ${{ steps.updater.outputs.baseBranch }}
ORIGINAL_TAG: ${{ steps.updater.outputs.originalTag }}
LATEST_TAG: ${{ steps.updater.outputs.latestTag }}
PR_URL: ${{ steps.updater.outputs.prUrl }}
PR_BRANCH: ${{ steps.updater.outputs.prBranch }}
shell: pwsh
run: |
Write-Host "π Validating target-branch scenario outputs..."
Write-Host "Base Branch: '$env:BASE_BRANCH'"
Write-Host "Original Tag: '$env:ORIGINAL_TAG'"
Write-Host "Latest Tag: '$env:LATEST_TAG'"
Write-Host "PR URL: '$env:PR_URL'"
Write-Host "PR Branch: '$env:PR_BRANCH'"
# Validate base branch is the specified target-branch
$env:BASE_BRANCH | Should -Be "test/nonbot-commits"
# Validate original tag is expected test value
$env:ORIGINAL_TAG | Should -Be "2.0.0"
# Validate latest tag is a valid version
$env:LATEST_TAG | Should -Match "^[0-9]+\.[0-9]+\.[0-9]+$"
# Validate PR URL format
$env:PR_URL | Should -Match "^https://github\.com/getsentry/github-workflows/pull/[0-9]+$"
# Validate PR branch format
$env:PR_BRANCH | Should -Be "test/nonbot-commits-deps/updater/tests/sentry-cli.properties"
Write-Host "β
Target-branch scenario validation passed!"
# Test no-change scenario - should detect no updates needed
updater-no-changes:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Run updater action
id: updater
uses: ./updater
with:
path: updater/tests/workflow-args.sh
name: Workflow args test script
pattern: '.*'
api-token: ${{ github.token }}
- name: Validate no-changes outputs
env:
BASE_BRANCH: ${{ steps.updater.outputs.baseBranch }}
ORIGINAL_TAG: ${{ steps.updater.outputs.originalTag }}
LATEST_TAG: ${{ steps.updater.outputs.latestTag }}
PR_URL: ${{ steps.updater.outputs.prUrl }}
PR_BRANCH: ${{ steps.updater.outputs.prBranch }}
shell: pwsh
run: |
Write-Host "π Validating no-changes scenario outputs..."
Write-Host "Base Branch: '$env:BASE_BRANCH'"
Write-Host "Original Tag: '$env:ORIGINAL_TAG'"
Write-Host "Latest Tag: '$env:LATEST_TAG'"
Write-Host "PR URL: '$env:PR_URL'"
Write-Host "PR Branch: '$env:PR_BRANCH'"
# Validate no PR was created (empty values)
$env:BASE_BRANCH | Should -BeNullOrEmpty
$env:PR_URL | Should -BeNullOrEmpty
$env:PR_BRANCH | Should -BeNullOrEmpty
# Validate original equals latest (no update)
$env:ORIGINAL_TAG | Should -Be $env:LATEST_TAG
# Validate tag format (should be 'latest' or valid version)
if ($env:ORIGINAL_TAG -ne "latest") {
$env:ORIGINAL_TAG | Should -Match "^v?[0-9]+\.[0-9]+\.[0-9]+$"
}
Write-Host "β
No-changes scenario validation passed!"
cli-integration:
runs-on: ${{ matrix.host }}-latest
strategy:
fail-fast: false
matrix:
host:
- ubuntu
- macos
- windows
steps:
- uses: actions/checkout@v4
- uses: ./sentry-cli/integration-test/
with:
path: sentry-cli/integration-test/tests/