BRE-342 Implement retry mechanism with error handling to get secrets … #221
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: Test Version Check Action | |
on: | |
pull_request: | |
paths: | |
- "release-check-version" | |
push: | |
branches: | |
- "main" | |
workflow_dispatch: | |
inputs: {} | |
jobs: | |
test-version-check: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- name: ts-semver-success | |
project-type: ts | |
file: release-version-check/tests/fixtures/SemVer/package.json | |
override-version: 1.1.0 | |
- name: ts-semver-fail | |
project-type: ts | |
file: release-version-check/tests/fixtures/SemVer/package.json | |
override-version: 1.0.1 | |
- name: ts-calver-success | |
project-type: ts | |
file: release-version-check/tests/fixtures/CalVer/package.json | |
override-version: 2022.06.0 | |
- name: ts-calver-fail | |
project-type: ts | |
file: release-version-check/tests/fixtures/CalVer/package.json | |
override-version: 2022.05.0 | |
- name: dotnet-calver-success | |
project-type: dotnet | |
file: release-version-check/tests/fixtures/CalVer/Test.csproj | |
override-version: 2022.06.0 | |
- name: dotnet-calver-fail | |
project-type: dotnet | |
file: release-version-check/tests/fixtures/CalVer/Test.csproj | |
override-version: 2022.05.0 | |
- name: xamarin-calver-success | |
project-type: xamarin | |
file: release-version-check/tests/fixtures/CalVer/Mobile-Android.xml | |
override-version: 2022.05.1 | |
- name: xamarin-calver-fail | |
project-type: xamarin | |
file: release-version-check/tests/fixtures/CalVer/Mobile-Android.xml | |
override-version: 2022.05.0 | |
outputs: | |
ts-semver-success-status: ${{ steps.set-status.outputs.ts-semver-success }} | |
ts-semver-fail-status: ${{ steps.set-status.outputs.ts-semver-fail }} | |
ts-calver-success-status: ${{ steps.set-status.outputs.ts-calver-success }} | |
ts-calver-fail-status: ${{ steps.set-status.outputs.ts-calver-fail }} | |
dotnet-calver-success-status: ${{ steps.set-status.outputs.dotnet-calver-success }} | |
dotnet-calver-fail-status: ${{ steps.set-status.outputs.dotnet-calver-fail }} | |
xamarin-calver-success-status: ${{ steps.set-status.outputs.xamarin-calver-success }} | |
xamarin-calver-fail-status: ${{ steps.set-status.outputs.xamarin-calver-fail }} | |
steps: | |
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 | |
- name: Version Check - ${{ matrix.name }} | |
id: run-version-check | |
continue-on-error: true | |
uses: ./release-version-check | |
with: | |
release-type: Initial Release | |
project-type: ${{ matrix.project-type }} | |
file: ${{ matrix.file }} | |
override-version: ${{ matrix.override-version }} | |
- name: Set Status | |
id: set-status | |
run: | | |
echo "Status Status - ${{ matrix.name }}: ${{ steps.run-version-check.outputs.status }}" | |
echo "${{ matrix.name }}=${{ steps.run-version-check.outputs.status }}" >> $GITHUB_OUTPUT | |
run-version-check-test: | |
runs-on: ubuntu-latest | |
needs: [test-version-check] | |
if: always() | |
steps: | |
- name: Validate Outputs | |
run: | | |
test_outputs=() | |
function assert() { | |
value=$1 | |
expected_value=$2 | |
test_name=$3 | |
if [[ "$value" == "$expected_value" ]]; then | |
echo "${test_name}: pass" | |
test_outputs+=("pass") | |
else | |
echo "${test_name}: fail" | |
test_outputs+=("fail") | |
fi | |
} | |
assert "${{ needs.test-version-check.outputs.ts-semver-success-status }}" "success" "Test TS SemVer Success" | |
assert "${{ needs.test-version-check.outputs.ts-semver-fail-status }}" "fail" "Test TS SemVer Fail" | |
assert "${{ needs.test-version-check.outputs.ts-calver-success-status }}" "success" "Test TS CalVer Success" | |
assert "${{ needs.test-version-check.outputs.ts-calver-fail-status }}" "fail" "Test TS CalVer Fail" | |
assert "${{ needs.test-version-check.outputs.dotnet-calver-success-status }}" "success" "Test .NET CalVer Success" | |
assert "${{ needs.test-version-check.outputs.dotnet-calver-fail-status }}" "fail" "Test .NET CalVer Fail" | |
assert "${{ needs.test-version-check.outputs.xamarin-calver-success-status }}" "success" "Test Xamarin CalVer Success" | |
assert "${{ needs.test-version-check.outputs.xamarin-calver-fail-status }}" "fail" "Test CalVer Fail" | |
if [[ "${test_outputs[@]}" =~ "fail" ]]; then | |
exit 1 | |
else | |
exit 0 | |
fi |