Skip to content

Commit

Permalink
feat (github-actions.yml): we now target dotnet-workload version 8.0.402
Browse files Browse the repository at this point in the history
   the dotnet-workload-version is now an environment variable clearly visible at the top of the github actions file
  • Loading branch information
ksidirop-laerdal committed Oct 4, 2024
1 parent fa58473 commit 3038428
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 15 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/github-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ env:
SCL_DEPENDENCY_TRACKER_SERVER_URL: ${{ secrets.SCL_DEPENDENCY_TRACKER_SERVER_URL }}
SCL_DEPENDENCY_TRACKER_SIGNING_PRIVATE_KEY: ${{ secrets.SCL_DEPENDENCY_TRACKER_SIGNING_PRIVATE_KEY }}

DOTNET_TARGET_WORKLOAD_VERSION: "8.0.402" # dont upgrade this lightheartedly the workload snapshot implicitly defines which versions of Android/iOS/MacCatalyst SDKs are supported

BINDINGS_ANDROID___DOTNET_TARGET_PLATFORM_VERSION: "34"

BINDINGS_IOS___SDK_VERSION: "17.5"
Expand Down Expand Up @@ -68,6 +70,7 @@ jobs:
chmod +x "${{env.BUILD_REPOSITORY_FOLDERPATH}}/Laerdal.Scripts/Laerdal.SetupBuildEnvironment.sh" \
&& \
"${{env.BUILD_REPOSITORY_FOLDERPATH}}/Laerdal.Scripts/Laerdal.SetupBuildEnvironment.sh" \
"${{env.DOTNET_TARGET_WORKLOAD_VERSION}}" \
"https://nuget.pkg.github.com/Laerdal/index.json" \
"${{env.SCL_GITHUB_NUGET_FEED_USERNAME}}" \
"${{env.SCL_GITHUB_ACCESS_TOKEN}}" \
Expand Down
39 changes: 24 additions & 15 deletions Laerdal.Scripts/Laerdal.SetupBuildEnvironment.sh
Original file line number Diff line number Diff line change
@@ -1,29 +1,36 @@
#!/bin/bash

declare -r NUGET_FEED_URL="$1"
declare -r NUGET_FEED_USERNAME="$2"
declare -r NUGET_FEED_ACCESSTOKEN="$3"
declare -r DOTNET_TARGET_WORKLOAD_VERSION="$1"

declare -r ARTIFACTS_FOLDER_PATH="$4"
declare -r NUGET_FEED_URL="$2"
declare -r NUGET_FEED_USERNAME="$3"
declare -r NUGET_FEED_ACCESSTOKEN="$4"

declare -r ARTIFACTS_FOLDER_PATH="$5"

if [ -z "${DOTNET_TARGET_WORKLOAD_VERSION}" ]; then
echo "##vso[task.logissue type=error]Missing 'DOTNET_TARGET_WORKLOAD_VERSION' which was expected to be parameter #1."
exit 1
fi

if [ -z "${NUGET_FEED_URL}" ]; then
echo "##vso[task.logissue type=error]Missing 'NUGET_FEED_URL' which was expected to be parameter #1."
exit 3
echo "##vso[task.logissue type=error]Missing 'NUGET_FEED_URL' which was expected to be parameter #2."
exit 2
fi

if [ -z "${NUGET_FEED_USERNAME}" ]; then
echo "##vso[task.logissue type=error]Missing 'NUGET_FEED_USERNAME' which was expected to be parameter #2."
exit 5
echo "##vso[task.logissue type=error]Missing 'NUGET_FEED_USERNAME' which was expected to be parameter #3."
exit 3
fi

if [ -z "${NUGET_FEED_ACCESSTOKEN}" ]; then
echo "##vso[task.logissue type=error]Missing 'NUGET_FEED_ACCESSTOKEN' which was expected to be parameter #3."
exit 6
echo "##vso[task.logissue type=error]Missing 'NUGET_FEED_ACCESSTOKEN' which was expected to be parameter #4."
exit 4
fi

if [ -z "${ARTIFACTS_FOLDER_PATH}" ]; then
echo "##vso[task.logissue type=error]Missing 'ARTIFACTS_FOLDER_PATH' which was expected to be parameter #4."
exit 7
echo "##vso[task.logissue type=error]Missing 'ARTIFACTS_FOLDER_PATH' which was expected to be parameter #5."
exit 5
fi

brew install --cask objectivesharpie
Expand Down Expand Up @@ -74,18 +81,20 @@ fi
# we do our best to explicitly version-pin our workloads so as to preemptively avoid problems that
# would be bound to crop up sooner or later by blindly auto-upgrading to bleeding-edge workloads
#
# todo unfortunately issuing a 'dotnet workload restore' on the root folder doesnt work as intended
# todo on the azure pipelines and we need to figure out why
# also note that issuing a 'dotnet workload restore' doesnt work reliably and this is why resorted
# to being so explicit about the workloads we need
#
sudo dotnet \
workload \
install \
ios \
android \
maccatalyst \
maui \
maui-ios \
maui-tizen \
maui-android \
maui-maccatalyst
maui-maccatalyst --version "${DOTNET_TARGET_WORKLOAD_VERSION}"
declare exitCode=$?
if [ $exitCode != 0 ]; then
echo "##vso[task.logissue type=error]Failed to restore dotnet workloads."
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -690,6 +690,8 @@ git clone [email protected]:Laerdal-Medical/Laerdal.McuMgr.git --branch deve

```bash
# cd into the root folder of the repo
WORKLOAD_VERSION=8.0.402 \
&& \
sudo dotnet \
workload \
install \
Expand All @@ -701,12 +703,14 @@ sudo dotnet \
maui-tizen \
maui-android \
maui-maccatalyst \
--version "${WORKLOAD_VERSION}" \
&& \
cd "Laerdal.McuMgr.Bindings.iOS" \
&& \
sudo dotnet \
workload \
restore \
--version "${WORKLOAD_VERSION}" \
&& \
cd - \
&& \
Expand All @@ -715,6 +719,7 @@ cd "Laerdal.McuMgr.Bindings.MacCatalyst" \
sudo dotnet \
workload \
restore \
--version "${WORKLOAD_VERSION}" \
&& \
cd - \
&& \
Expand All @@ -723,6 +728,7 @@ cd "Laerdal.McuMgr.Bindings.Android" \
sudo dotnet \
workload \
restore \
--version "${WORKLOAD_VERSION}" \
&& \
cd -

Expand Down

0 comments on commit 3038428

Please sign in to comment.