Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .github/scripts/BuildProject.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
param (
[string]$Project,
[string]$Head,
[string]$Configuration
)

# Calculate the fully qualified project name
if ($Project -eq "Riverside.Extensions.WinUI") {
$FullyQualifiedName = "Riverside.Extensions.$Head"
} else {
$FullyQualifiedName = "$($Project -replace '\.Toolkit\.', ".Toolkit.$Head.")"
}

# Define the project directory
$ScriptDirectory = Split-Path -Parent $MyInvocation.MyCommand.Path
$ProjectRoot = Join-Path -Path $ScriptDirectory -ChildPath "..\.."
$ProjectDirectory = Join-Path -Path $ProjectRoot -ChildPath "src\platforms\$FullyQualifiedName"

# Check if the project directory exists
if (-Not (Test-Path -Path $ProjectDirectory)) {
# Check in src\extensions if not found in src\platforms
$ProjectDirectory = Join-Path -Path $ProjectRoot -ChildPath "src\extensions\$Project"
if (-Not (Test-Path -Path $ProjectDirectory)) {
Write-Output "Project directory '$ProjectDirectory' does not exist, skipping build."
exit 0
}
}

# Navigate to the project directory
Set-Location -Path $ProjectDirectory

# Run MSBuild
msbuild /t:Restore /p:Configuration=$Configuration
msbuild /t:Build /p:Configuration=$Configuration /p:Platform=x64

# Return to the original location
Pop-Location
65 changes: 65 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: CD

on:
workflow_dispatch:
push:
branches:
- main
paths:
- 'eng/CurrentVersion.props'

jobs:
build:
name: Publish
runs-on: windows-latest
environment: NuGet
strategy:
fail-fast: false
matrix:
configuration: [Release]
env:
WORKING_DIR: ${{ github.workspace }}
SOLUTION_PATH: '${{ github.workspace }}\CubeKit.slnx'
HEAD_PROJECTS_DIR: '${{ github.workspace }}\src\platforms'
HEAD_EXTENSIONS_DIR: '${{ github.workspace }}\src\extensions'
CONFIGURATION: ${{ matrix.configuration }}
ARCHITECTURE: 'Any CPU'

steps:
- name: Checkout the repository
uses: actions/checkout@v4
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v2
- name: Setup NuGet
uses: NuGet/setup-nuget@v2
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.x

- name: Restore project
shell: pwsh
run: |
msbuild $env:SOLUTION_PATH `
-t:Restore `
-p:Platform=$env:ARCHITECTURE `
-p:Configuration=$env:CONFIGURATION

- name: Build CubeKit
run: |
msbuild "$env:SOLUTION_PATH" `
-t:Build `
-p:Configuration=$env:CONFIGURATION

- name: Package CubeKit
run: |
msbuild "$env:SOLUTION_PATH" `
-t:Build `
-p:Configuration=Release `
-p:PackageOutputPath="$env:WORKING_DIR\bin"

- name: Publish packages to NuGet
run: dotnet nuget push ./bin/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json

