Skip to content

Commit

Permalink
Add CI workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
DamianEdwards committed Jan 26, 2024
1 parent b9c9116 commit 5757feb
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: eShop Workshop CI

on:
push:
branches: [main]
paths-ignore:
- "**/*.md"
- "**/*.gitignore"
- "**/*.gitattributes"

pull_request:
paths-ignore:
- "**/*.md"
- "**/*.gitignore"
- "**/*.gitattributes"

workflow_dispatch:

jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
name: Build Repo
env:
DOTNET_CLI_TELEMETRY_OPTOUT: true
steps:
- uses: actions/checkout@v3

- name: Install .NET SDK
uses: actions/setup-dotnet@v3
with:
global-json-file: ${{ matrix.os == 'ubuntu-latest' && './global.json' || '.\global.json' }}

- name: Build
run: ${{ matrix.os == 'ubuntu-latest' && './build.sh' || '.\build.cmd' }}
6 changes: 6 additions & 0 deletions build.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
@ECHO OFF

dotnet workload update --skip-sign-check --source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet8/nuget/v3/index.json
dotnet workload install aspire --skip-sign-check --source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet8/nuget/v3/index.json

dotnet build .\build\Build.proj
6 changes: 6 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash

dotnet workload update --skip-sign-check --source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet8/nuget/v3/index.json
dotnet workload install aspire --skip-sign-check --source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet8/nuget/v3/index.json

dotnet build ./build/Build.proj
39 changes: 39 additions & 0 deletions build/Build.proj
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<Project Sdk="Microsoft.Build.NoTargets/3.7.0">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<RepoSlns Include="$(MSBuildThisFileDirectory)../*.sln" />
<AppHostProjects Include="$(MSBuildThisFileDirectory)../src/**/*.AppHost/*.AppHost.csproj" />
</ItemGroup>

<Target Name="BuildRepoSlns" BeforeTargets="Build">
<Message Text="Building @(RepoSlns->Count()) solutions" Importance="High" />

<MSBuild Projects="@(RepoSlns)" Targets="Restore" />
<MSBuild Projects="@(RepoSlns)" Targets="Build" BuildInParallel="True" />

<Message Text="@(RepoSlns->Count()) solutions successfully built" Importance="High" />
</Target>

<!-- <Target Name="PublishRepoSlns" AfterTargets="BuildRepoSlns">
<Message Text="Publishing @(RepoSlns->Count()) solutions" Importance="High" />
<MSBuild Projects="@(RepoSlns)" Targets="Restore" />
<MSBuild Projects="@(RepoSlns)" Targets="Publish" BuildInParallel="True" />
<Message Text="@(RepoSlns->Count()) solutions successfully published" Importance="High" />
</Target> -->

<Target Name="GenerateAppHostManifests" AfterTargets="PublishRepoSlns">
<Message Text="Generating manifests for @(AppHostProjects->Count()) AppHost projects" Importance="High" />

<MSBuild Projects="@(AppHostProjects)" Targets="GenerateAspireManifest" BuildInParallel="True">
<Output TaskParameter="TargetOutputs" ItemName="GeneratedManifestFiles" />
</MSBuild>

<Message Text="Generated manifest for '%(GeneratedManifestFiles.MSBuildSourceProjectFile)'" Importance="High" />
<Message Text="@(AppHostProjects->Count()) manifests generated" Importance="High" />
</Target>
</Project>

0 comments on commit 5757feb

Please sign in to comment.