From 212f543df7ad435a28a8226d69244e35d973f545 Mon Sep 17 00:00:00 2001 From: jbe2277 Date: Fri, 1 Nov 2024 21:36:30 +0100 Subject: [PATCH] Build: Improve NewsReader.CI.yml --- .github/workflows/GetBuildVersion.yml | 14 +++--- .github/workflows/NewsReader.CI.yml | 69 ++++++++++++++++++--------- 2 files changed, 54 insertions(+), 29 deletions(-) diff --git a/.github/workflows/GetBuildVersion.yml b/.github/workflows/GetBuildVersion.yml index e8de9df4..09f8132c 100644 --- a/.github/workflows/GetBuildVersion.yml +++ b/.github/workflows/GetBuildVersion.yml @@ -23,20 +23,22 @@ on: jobs: getVersionJob: - name: 'Get Build Version' + name: 🔢 Get Build Version runs-on: windows-latest outputs: version: ${{ steps.getVersionStep.outputs.version }} versionCode: ${{ steps.getVersionStep.outputs.versionCode }} steps: - - uses: actions/checkout@v4 + - name: 🔖 Check-out + uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Install MinVer - run: | - dotnet tool install minver-cli -g + + - name: ⚙️ Install MinVer + run: dotnet tool update minver-cli -g + - id: getVersionStep - name: Get Build Version + name: 🔢 Get Build Version shell: pwsh run: | $verOut=minver -t v diff --git a/.github/workflows/NewsReader.CI.yml b/.github/workflows/NewsReader.CI.yml index 34e1d247..46e75173 100644 --- a/.github/workflows/NewsReader.CI.yml +++ b/.github/workflows/NewsReader.CI.yml @@ -12,19 +12,27 @@ jobs: GetVersion: uses: ./.github/workflows/GetBuildVersion.yml - Android: + Android: runs-on: windows-2022 needs: GetVersion steps: - - uses: actions/checkout@v4 - - name: Install .NET MAUI - run: | - dotnet workload install maui android - - name: Build + - name: 🔖 Check-out + uses: actions/checkout@v4 + + - name: ⚙️ Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: '8' + + - name: ⚙️ Install .NET MAUI + run: dotnet workload install maui android + + - name: 🛠️ Build run: | cd src/NewsReader/NewsReader.MauiSystem dotnet publish -f:net8.0-android -c:Release -p:ApplicationVersion=${{ needs.GetVersion.outputs.versionCode }} -p:ApplicationDisplayVersion=${{ needs.GetVersion.outputs.version }} - - name: Upload AAB, APK + + - name: 📦 Upload AAB, APK uses: actions/upload-artifact@v4 with: name: newsreader-android @@ -37,11 +45,18 @@ jobs: runs-on: windows-2022 needs: GetVersion steps: - - uses: actions/checkout@v4 - - name: Install .NET MAUI - run: | - dotnet workload install maui - - name: Build + - name: 🔖 Check-out + uses: actions/checkout@v4 + + - name: ⚙️ Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: '8' + + - name: ⚙️ Install .NET MAUI + run: dotnet workload install maui + + - name: 🛠️ Build # -p:ApplicationVersion=0 because of https://github.com/dotnet/maui/issues/18571 run: | cd src/NewsReader/NewsReader.MauiSystem @@ -51,19 +66,24 @@ jobs: runs-on: macos-14 needs: GetVersion steps: - - uses: actions/checkout@v4 - - name: Set Xcode version + - name: 🔖 Check-out + uses: actions/checkout@v4 + + - name: ⚙️ Set Xcode version run: | XCODE_ROOT=/Applications/Xcode_15.4.app echo "MD_APPLE_SDK_ROOT=$XCODE_ROOT" >> $GITHUB_ENV # set environment variable to specify Xcode for Mono and Xamarin sudo xcode-select -s $XCODE_ROOT - - uses: actions/setup-dotnet@v4 + + - name: ⚙️ Setup .NET + uses: actions/setup-dotnet@v4 with: - dotnet-version: '8.0.x' - - name: Install .NET MAUI - run: | - dotnet workload install maui ios - - name: Build + dotnet-version: '8' + + - name: ⚙️ Install .NET MAUI + run: dotnet workload install maui ios + + - name: 🛠️ Build run: | cd src/NewsReader/NewsReader.MauiSystem dotnet build -f net8.0-ios -c:Release /p:packageApp=false /p:buildForSimulator=true /p:ArchiveOnBuild=false -p:ApplicationVersion=${{ needs.GetVersion.outputs.version }} -p:ApplicationDisplayVersion=${{ needs.GetVersion.outputs.version }} @@ -72,12 +92,15 @@ jobs: runs-on: windows-2022 needs: GetVersion steps: - - uses: actions/checkout@v4 - - name: Domain.Test + - name: 🔖 Check-out + uses: actions/checkout@v4 + + - name: 🕵️ Test - Domain.Test run: | cd src/NewsReader/NewsReader.Domain.Test dotnet test -c:Release -p:Version=${{ needs.GetVersion.outputs.version }} - - name: Presentation.Test + + - name: 🕵️ Test - Presentation.Test run: | cd src/NewsReader/NewsReader.Presentation.Test dotnet test -c:Release -p:Version=${{ needs.GetVersion.outputs.version }}