Browse Source

[Release Version Check] Update to support our Mobile project (#48)

* update the release check version action to support our mobile project

* Updating the release version tests

* Adding some new test asserts. Trying to fix the bash issue

* trying a different syntax for the bash array

* fixing a typo

* Reverting the input validation changes

* Fixing file extensions for test
pull/42/head
Joseph Flinn 4 years ago committed by GitHub
parent
commit
8f055ef543
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 28
      .github/workflows/test-release-version-check.yml
  2. 9
      release-version-check/action.yml
  3. 3
      release-version-check/tests/fixtures/CalVer/Mobile-Android.xml

28
.github/workflows/test-release-version-check.yml

@ -35,21 +35,31 @@ jobs: @@ -35,21 +35,31 @@ jobs:
project-type: ts
file: release-version-check/tests/fixtures/CalVer/package.json
override-version: 2022.05.0
- name: csharp-calver-success
project-type: csharp
- name: dotnet-calver-success
project-type: dotnet
file: release-version-check/tests/fixtures/CalVer/Test.csproj
override-version: 2022.06.0
- name: csharp-calver-fail
project-type: csharp
- 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 }}
csharp-calver-success-status: ${{ steps.set-status.outputs.csharp-calver-success }}
csharp-calver-fail-status: ${{ steps.set-status.outputs.csharp-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@v2
@ -96,8 +106,10 @@ jobs: @@ -96,8 +106,10 @@ jobs:
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.csharp-calver-success-status }}" "success" "Test CSharp CalVer Success"
assert "${{ needs.test-version-check.outputs.csharp-calver-fail-status }}" "fail" "Test CSharp 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

9
release-version-check/action.yml

@ -9,7 +9,7 @@ inputs: @@ -9,7 +9,7 @@ inputs:
description: "Release options: ('Initial Release', 'Redeploy', 'Dry Run')"
required: true
project-type:
description: "The project's language: ('ts', 'csharp')"
description: "The project's language: ('ts', 'dotnet', 'xamarin')"
required: true
file:
description: "The file path to the code that contains the application's version"
@ -46,7 +46,7 @@ runs: @@ -46,7 +46,7 @@ runs:
echo "::set-output name=step-failed::true"
fi
project_type_valid_inputs=("ts" "csharp")
project_type_valid_inputs=("ts" "dotnet" "xamarin")
if [[ ! "${project_type_valid_inputs[@]}" =~ "${{ inputs.project-type }}" ]]; then
echo "[!] 'project-type' option only supports the following values: (${project_type_valid_inputs})"
echo "::set-output name=step-failed::true"
@ -84,9 +84,12 @@ runs: @@ -84,9 +84,12 @@ runs:
"ts")
version=$( jq -r ".version" ${{ inputs.file }} )
;;
"csharp")
"dotnet")
version=$( grep -o "<Version>.*</Version>" ${{ inputs.file }} | grep -Eo "[0-9]{4}\.[0-9]{2}\.[0-9]+" )
;;
"xamarin")
version=$(sed -E -n '/^<manifest/s/^.*[ ]android:versionName="([^"]+)".*$/\1/p' ${{ inputs.file }} | tr -d '"')
;;
esac
echo "::set-output name=version::$version"

3
release-version-check/tests/fixtures/CalVer/Mobile-Android.xml vendored

@ -0,0 +1,3 @@ @@ -0,0 +1,3 @@
<?xml version='1.0' encoding='UTF-8'?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:versionCode="1" android:versionName="2022.05.0" android:installLocation="internalOnly" package="com.x8bit.bitwarden">
</manifest>
Loading…
Cancel
Save