Skip to content

Commit

Permalink
Build: Improve NewsReader.CI.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
jbe2277 authored Nov 1, 2024
1 parent 83d9d5a commit 212f543
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 29 deletions.
14 changes: 8 additions & 6 deletions .github/workflows/GetBuildVersion.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
69 changes: 46 additions & 23 deletions .github/workflows/NewsReader.CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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 }}
Expand All @@ -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 }}

0 comments on commit 212f543

Please sign in to comment.