Skip to content

Commit

Permalink
int - Roll out CI builds
Browse files Browse the repository at this point in the history
---

This is not done yet!

---

Type: int
Breaking: False
Doc Required: False
Backport Required: False
Part: 1/1
  • Loading branch information
AptiviCEO committed Feb 5, 2025
1 parent dc9a8c4 commit 691ec20
Show file tree
Hide file tree
Showing 12 changed files with 101 additions and 39 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.GITHUB_TOKEN }} ./push.sh Debug 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
17 changes: 12 additions & 5 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<Project>
<PropertyGroup>
<Version>1.3.2</Version>
<Version>1.2.0</Version>
<Authors>Aptivi</Authors>
<Company>Aptivi</Company>
<Copyright>Copyright (c) 2024 Aptivi</Copyright>
<Copyright>Copyright (c) 2024-2025 Aptivi</Copyright>
<LangVersion>latest</LangVersion>
<DebugType>portable</DebugType>
<SignAssembly>True</SignAssembly>
Expand All @@ -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
2 changes: 1 addition & 1 deletion assets/file
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)
25 changes: 6 additions & 19 deletions tools/build.cmd
Original file line number Diff line number Diff line change
@@ -1,36 +1,23 @@
@echo off

REM Magico Copyright (C) 2024 Aptivi
REM
REM This file is part of Magico
REM
REM Magico is free software: you can redistribute it and/or modify
REM it under the terms of the GNU General Public License as published by
REM the Free Software Foundation, either version 3 of the License, or
REM (at your option) any later version.
REM
REM Magico is distributed in the hope that it will be useful,
REM but WITHOUT ANY WARRANTY; without even the implied warranty of
REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
REM GNU General Public License for more details.
REM
REM You should have received a copy of the GNU General Public License
REM along with this program. If not, see <https://www.gnu.org/licenses/>.

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 "..\Magico.sln" -p:Configuration=%releaseconfig%
"%ProgramFiles%\dotnet\dotnet.exe" restore "..\Magico.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 Magico...
"%ProgramFiles%\dotnet\dotnet.exe" build "..\Magico.sln" -p:Configuration=%releaseconfig%
"%ProgramFiles%\dotnet\dotnet.exe" build "..\Magico.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
14 changes: 9 additions & 5 deletions tools/push.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
#!/bin/bash

# Magico Copyright (C) 2024 Aptivi
#
#
# This file is part of Magico
#
#
# Magico is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
#
# Magico is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.

Expand All @@ -31,12 +31,16 @@ releaseconf=$1
if [ -z $releaseconf ]; then
releaseconf=Release
fi
nugetsource=$2
if [ -z $nugetsource ]; then
nugetsource=nuget.org
fi
dotnetpath=`which dotnet`
checkerror $? "dotnet is not found"

# Push packages
echo Pushing packages...
find .. -type f -path "**/bin/$releaseconf/*.nupkg" -exec dotnet nuget push {} --api-key $NUGET_APIKEY --source "nuget.org" \;
find .. -type f -path "**/bin/$releaseconf/*.nupkg" -exec dotnet nuget push {} --api-key $NUGET_APIKEY --source "$nugetsource" \;
checkerror $? "Failed to push"

# Inform success
Expand Down

0 comments on commit 691ec20

Please sign in to comment.