Skip to content

Commit bd6ffef

Browse files
committed
int - Roll out CI builds
--- This is not done yet! --- Type: int Breaking: False Doc Required: False Backport Required: False Part: 1/1
1 parent e950765 commit bd6ffef

File tree

11 files changed

+101
-39
lines changed

11 files changed

+101
-39
lines changed

.github/workflows/build-rel.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@ jobs:
2727
dotnet-version: '8.0.x'
2828
- name: Solution Compilation (Windows)
2929
if: matrix.runs-on == 'windows-latest'
30-
run: cd tools ; ./build.cmd ; cd ..
30+
run: cd tools ; ./build.cmd Release -p:ContinuousIntegrationBuild=true ; cd ..
3131
- name: Solution Compilation (macOS)
3232
if: matrix.runs-on == 'macos-latest'
33-
run: make
33+
run: make rel-ci
3434
- name: Solution Compilation (Unix)
3535
if: matrix.runs-on == 'ubuntu-latest'
3636
run: |
3737
sudo apt install mono-complete
38-
make
38+
make rel-ci
3939
- name: Testing
4040
run: dotnet test --no-build --configuration Release
4141

.github/workflows/build.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@ jobs:
2727
dotnet-version: '8.0.x'
2828
- name: Solution Compilation (Windows)
2929
if: matrix.runs-on == 'windows-latest'
30-
run: cd tools ; ./build.cmd Debug ; cd ..
30+
run: cd tools ; ./build.cmd Debug -p:ContinuousIntegrationBuild=true ; cd ..
3131
- name: Solution Compilation (macOS)
3232
if: matrix.runs-on == 'macos-latest'
33-
run: make dbg
33+
run: make dbg-ci
3434
- name: Solution Compilation (Unix)
3535
if: matrix.runs-on == 'ubuntu-latest'
3636
run: |
3737
sudo apt install mono-complete
38-
make dbg
38+
make dbg-ci
3939
- name: Testing
4040
run: dotnet test --no-build --configuration Debug
4141

