Skip to content

Commit

Permalink
imp - Backported CI build support
Browse files Browse the repository at this point in the history
---

We've backported the CI build support for canary builds.

---

Type: imp
Breaking: False
Doc Required: False
Backport Required: False
Part: 1/1
  • Loading branch information
AptiviCEO committed Feb 5, 2025
1 parent d8e682c commit b53e7cc
Show file tree
Hide file tree
Showing 11 changed files with 96 additions and 14 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build-rel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ jobs:
dotnet-version: '8.0.x'
- name: Solution Compilation (Windows)
if: matrix.runs-on == 'windows-latest'
run: cd tools ; ./build.cmd ; cd ..
run: cd tools ; ./build.cmd Release -p:ContinuousIntegrationBuild=true ; cd ..
- name: Solution Compilation (macOS)
if: matrix.runs-on == 'macos-latest'
run: make
run: make rel-ci
- name: Solution Compilation (Unix)
if: matrix.runs-on == 'ubuntu-latest'
run: |
sudo apt install mono-complete
make
make rel-ci
- name: Testing
run: dotnet test --no-build --configuration Release

6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ jobs:
dotnet-version: '8.0.x'
- name: Solution Compilation (Windows)
if: matrix.runs-on == 'windows-latest'
run: cd tools ; ./build.cmd Debug ; cd ..
run: cd tools ; ./build.cmd Debug -p:ContinuousIntegrationBuild=true ; cd ..
- name: Solution Compilation (macOS)
if: matrix.runs-on == 'macos-latest'
run: make dbg
run: make dbg-ci
- name: Solution Compilation (Unix)
if: matrix.runs-on == 'ubuntu-latest'
run: |
sudo apt install mono-complete
make dbg
make dbg-ci
- name: Testing
run: dotnet test --no-build --configuration Debug

37 changes: 37 additions & 0 deletions .github/workflows/release-canary.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Prepare release (canary)

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build:

runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
attestations: write
packages: write
steps:
- uses: actions/checkout@v4
with:
submodules: 'true'
ref: ${{ github.ref }}
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Setup DocFX
run: dotnet tool install --global docfx
- name: Release Asset Preparation
run: make dbg-ci
- name: Package Publication
run: |
dotnet nuget add source --username AptiviCEO --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/Aptivi/index.json"
chmod +x tools/*.sh
cd tools ; NUGET_APIKEY=${{ secrets.NUGET_APIKEY }} ./push.sh github ; cd ..
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
id: release-asset
run: |
chmod +x tools/*.sh
make
make rel-ci
make doc
cd tools ; ./docgen-pack.sh ; cd ..
echo "SUBJECT=$(cat CHANGES.TITLE)" >> "$GITHUB_OUTPUT"
Expand Down
7 changes: 7 additions & 0 deletions Aptivestigate.sln
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Assets", "Assets", "{21A474
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Aptivestigate.Demo", "private\Aptivestigate.Demo\Aptivestigate.Demo.csproj", "{914E3A7C-D59C-4D64-8DAA-58AEB203AB21}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BuildTargets", "private\BuildTargets\BuildTargets.csproj", "{6584432E-CCE9-478D-BF35-03E64314D36A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -50,6 +52,10 @@ Global
{914E3A7C-D59C-4D64-8DAA-58AEB203AB21}.Debug|Any CPU.Build.0 = Debug|Any CPU
{914E3A7C-D59C-4D64-8DAA-58AEB203AB21}.Release|Any CPU.ActiveCfg = Release|Any CPU
{914E3A7C-D59C-4D64-8DAA-58AEB203AB21}.Release|Any CPU.Build.0 = Release|Any CPU
{6584432E-CCE9-478D-BF35-03E64314D36A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6584432E-CCE9-478D-BF35-03E64314D36A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6584432E-CCE9-478D-BF35-03E64314D36A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6584432E-CCE9-478D-BF35-03E64314D36A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -60,5 +66,6 @@ Global
{B1CF075E-6A7B-4D9B-ACED-427B6935DC5D} = {FB6A4D8D-4427-49E7-8930-B742261B2CBF}
{C17EEF49-F3C3-48AD-A7BB-6D14A9B5F8FF} = {FB6A4D8D-4427-49E7-8930-B742261B2CBF}
{914E3A7C-D59C-4D64-8DAA-58AEB203AB21} = {3ADC90D5-DA7F-4947-976A-84F4979B6FB7}
{6584432E-CCE9-478D-BF35-03E64314D36A} = {3ADC90D5-DA7F-4947-976A-84F4979B6FB7}
EndGlobalSection
EndGlobal
13 changes: 10 additions & 3 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
<RootPath>$(MSBuildThisFileDirectory)</RootPath>
<AssemblyOriginatorKeyFile>$(RootPath)\aptivi_snk.snk</AssemblyOriginatorKeyFile>
<Deterministic>true</Deterministic>
<DeterministicSourcePaths>true</DeterministicSourcePaths>
</PropertyGroup>

<PropertyGroup>
Expand All @@ -24,7 +23,15 @@
<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />
</ItemGroup>
<ItemGroup>
<SourceRoot Include="$(MSBuildThisFileDirectory)/"/>
<Target Name="EnsureCommitShaInclusion" BeforeTargets="GenerateNuspec" Condition="'$(Configuration)' == 'Debug' And '$(SourceRevisionId)' != '' And '$(ContinuousIntegrationBuild)' == 'true'">
<ReadLinesFromFile File="$(RootPath)/private/BuildTargets/obj/.dtp">
<Output TaskParameter="Lines" ItemName="DateTimePart"/>
</ReadLinesFromFile>
<CreateProperty Value="$(Version)-%(DateTimePart.Identity)+$(SourceRevisionId)">
<Output TaskParameter="Value" PropertyName="PackageVersion"/>
</CreateProperty>
</Target>
<ItemGroup Condition="'$(MSBuildProjectFile)' != 'BuildTargets.csproj'">
<ProjectReference Include="$(RootPath)/private/BuildTargets/BuildTargets.csproj" PrivateAssets="All" />
</ItemGroup>
</Project>
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ all-online:
dbg:
$(MAKE) -C tools invoke-build ENVIRONMENT=Debug

dbg-ci:
$(MAKE) -C tools invoke-build-ci ENVIRONMENT=Debug

rel-ci:
$(MAKE) -C tools invoke-build-ci ENVIRONMENT=Release

doc:
$(MAKE) -C tools invoke-doc-build

Expand Down
15 changes: 15 additions & 0 deletions private/BuildTargets/BuildTargets.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.Build.NoTargets/3.7.56" DefaultTargets="Build">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>

<Target Name="DateTimePartAppend" BeforeTargets="Build" Condition="'$(ContinuousIntegrationBuild)' == 'true'">
<PropertyGroup>
<DateTimePart>$([System.DateTime]::Now.ToString('yyyyMMddHHmmss'))</DateTimePart>
</PropertyGroup>
<WriteLinesToFile Overwrite="true" File="$(MSBuildThisFileDirectory)/obj/.dtp" Lines="$(DateTimePart)" />
<Message Importance="high" Text="Building on CI: $(DateTimePart)" />
</Target>

</Project>
6 changes: 5 additions & 1 deletion tools/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ DOTNET_HEAP_LIMIT = $(shell printf '%X\n' $$(($(DOTNET_AVPHYS_PAGES) * $(DOTNET_
invoke-build:
chmod +x ./build.sh
./build.sh $(ENVIRONMENT) || (echo Retrying with heap limit 0x$(DOTNET_HEAP_LIMIT)... && DOTNET_GCHeapHardLimit=$(DOTNET_HEAP_LIMIT) ./build.sh $(ENVIRONMENT))


invoke-build-ci:
chmod +x ./build.sh
./build.sh $(ENVIRONMENT) -p:ContinuousIntegrationBuild=true || (echo Retrying with heap limit 0x$(DOTNET_HEAP_LIMIT)... && DOTNET_GCHeapHardLimit=$(DOTNET_HEAP_LIMIT) ./build.sh $(ENVIRONMENT) -p:ContinuousIntegrationBuild=true)

invoke-doc-build:
chmod +x ./docgen.sh
./docgen.sh || (echo Retrying with heap limit 0x$(DOTNET_HEAP_LIMIT)... && DOTNET_GCHeapHardLimit=$(DOTNET_HEAP_LIMIT) ./docgen.sh)
8 changes: 6 additions & 2 deletions tools/build.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,20 @@ REM This script builds and packs the artifacts. Use when you have VS installed.
set releaseconfig=%1
if "%releaseconfig%" == "" set releaseconfig=Release

set buildoptions=%*
call set buildoptions=%%buildoptions:*%1=%%
if "%buildoptions%" == "*=" set buildoptions=

:download
echo Downloading packages...
"%ProgramFiles%\dotnet\dotnet.exe" restore "..\Aptivestigate.sln" -p:Configuration=%releaseconfig%
"%ProgramFiles%\dotnet\dotnet.exe" restore "..\Aptivestigate.sln" -p:Configuration=%releaseconfig% %buildoptions%
if %errorlevel% == 0 goto :build
echo There was an error trying to download packages (%errorlevel%).
goto :finished

:build
echo Building Aptivestigate...
"%ProgramFiles%\dotnet\dotnet.exe" build "..\Aptivestigate.sln" -p:Configuration=%releaseconfig%
"%ProgramFiles%\dotnet\dotnet.exe" build "..\Aptivestigate.sln" -p:Configuration=%releaseconfig% %buildoptions%
if %errorlevel% == 0 goto :success
echo There was an error trying to build (%errorlevel%).
goto :finished
Expand Down
4 changes: 3 additions & 1 deletion tools/push.cmd
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
@echo off
set apikey=%1
set source=%2
if "%source%" == "" set source=nuget.org

REM This script pushes. Use when you have VS installed.
echo Pushing...
cmd /C "forfiles /s /m *.nupkg /p ..\ /C "cmd /c dotnet nuget push @path --api-key %apikey% --source nuget.org""
cmd /C "forfiles /s /m *.nupkg /p ..\ /C "cmd /c dotnet nuget push @path --api-key %apikey% --source %source%""
if %errorlevel% == 0 goto :success
echo There was an error trying to push (%errorlevel%).
goto :finished
Expand Down

0 comments on commit b53e7cc

Please sign in to comment.