Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GitHub: Added CI workflow #46

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft
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
59 changes: 59 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: CD

on:
workflow_dispatch:
pull_request:
branches:
- main

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

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:Platform=$env:ARCHITECTURE `
-p:Configuration=$env:CONFIGURATION

- name: Package CubeKit
run: dotnet pack ${{ env.PACKAGE_PROJECT_PATH }} --configuration Release --no-build -o ./output

- name: Publish package to NuGet
run: dotnet nuget push ./output/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json
# TODO: Publish symbols as well
124 changes: 124 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
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.sln'
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]
platform: [Any CPU]
env:
CONFIGURATION: ${{ matrix.configuration }}
ARCHITECTURE: ${{ matrix.platform }}
SLN_CONFIG_VALUE: ${{ matrix.configuration }}|${{ matrix.platform }}

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 NuGet
shell: pwsh
run: 'nuget restore $env:SOLUTION_PATH'

- 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 `
-clp:ErrorsOnly `
-p:Configuration=$env:CONFIGURATION `
-p:Platform=$env:ARCHITECTURE `
-p:GITHUB_ACTIONS=true `
-p:ExcludeProjects="Riverside.GlowUI*"
23 changes: 0 additions & 23 deletions CubeKit.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.12.35424.110
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Riverside.GlowUI", "dev\Riverside.GlowUI\Riverside.GlowUI.csproj", "{39D58D51-829F-4259-BD22-E65BFFB7D7A1}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Riverside.GlowUI.Materials", "dev\Riverside.GlowUI.Materials\Riverside.GlowUI.Materials.csproj", "{E19D0B9E-25D9-49BD-8F1B-D3DA0C9C80D9}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Riverside.Toolkit.UITests", "tests\Riverside.Toolkit.UITests\Riverside.Toolkit.UITests.csproj", "{3A31D3ED-B0A5-4023-9E49-7E5F809094D5}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{58CE73C0-AA7E-43B7-AD2E-B66182029009}"
Expand Down Expand Up @@ -68,10 +64,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Riverside.Toolkit.WinUI.Ico
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Riverside.Toolkit.WinUI.Services", "src\platforms\Riverside.Toolkit.WinUI.Services\Riverside.Toolkit.WinUI.Services.csproj", "{5D3784A7-CC3B-43FE-8AF3-8C996ADBC4E1}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Riverside.Toolkit.Flyouts", "dev\Riverside.Toolkit.Flyouts\Riverside.Toolkit.Flyouts.csproj", "{B1BBC377-DAE1-4638-5A7A-2AB159EE8BB8}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "dev", "dev", "{2E2D7A71-B62D-4EE3-AC3E-1AECF61D0583}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "extensions", "extensions", "{91BB25A0-AA77-4B6C-A101-2717467BA888}"
EndProject
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Riverside.Extensions.WinUI", "src\core\Riverside.Extensions.WinUI\Riverside.Extensions.WinUI.shproj", "{A33F78A1-9797-47F2-A93E-BA1963E3C0BD}"
Expand All @@ -94,14 +86,6 @@ Global
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{39D58D51-829F-4259-BD22-E65BFFB7D7A1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{39D58D51-829F-4259-BD22-E65BFFB7D7A1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{39D58D51-829F-4259-BD22-E65BFFB7D7A1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{39D58D51-829F-4259-BD22-E65BFFB7D7A1}.Release|Any CPU.Build.0 = Release|Any CPU
{E19D0B9E-25D9-49BD-8F1B-D3DA0C9C80D9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E19D0B9E-25D9-49BD-8F1B-D3DA0C9C80D9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E19D0B9E-25D9-49BD-8F1B-D3DA0C9C80D9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E19D0B9E-25D9-49BD-8F1B-D3DA0C9C80D9}.Release|Any CPU.Build.0 = Release|Any CPU
{3A31D3ED-B0A5-4023-9E49-7E5F809094D5}.Debug|Any CPU.ActiveCfg = Debug|x64
{3A31D3ED-B0A5-4023-9E49-7E5F809094D5}.Debug|Any CPU.Build.0 = Debug|x64
{3A31D3ED-B0A5-4023-9E49-7E5F809094D5}.Debug|Any CPU.Deploy.0 = Debug|x64
Expand Down Expand Up @@ -160,10 +144,6 @@ Global
{5D3784A7-CC3B-43FE-8AF3-8C996ADBC4E1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5D3784A7-CC3B-43FE-8AF3-8C996ADBC4E1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5D3784A7-CC3B-43FE-8AF3-8C996ADBC4E1}.Release|Any CPU.Build.0 = Release|Any CPU
{B1BBC377-DAE1-4638-5A7A-2AB159EE8BB8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B1BBC377-DAE1-4638-5A7A-2AB159EE8BB8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B1BBC377-DAE1-4638-5A7A-2AB159EE8BB8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B1BBC377-DAE1-4638-5A7A-2AB159EE8BB8}.Release|Any CPU.Build.0 = Release|Any CPU
{1846753E-E9A5-43C1-9BD5-75E96FAA7273}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1846753E-E9A5-43C1-9BD5-75E96FAA7273}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1846753E-E9A5-43C1-9BD5-75E96FAA7273}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down Expand Up @@ -193,8 +173,6 @@ Global
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{39D58D51-829F-4259-BD22-E65BFFB7D7A1} = {2E2D7A71-B62D-4EE3-AC3E-1AECF61D0583}
{E19D0B9E-25D9-49BD-8F1B-D3DA0C9C80D9} = {2E2D7A71-B62D-4EE3-AC3E-1AECF61D0583}
{3A31D3ED-B0A5-4023-9E49-7E5F809094D5} = {ECDCDFAD-F6D7-4A50-9EA1-B50C7DC6DFC7}
{19B394FA-B98D-48A5-8F1E-B26A9C8B5D02} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
{8EBAEA2A-405D-4F0F-ADCA-CEA72D53A527} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
Expand All @@ -218,7 +196,6 @@ Global
{245D1074-ABD4-456C-95D8-6C5F06CB6C9E} = {AA619411-1D80-4167-9BB6-84534B676BEB}
{81666F0E-D457-4634-84BB-20DF6D4CCFF4} = {AA619411-1D80-4167-9BB6-84534B676BEB}
{5D3784A7-CC3B-43FE-8AF3-8C996ADBC4E1} = {AA619411-1D80-4167-9BB6-84534B676BEB}
{B1BBC377-DAE1-4638-5A7A-2AB159EE8BB8} = {2E2D7A71-B62D-4EE3-AC3E-1AECF61D0583}
{91BB25A0-AA77-4B6C-A101-2717467BA888} = {58CE73C0-AA7E-43B7-AD2E-B66182029009}
{A33F78A1-9797-47F2-A93E-BA1963E3C0BD} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
{1846753E-E9A5-43C1-9BD5-75E96FAA7273} = {91BB25A0-AA77-4B6C-A101-2717467BA888}
Expand Down
3 changes: 3 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
<PropertyGroup Condition="'$(TF_BUILD)' == 'true' or '$(GITHUB_ACTIONS)' == 'true'">
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
</PropertyGroup>
<ItemGroup Condition="'$(ContinuousIntegrationBuild)' == 'true' and '$(IsUwpProject)' == 'true'">
<PackageReference Include="Microsoft.Windows.SDK.CPP" Version="10.0.26100.2454" />
</ItemGroup>

<ItemGroup>
<Compile Include="$(BuildDirectory)\GlobalUsings.cs" />
Expand Down
Loading