.github/workflows/release-canary.yml

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Prepare release (canary)
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
build:
13+
14+
runs-on: ubuntu-latest
15+
permissions:
16+
id-token: write
17+
contents: read
18+
attestations: write
19+
packages: write
20+
steps:
21+
- uses: actions/checkout@v4
22+
with:
23+
submodules: 'true'
24+
ref: ${{ github.ref }}
25+
- name: Setup .NET
26+
uses: actions/setup-dotnet@v4
27+
with:
28+
dotnet-version: '8.0.x'
29+
- name: Setup DocFX
30+
run: dotnet tool install --global docfx
31+
- name: Release Asset Preparation
32+
run: make dbg-ci
33+
- name: Package Publication
34+
run: |
35+
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"
36+
chmod +x tools/*.sh
37+
cd tools ; NUGET_APIKEY=${{ secrets.GITHUB_TOKEN }} ./push.sh Debug github ; cd ..

.github/workflows/release.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
id: release-asset
2929
run: |
3030
chmod +x tools/*.sh
31-
make
31+
make rel-ci
3232
make doc
3333
cd tools ; ./docgen-pack.sh ; cd ..
3434
echo "SUBJECT=$(cat CHANGES.TITLE)" >> "$GITHUB_OUTPUT"

Directory.Build.props

+13-6
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
<Project>
22
<PropertyGroup>
3-
<Version>1.0.0.1</Version>
3+
<Version>1.2.0</Version>
44
<Authors>Aptivi</Authors>
55
<Company>Aptivi</Company>
6-
<Copyright>Copyright (c) 2024 Aptivi</Copyright>
6+
<Copyright>Copyright (c) 2024-2025 Aptivi</Copyright>
77
<LangVersion>latest</LangVersion>
88
<DebugType>portable</DebugType>
9-
<Nullable>enable</Nullable>
109
<SignAssembly>True</SignAssembly>
10+
<Nullable>enable</Nullable>
1111
<WarningsAsErrors>CS9057,CS8002,nullable</WarningsAsErrors>
1212
<EnableSourceControlManagerQueries>true</EnableSourceControlManagerQueries>
1313
<RootPath>$(MSBuildThisFileDirectory)</RootPath>
1414
<AssemblyOriginatorKeyFile>$(RootPath)\aptivi_snk.snk</AssemblyOriginatorKeyFile>
1515
<Deterministic>true</Deterministic>
16-
<DeterministicSourcePaths>true</DeterministicSourcePaths>
1716
</PropertyGroup>
1817

1918
<PropertyGroup>
@@ -24,7 +23,15 @@
2423
<ItemGroup>
2524
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />
2625
</ItemGroup>
27-
<ItemGroup>
28-
<SourceRoot Include="$(MSBuildThisFileDirectory)/"/>
26+
<Target Name="EnsureCommitShaInclusion" BeforeTargets="GenerateNuspec" Condition="'$(Configuration)' == 'Debug' And '$(SourceRevisionId)' != '' And '$(ContinuousIntegrationBuild)' == 'true'">
27+
<ReadLinesFromFile File="$(RootPath)/private/BuildTargets/obj/.dtp">
28+
<Output TaskParameter="Lines" ItemName="DateTimePart"/>
29+
</ReadLinesFromFile>
30+
<CreateProperty Value="$(Version)-%(DateTimePart.Identity)+$(SourceRevisionId)">
31+
<Output TaskParameter="Value" PropertyName="PackageVersion"/>
32+
</CreateProperty>
33+
</Target>
34+
<ItemGroup Condition="'$(MSBuildProjectFile)' != 'BuildTargets.csproj'">
35+
<ProjectReference Include="$(RootPath)/private/BuildTargets/BuildTargets.csproj" PrivateAssets="All" />
2936
</ItemGroup>
3037
</Project>

Makefile

+6
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ all-online:
1515
dbg:
1616
$(MAKE) -C tools invoke-build ENVIRONMENT=Debug
1717

18+
dbg-ci:
19+
$(MAKE) -C tools invoke-build-ci ENVIRONMENT=Debug
20+
21+
rel-ci:
22+
$(MAKE) -C tools invoke-build-ci ENVIRONMENT=Release
23+
1824
doc:
1925
$(MAKE) -C tools invoke-doc-build
2026

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<Project Sdk="Microsoft.Build.NoTargets/3.7.56" DefaultTargets="Build">
2+
3+
<PropertyGroup>
4+
<TargetFramework>netstandard2.0</TargetFramework>
5+
</PropertyGroup>
6+
7+
<Target Name="DateTimePartAppend" BeforeTargets="Build" Condition="'$(ContinuousIntegrationBuild)' == 'true'">
8+
<PropertyGroup>
9+
<DateTimePart>$([System.DateTime]::Now.ToString('yyyyMMddHHmmss'))</DateTimePart>
10+
</PropertyGroup>
11+
<WriteLinesToFile Overwrite="true" File="$(MSBuildThisFileDirectory)/obj/.dtp" Lines="$(DateTimePart)" />
12+
<Message Importance="high" Text="Building on CI: $(DateTimePart)" />
13+
</Target>
14+
15+
</Project>

tools/Makefile

+5-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ DOTNET_HEAP_LIMIT = $(shell printf '%X\n' $$(($(DOTNET_AVPHYS_PAGES) * $(DOTNET_
77
invoke-build:
88
chmod +x ./build.sh
99
./build.sh $(ENVIRONMENT) || (echo Retrying with heap limit 0x$(DOTNET_HEAP_LIMIT)... && DOTNET_GCHeapHardLimit=$(DOTNET_HEAP_LIMIT) ./build.sh $(ENVIRONMENT))
10-
10+
11+
invoke-build-ci:
12+
chmod +x ./build.sh
13+
./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)
14+
1115
invoke-doc-build:
1216
chmod +x ./docgen.sh
1317
./docgen.sh || (echo Retrying with heap limit 0x$(DOTNET_HEAP_LIMIT)... && DOTNET_GCHeapHardLimit=$(DOTNET_HEAP_LIMIT) ./docgen.sh)

tools/build.cmd

+6-19
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,23 @@
11
@echo off
22

3-
REM Metalinker Copyright (C) 2024 Aptivi
4-
REM
5-
REM This file is part of Metalinker
6-
REM
7-
REM Metalinker is free software: you can redistribute it and/or modify
8-
REM it under the terms of the GNU General Public License as published by
9-
REM the Free Software Foundation, either version 3 of the License, or
10-
REM (at your option) any later version.
11-
REM
12-
REM Metalinker is distributed in the hope that it will be useful,
13-
REM but WITHOUT ANY WARRANTY; without even the implied warranty of
14-
REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15-
REM GNU General Public License for more details.
16-
REM
17-
REM You should have received a copy of the GNU General Public License
18-
REM along with this program. If not, see <https://www.gnu.org/licenses/>.
19-
203
REM This script builds and packs the artifacts. Use when you have VS installed.
214
set releaseconfig=%1
225
if "%releaseconfig%" == "" set releaseconfig=Release
236

7+
set buildoptions=%*
8+
call set buildoptions=%%buildoptions:*%1=%%
9+
if "%buildoptions%" == "*=" set buildoptions=
10+
2411
:download
2512
echo Downloading packages...
26-
"%ProgramFiles%\dotnet\dotnet.exe" restore "..\Metalinker.sln" -p:Configuration=%releaseconfig%
13+
"%ProgramFiles%\dotnet\dotnet.exe" restore "..\Metalinker.sln" -p:Configuration=%releaseconfig% %buildoptions%
2714
if %errorlevel% == 0 goto :build
2815
echo There was an error trying to download packages (%errorlevel%).
2916
goto :finished
3017

3118
:build
3219
echo Building Metalinker...
33-
"%ProgramFiles%\dotnet\dotnet.exe" build "..\Metalinker.sln" -p:Configuration=%releaseconfig%
20+
"%ProgramFiles%\dotnet\dotnet.exe" build "..\Metalinker.sln" -p:Configuration=%releaseconfig% %buildoptions%
3421
if %errorlevel% == 0 goto :success
3522
echo There was an error trying to build (%errorlevel%).
3623
goto :finished

tools/push.cmd

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
@echo off
22
set apikey=%1
3+
set source=%2
4+
if "%source%" == "" set source=nuget.org
35

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

tools/push.sh

+9-5
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
#!/bin/bash
22

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

@@ -31,12 +31,16 @@ releaseconf=$1
3131
if [ -z $releaseconf ]; then
3232
releaseconf=Release
3333
fi
34+
nugetsource=$2
35+
if [ -z $nugetsource ]; then
36+
nugetsource=nuget.org
37+
fi
3438
dotnetpath=`which dotnet`
3539
checkerror $? "dotnet is not found"
3640

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

4246
# Inform success

0 commit comments

Comments
 (0)