- name: Publish symbols to NuGet
run: dotnet nuget push ./bin/*.snupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json
158 changes: 158 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
name: CI

on:
push:
branches:
- main
paths-ignore:
- '*.md'
pull_request:
paths-ignore:
- '*.md'

# The run name, either 'CubeKit PR Validation' if via a PR, or just 'CubeKit CI' if activated another way.
run-name: ${{ github.event_name == 'pull_request' && 'CubeKit PR Validation' || 'CubeKit CI' }}

# Environment variables. No values should be hardcoded, they should all be accessible as an environment variable.
env:
# MSBuild file locations
WORKING_DIR: ${{ github.workspace }}
SOLUTION_PATH: '${{ github.workspace }}\CubeKit.slnx'
HEAD_PROJECTS_DIR: '${{ github.workspace }}\src\platforms'
HEAD_EXTENSIONS_DIR: '${{ github.workspace }}\src\extensions'
# Build configurations and tests
AUTOMATED_TESTS_ARCHITECTURE: 'x64'
AUTOMATED_TESTS_CONFIGURATION: 'Release'
# AUTOMATED_TESTS_PROJECT_DIR: '${{ github.workspace }}\tests\Files.InteractionTests'
# AUTOMATED_TESTS_PROJECT_PATH: '${{ github.workspace }}\tests\Files.InteractionTests\Files.InteractionTests.csproj'
# AUTOMATED_TESTS_ASSEMBLY_DIR: '${{ github.workspace }}\artifacts\TestsAssembly'
ARTIFACTS_STAGING_DIR: '${{ github.workspace }}\artifacts'

# Runner jobs
jobs:
# This is a simple workflow that checks the formatting of XAML.
# XAML is not used in many places in CubeKit, but ensuring that
# it is formatted is imperative nonetheless.
# TODO: Migrate this to a separate workflow in another repository
check-formatting:
name: Check Formatting

if: github.repository_owner == 'RiversideValley'

runs-on: windows-latest

steps:

- name: Checkout the repository
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Setup .NET 8
uses: actions/setup-dotnet@v4

- name: Install XamlStyler.Console
run: 'dotnet tool install --global XamlStyler.Console'

- name: Check XAML formatting
id: check-step
run: |
$changedFiles = (git diff --diff-filter=d --name-only HEAD~1) -split "\n" | Where-Object {$_ -like "*.xaml"}
foreach ($file in $changedFiles)
{
xstyler -p -l None -f $file
if ($LASTEXITCODE -ne 0)
{
echo "::error file=$file::Format check failed"
}
}
continue-on-error: true

- name: Fail if necessary
if: steps.check-step.outcome == 'failure'
run: exit 1

build:
name: Build

if: github.repository_owner == 'RiversideValley'

runs-on: windows-latest

strategy:
fail-fast: false
matrix:
configuration: [Debug, Release]
core: [Riverside.Extensions.Accountability, Riverside.Extensions.PInvoke, Riverside.Extensions.Primitives, Riverside.Extensions.UAP, Riverside.Extensions.Versioning, Riverside.Extensions.WinUI, Riverside.Toolkit.Animations, Riverside.Toolkit.Brushes, Riverside.Toolkit.Controls.Primitives, Riverside.Toolkit.Controls.TitleBar, Riverside.Toolkit.Converters, Riverside.Toolkit.Extensions, Riverside.Toolkit.Helpers, Riverside.Toolkit.Icons, Riverside.Toolkit.Services]
head: [Uno, Wpf, WinUI, Uwp]
exclude: # Exclude known failing configurations
- core: Riverside.Toolkit.Controls.TitleBar
- core: Riverside.Extensions.PInvoke
- core: Riverside.Extensions.UAP
- core: Riverside.Extensions.Versioning
- core: Riverside.Extensions.Accountability
- core: Riverside.Extensions.Primitives
- core: Riverside.Toolkit.Controls.Primitives
head: Wpf
- core: Riverside.Toolkit.Animations
head: Wpf
- core: Riverside.Toolkit.Brushes
head: Wpf
include:
- configuration: Debug
core: Riverside.Extensions.PInvoke
head: NetStandard
- configuration: Debug
core: Riverside.Extensions.UAP
head: NetStandard
- configuration: Debug
core: Riverside.Extensions.Versioning
head: NetStandard
- configuration: Debug
core: Riverside.Extensions.Accountability
head: NetStandard
- configuration: Debug
core: Riverside.Extensions.Primitives
head: NetStandard
- configuration: Release
core: Riverside.Extensions.PInvoke
head: NetStandard
- configuration: Release
core: Riverside.Extensions.UAP
head: NetStandard
- configuration: Release
core: Riverside.Extensions.Versioning
head: NetStandard
- configuration: Release
core: Riverside.Extensions.Accountability
head: NetStandard
- configuration: Release
core: Riverside.Extensions.Primitives
head: NetStandard
- configuration: Debug
core: Riverside.Toolkit.Controls.TitleBar
head: WinUI
- configuration: Release
core: Riverside.Toolkit.Controls.TitleBar
head: WinUI

env:
PROJECT: ${{ matrix.core }}
HEAD: ${{ matrix.head }}
CONFIGURATION: ${{ matrix.configuration }}

steps:

- name: Checkout the repository
uses: actions/checkout@v4
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v2
- name: Setup NuGet
uses: NuGet/setup-nuget@v2
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.x

- name: Build project
shell: pwsh
run: '.github\scripts\BuildProject.ps1 -Project $env:PROJECT -Head $env:HEAD -Configuration $env:CONFIGURATION'
Loading
Loading