|
16 | 16 |
|
17 | 17 | jobs: |
18 | 18 | unit-tests: |
19 | | - name: Run Unit Tests |
| 19 | + name: Run Unit Tests on get-jira-release-notes Module |
20 | 20 | runs-on: ubuntu-latest |
21 | 21 |
|
22 | 22 | steps: |
|
39 | 39 | cd get-jira-release-notes |
40 | 40 | python -m pytest test_get_jira_release_notes.py -v --cov=get_jira_release_notes --cov-report=term-missing |
41 | 41 |
|
42 | | - action-integration-test: |
43 | | - name: Test Action Integration |
| 42 | + test-action-inputs: |
| 43 | + name: Test Action Input Handling and Environment Variable Outputs |
44 | 44 | runs-on: ubuntu-latest |
45 | 45 | steps: |
46 | 46 | - name: Checkout code |
@@ -119,3 +119,130 @@ jobs: |
119 | 119 | - name: Test action parameter validation |
120 | 120 | run: | |
121 | 121 | echo "✅ Action correctly validates required parameters and handles env vars" |
| 122 | +
|
| 123 | + test-default-issue-categories: |
| 124 | + name: Test Action Integration with Default Issue Categories |
| 125 | + runs-on: ubuntu-latest |
| 126 | + permissions: |
| 127 | + contents: read |
| 128 | + id-token: write |
| 129 | + steps: |
| 130 | + - name: Checkout code |
| 131 | + uses: actions/checkout@v4 |
| 132 | + |
| 133 | + - name: Get release notes from a sandbox project |
| 134 | + id: test-sandbox |
| 135 | + uses: ./get-jira-release-notes |
| 136 | + with: |
| 137 | + jira-project-key: 'SONARPHP' |
| 138 | + jira-version-name: '3.49' |
| 139 | + use-jira-sandbox: 'true' |
| 140 | + |
| 141 | + - name: Output results |
| 142 | + run: | |
| 143 | + echo "Jira Release URL: ${{ steps.test-sandbox.outputs.jira-release-url }}" |
| 144 | + echo "Release Notes:" |
| 145 | + echo "${{ steps.test-sandbox.outputs.release-notes }}" |
| 146 | + echo "Jira Release Notes:" |
| 147 | + echo "${{ steps.test-sandbox.outputs.jira-release-notes }}" |
| 148 | +
|
| 149 | + - name: Verify Jira Release URL |
| 150 | + run: | |
| 151 | + if [[ "${{ steps.test-sandbox.outputs.jira-release-url }}" != https://sonarsource-sandbox-608.atlassian.net/projects/SONARPHP/versions/*/tab/release-report-all-issues ]]; then |
| 152 | + echo "❌ Jira Release URL format is incorrect" |
| 153 | + exit 1 |
| 154 | + else |
| 155 | + echo "✅ Jira Release URL format is correct" |
| 156 | + fi |
| 157 | +
|
| 158 | + - name: Verify Release Notes Content |
| 159 | + run: | |
| 160 | + if grep -q "### Improvement" <<< "${{ steps.test-sandbox.outputs.release-notes }}"; then |
| 161 | + echo "✅ Release Notes contain default issue categories" |
| 162 | + else |
| 163 | + echo "❌ Release Notes are missing some default issue categories" |
| 164 | + exit 1 |
| 165 | + fi |
| 166 | + |
| 167 | + if grep -q "### Task" <<< "${{ steps.test-sandbox.outputs.release-notes }}"; then |
| 168 | + echo "❌ Release Notes should not contain Task category with default settings" |
| 169 | + exit 1 |
| 170 | + else |
| 171 | + echo "✅ Release Notes correctly exclude Task category" |
| 172 | + fi |
| 173 | +
|
| 174 | + - name: Verify Jira Release Notes Content |
| 175 | + run: | |
| 176 | + if grep -q "h3. Improvement" <<< "${{ steps.test-sandbox.outputs.jira-release-notes }}"; then |
| 177 | + echo "✅ Jira Release Notes contain default issue category" |
| 178 | + else |
| 179 | + echo "❌ Jira Release Notes are missing some default issue categories" |
| 180 | + exit 1 |
| 181 | + fi |
| 182 | + |
| 183 | + if grep -q "h3. Task" <<< "${{ steps.test-sandbox.outputs.jira-release-notes }}"; then |
| 184 | + echo "❌ Jira Release Notes should not contain Task category with default settings" |
| 185 | + exit 1 |
| 186 | + else |
| 187 | + echo "✅ Jira Release Notes correctly exclude Task category" |
| 188 | + fi |
| 189 | +
|
| 190 | + test-custom-issue-categories: |
| 191 | + name: Test Action Integration with Custom Issue Categories |
| 192 | + runs-on: ubuntu-latest |
| 193 | + permissions: |
| 194 | + contents: read |
| 195 | + id-token: write |
| 196 | + steps: |
| 197 | + - name: Checkout code |
| 198 | + uses: actions/checkout@v4 |
| 199 | + |
| 200 | + - name: Get release notes from a sandbox project with custom issue types |
| 201 | + id: test-sandbox-custom |
| 202 | + uses: ./get-jira-release-notes |
| 203 | + with: |
| 204 | + jira-project-key: 'SONARPHP' |
| 205 | + jira-version-name: '3.49' |
| 206 | + use-jira-sandbox: 'true' |
| 207 | + issue-types: 'Task,Bug,New Feature' |
| 208 | + |
| 209 | + - name: Output results |
| 210 | + run: | |
| 211 | + echo "Jira Release URL: ${{ steps.test-sandbox-custom.outputs.jira-release-url }}" |
| 212 | + echo "Release Notes:" |
| 213 | + echo "${{ steps.test-sandbox-custom.outputs.release-notes }}" |
| 214 | + echo "Jira Release Notes:" |
| 215 | + echo "${{ steps.test-sandbox-custom.outputs.jira-release-notes }}" |
| 216 | +
|
| 217 | + - name: Verify Release Notes Content |
| 218 | + run: | |
| 219 | + if grep -q "### Task" <<< "${{ steps.test-sandbox-custom.outputs.release-notes }}"; then |
| 220 | + echo "✅ Release Notes contain Task category as specified" |
| 221 | + else |
| 222 | + echo "❌ Release Notes are missing Task category" |
| 223 | + exit 1 |
| 224 | + fi |
| 225 | + |
| 226 | + if grep -q "### Improvement" <<< "${{ steps.test-sandbox-custom.outputs.release-notes }}"; then |
| 227 | + echo "❌ Release Notes should not contain Improvement category with custom settings" |
| 228 | + exit 1 |
| 229 | + else |
| 230 | + echo "✅ Release Notes correctly exclude Improvement category" |
| 231 | + fi |
| 232 | +
|
| 233 | + - name: Verify Jira Release Notes Content |
| 234 | + run: | |
| 235 | + if grep -q "h3. Task" <<< "${{ steps.test-sandbox-custom.outputs.jira-release-notes }}"; then |
| 236 | + echo "✅ Jira Release Notes contain Task category as specified" |
| 237 | + else |
| 238 | + echo "❌ Jira Release Notes are missing Task category" |
| 239 | + exit 1 |
| 240 | + fi |
| 241 | + |
| 242 | + if grep -q "h3. Improvement" <<< "${{ steps.test-sandbox-custom.outputs.jira-release-notes }}"; then |
| 243 | + echo "❌ Jira Release Notes should not contain Improvement category with custom settings" |
| 244 | + exit 1 |
| 245 | + else |
| 246 | + echo "✅ Jira Release Notes correctly exclude Improvement category" |
| 247 | + fi |
| 248 | + |
0 commit comments