Skip to content

Commit

Permalink
Merge pull request #288 from MartinZikmund/feature/ci
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinZikmund authored Aug 13, 2024
2 parents 4a575d2 + 382a3e1 commit 609d88b
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 26 deletions.
37 changes: 11 additions & 26 deletions .github/steps/install_dependencies/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ inputs:
sdkVersion:
description: 'The version of the Windows Sdk'
required: false
default: '19041'
default: '22621'

runs:
using: "composite"
Expand All @@ -31,30 +31,15 @@ runs:
run: .\.github\Install-WindowsSdkISO.ps1 ${{ inputs.sdkVersion }}

# Run Uno.Check
- name: Run Uno.Check
- name: Install ${{ inputs.target-platform }} Workloads
shell: pwsh
run: |
dotnet tool install -g uno.check --version 1.17.0-dev.7
uno-check -v --ci --non-interactive --fix --skip vswin --skip vsmac --skip xcode --skip vswinworkloads --skip androidemulator --skip dotnetnewunotemplates --verbose
continue-on-error: true

# Install .NET workloads
- name: Install workloads
shell: pwsh
run: dotnet workload install ios maccatalyst android wasm-tools

# Install Node.js
- name: Setup Node.js environment
uses: actions/setup-node@v3.8.1

# Add MSBuild to the PATH: https://github.com/microsoft/setup-msbuild
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v1.3.1

- name: Set up dependency caching for faster builds
uses: actions/cache@v3
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
restore-keys: |
${{ runner.os }}-nuget-
dotnet tool install -g uno.check
("${{ inputs.target-platform }} ".Split(' ') | ForEach-Object {
$target = $_.Replace("_win", "").Replace("_macos", "")
if (![string]::IsNullOrEmpty($target)) {
echo "target: $target"
uno-check -v --ci --non-interactive --fix --target $target --skip vswin --skip vsmac --skip xcode --skip vswinworkloads --skip androidemulator --skip dotnetnewunotemplates
echo "uno-check finished for target: $target "
}
})
74 changes: 74 additions & 0 deletions .github/workflows/package-windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Build Windows Packages

on:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:

create_package:

strategy:
matrix:
configuration: [Release]
platform: [x86,x64,ARM64]

runs-on: windows-latest # For a list of available runner types, refer to
# https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on

env:
Solution_Fullname: src/MZikmund.sln
App_Project_Fullname: src/app/MZikmund.App/MZikmund.App.csproj
App_Project_Path: src/app/MZikmund.App
STEP_TIMEOUT_MINUTES: 60

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Install Dependencies
timeout-minutes: ${{ fromJSON(env.STEP_TIMEOUT_MINUTES) }}
uses: "./.github/steps/install_dependencies"

# Add MSBuild to the PATH: https://github.com/microsoft/setup-msbuild
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v1.3.1

# Restore the application to populate the obj folder with RuntimeIdentifiers
- name: Restore the application
run: msbuild $env:App_Project_Fullname /t:Restore /p:Configuration=$env:Configuration /p:PublishReadyToRun=true
env:
Configuration: ${{ matrix.configuration }}

# Create the app package by building and packaging the project
- name: Create the app package
run: msbuild $env:App_Project_Fullname /p:TargetFramework=net8.0-windows10.0.22621 /p:Configuration=$env:Configuration /p:Platform=$env:Platform /p:UapAppxPackageBuildMode=$env:Appx_Package_Build_Mode /p:AppxBundle=$env:Appx_Bundle /p:AppxPackageDir="$env:Appx_Package_Dir" /p:GenerateAppxPackageOnBuild=true
env:
Appx_Bundle: Never
Appx_Package_Build_Mode: CI
Appx_Package_Dir: Packages\
Configuration: ${{ matrix.configuration }}
Platform: ${{ matrix.platform }}

# Upload the MSIX package: https://github.com/marketplace/actions/upload-a-build-artifact
- name: Upload MSIX package
uses: actions/upload-artifact@v4
with:
name: MSIX_Package_${{ matrix.platform }}
path: ${{ env.App_Project_Path }}\\Packages

merge:
runs-on: windows-latest
needs: create_package
steps:
- name: Merge Artifacts
uses: actions/upload-artifact/merge@v4
with:
name: MSIX
delete-merged: true
pattern: MSIX_Package_*
retention-days: 10
5 changes: 5 additions & 0 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@
-->
<NoWarn>$(NoWarn);NU1507;NETSDK1201;PRI257;XAOBS001</NoWarn>
<WarningsNotAsErrors>Uno0001</WarningsNotAsErrors>

<!-- Temporary workaround for https://github.com/microsoft/WindowsAppSDK/issues/4480 -->
<WinAppSdkBuildToolsVersion Condition="$(TargetFramework.Contains('windows10'))">10.0.22621.3233</WinAppSdkBuildToolsVersion>
<UnoExtensionsVersion Condition="$(TargetFramework.Contains('windows10'))">4.2.2</UnoExtensionsVersion>

</PropertyGroup>

<ItemGroup>
Expand Down

0 comments on commit 609d88b

Please sign in to comment.