Skip to content

Commit b4a8d6d

Browse files
committed
int - Backported build system improvements
--- Type: int Breaking: False Doc Required: False Backport Required: False Part: 1/1
1 parent 73939a1 commit b4a8d6d

File tree

17 files changed

+173
-291
lines changed

17 files changed

+173
-291
lines changed

.github/workflows/build-rel.yml

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -15,29 +15,29 @@ jobs:
1515
runs-on: ${{ matrix.runs-on }}
1616

1717
steps:
18-
- uses: actions/checkout@v4
19-
with:
20-
ref: ${{ github.ref }}
21-
- name: Setup .NET
22-
uses: actions/setup-dotnet@v4
23-
with:
24-
dotnet-version: '8.0.x'
25-
- name: Solution Compilation (Windows)
26-
if: matrix.runs-on == 'windows-latest'
27-
run: cd tools ; ./build.cmd Release -p:ContinuousIntegrationBuild=true ; cd ..
28-
- name: Solution Compilation (Unix)
29-
if: matrix.runs-on != 'windows-latest'
30-
run: make rel-ci
31-
- name: Testing
32-
run: dotnet test --no-build --configuration Release
33-
- uses: actions/upload-artifact@v4
34-
if: success() || failure()
35-
with:
36-
name: unit-test-log-${{ matrix.runs-on }}
37-
path: "private/Nitrocid.Tests/KSTest/net8.0/UnitTestDebug.log"
38-
- uses: actions/upload-artifact@v4
39-
if: success() || failure()
40-
with:
41-
name: unit-test-log-ms-${{ matrix.runs-on }}
42-
path: "private/Nitrocid.Tests/KSTest/net8.0/TestResults"
43-
18+
- uses: actions/checkout@v4
19+
with:
20+
submodules: 'true'
21+
ref: ${{ github.ref }}
22+
- name: Setup .NET
23+
uses: actions/setup-dotnet@v4
24+
with:
25+
dotnet-version: '8.0.x'
26+
- name: Solution Compilation (Windows)
27+
if: matrix.runs-on == 'windows-latest'
28+
run: ./tools/build.cmd Release -p:ContinuousIntegrationBuild=true
29+
- name: Solution Compilation (Unix)
30+
if: matrix.runs-on != 'windows-latest'
31+
run: make rel-ci
32+
- name: Testing
33+
run: dotnet test --no-build --configuration Release
34+
- uses: actions/upload-artifact@v4
35+
if: success() || failure()
36+
with:
37+
name: unit-test-log-${{ matrix.runs-on }}
38+
path: "private/Nitrocid.Tests/KSTest/net8.0/UnitTestDebug.log"
39+
- uses: actions/upload-artifact@v4
40+
if: success() || failure()
41+
with:
42+
name: unit-test-log-ms-${{ matrix.runs-on }}
43+
path: "private/Nitrocid.Tests/KSTest/net8.0/TestResults"

.github/workflows/build.yml

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -15,29 +15,30 @@ jobs:
1515
runs-on: ${{ matrix.runs-on }}
1616

1717
steps:
18-
- uses: actions/checkout@v4
19-
with:
20-
ref: ${{ github.ref }}
21-
- name: Setup .NET
22-
uses: actions/setup-dotnet@v4
23-
with:
24-
dotnet-version: '8.0.x'
25-
- name: Solution Compilation (Windows)
26-
if: matrix.runs-on == 'windows-latest'
27-
run: cd tools ; ./build.cmd Debug -p:ContinuousIntegrationBuild=true ; cd ..
28-
- name: Solution Compilation (Unix)
29-
if: matrix.runs-on != 'windows-latest'
30-
run: make dbg-ci
31-
- name: Testing
32-
run: dotnet test --no-build --configuration Debug
33-
- uses: actions/upload-artifact@v4
34-
if: success() || failure()
35-
with:
36-
name: unit-test-log-${{ matrix.runs-on }}
37-
path: "private/Nitrocid.Tests/KSTest/net8.0/UnitTestDebug.log"
38-
- uses: actions/upload-artifact@v4
39-
if: success() || failure()
40-
with:
41-
name: unit-test-log-ms-${{ matrix.runs-on }}
42-
path: "private/Nitrocid.Tests/KSTest/net8.0/TestResults"
43-
18+
- uses: actions/checkout@v4
19+
with:
20+
submodules: 'true'
21+
ref: ${{ github.ref }}
22+
- name: Setup .NET
23+
uses: actions/setup-dotnet@v4
24+
with:
25+
dotnet-version: '8.0.x'
26+
- name: Solution Compilation (Windows)
27+
if: matrix.runs-on == 'windows-latest'
28+
run: ./tools/build.cmd Debug -p:ContinuousIntegrationBuild=true
29+
- name: Solution Compilation (Unix)
30+
if: matrix.runs-on != 'windows-latest'
31+
run: make dbg-ci
32+
- name: Testing
33+
run: dotnet test --no-build --configuration Debug
34+
- uses: actions/upload-artifact@v4
35+
if: success() || failure()
36+
with:
37+
name: unit-test-log-${{ matrix.runs-on }}
38+
path: "private/Nitrocid.Tests/KSTest/net8.0/UnitTestDebug.log"
39+
- uses: actions/upload-artifact@v4
40+
if: success() || failure()
41+
with:
42+
name: unit-test-log-ms-${{ matrix.runs-on }}
43+
path: "private/Nitrocid.Tests/KSTest/net8.0/TestResults"
44+

.github/workflows/codeql.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,7 @@ jobs:
3434
with:
3535
languages: ${{ matrix.language }}
3636
- name: Build
37-
run: |
38-
chmod +x ./tools/build.sh
39-
cd tools && ./build.sh && cd -
37+
run: make rel-ci
4038
- name: Perform CodeQL Analysis
4139
uses: github/codeql-action/analyze@v3
4240
with:

.github/workflows/docgen.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
run: dotnet tool install --global docfx
2727
- name: Generating Documentation
2828
run: |
29-
make
29+
make rel-ci
3030
make doc
3131
- name: Saving changes to gh-pages
3232
uses: peaceiris/actions-gh-pages@v3

.github/workflows/release-canary.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
dotnet-version: '8.0.x'
2727
- name: Release Asset Preparation
2828
run: |
29-
cd tools ; cmd.exe /c "build.cmd Debug -p:ContinuousIntegrationBuild=true" ; cd ..
29+
cmd.exe /c "tools\build.cmd Debug -p:ContinuousIntegrationBuild=true"
3030
dotnet build -p:Configuration=Debug -p:Platform=x64 public/Nitrocid.Installers/Nitrocid.Installer.sln
3131
dotnet build -p:Configuration=Debug -p:Platform=ARM64 public/Nitrocid.Installers/Nitrocid.Installer.sln
3232
Move-Item public/Nitrocid.Installers/Nitrocid.InstallerBundle/bin/x64/Debug/Nitrocid.InstallerBundle.exe tools/nitrocid-win-x64-installer.exe
@@ -50,5 +50,4 @@ jobs:
5050
- name: Package Publication
5151
run: |
5252
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"
53-
chmod +x tools/*.sh
54-
cd tools ; cmd.exe /C "push.cmd ${{ secrets.GITHUB_TOKEN }} github" ; cd ..
53+
cmd.exe /C "tools\push.cmd ${{ secrets.GITHUB_TOKEN }} github"

.github/workflows/release.yml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ jobs:
2626
run: dotnet tool install --global docfx
2727
- name: Release Asset Preparation
2828
run: |
29-
cd tools ; cmd.exe /c "build.cmd Release -p:ContinuousIntegrationBuild=true" ; cd ..
30-
cd tools ; cmd.exe /c "pack.cmd" ; cd ..
31-
cd tools ; cmd.exe /c "docgen.cmd" ; cd ..
32-
cd tools ; cmd.exe /c "docgen-pack.cmd" ; cd ..
29+
cmd.exe /c "tools\build.cmd Release -p:ContinuousIntegrationBuild=true"
30+
cmd.exe /c "tools\pack.cmd"
31+
cmd.exe /c "tools\docgen.cmd"
32+
cmd.exe /c "tools\docgen-pack.cmd"
3333
dotnet build -p:Configuration=Release -p:Platform=x64 public/Nitrocid.Installers/Nitrocid.Installer.sln
3434
dotnet build -p:Configuration=Release -p:Platform=ARM64 public/Nitrocid.Installers/Nitrocid.Installer.sln
3535
Move-Item public/Nitrocid.Installers/Nitrocid.InstallerBundle/bin/x64/Release/Nitrocid.InstallerBundle.exe tools/nitrocid-win-x64-installer.exe
@@ -58,12 +58,10 @@ jobs:
5858
tools/*.zip
5959
tools/*-changes.chg
6060
tools/*.exe
61+
- name: Package Publication
62+
run: cmd.exe /C "tools\push.cmd ${{ secrets.NUGET_APIKEY }}"
6163
- name: Notify build
6264
uses: tsickert/[email protected]
6365
with:
6466
webhook-url: ${{ secrets.WEBHOOK_URL }}
6567
content: "<:nitrocidks:1268905174563557452> ${{ steps.release-asset.outputs.SUBJECT }} <:nitrocidks:1268905174563557452>\n\n${{ steps.release-asset.outputs.BODY }}"
66-
- name: Package Publication
67-
run: |
68-
chmod +x tools/*.sh
69-
cd tools ; cmd.exe /C "push.cmd ${{ secrets.NUGET_APIKEY }}" ; cd ..

tools/build.cmd

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,29 @@
11
@echo off
22

3-
REM Nitrocid KS Copyright (C) 2018-2025 Aptivi
4-
REM
5-
REM This file is part of Nitrocid KS
6-
REM
7-
REM Nitrocid KS 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 Nitrocid KS 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-
20-
REM This script builds KS and packs the artifacts. Use when you have VS installed.
3+
REM This script builds and packs the artifacts.
214
set releaseconfig=%1
225
if "%releaseconfig%" == "" set releaseconfig=Release
236

247
set buildoptions=%*
258
call set buildoptions=%%buildoptions:*%1=%%
269
if "%buildoptions%" == "*=" set buildoptions=
2710

11+
REM Turn off telemetry and logo
12+
set DOTNET_CLI_TELEMETRY_OPTOUT=1
13+
set DOTNET_NOLOGO=1
14+
15+
set ROOTDIR=%~dp0\..
16+
2817
:download
2918
echo Downloading packages...
30-
"%ProgramFiles%\dotnet\dotnet.exe" restore "..\Nitrocid.sln" -p:Configuration=%releaseconfig% %buildoptions%
19+
"%ProgramFiles%\dotnet\dotnet.exe" restore "%ROOTDIR%\Nitrocid.sln" -p:Configuration=%releaseconfig% %buildoptions%
3120
if %errorlevel% == 0 goto :build
3221
echo There was an error trying to download packages (%errorlevel%).
3322
goto :finished
3423

3524
:build
36-
echo Building Nitrocid KS...
37-
"%ProgramFiles%\dotnet\dotnet.exe" build "..\Nitrocid.sln" -p:Configuration=%releaseconfig% -maxCpuCount:1 %buildoptions%
25+
echo Building...
26+
"%ProgramFiles%\dotnet\dotnet.exe" build "%ROOTDIR%\Nitrocid.sln" -p:Configuration=%releaseconfig% %buildoptions%
3827
if %errorlevel% == 0 goto :success
3928
echo There was an error trying to build (%errorlevel%).
4029
goto :finished

tools/build.sh

Lines changed: 15 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,7 @@
11
#!/bin/bash
22

3-
# Nitrocid KS Copyright (C) 2018-2025 Aptivi
4-
#
5-
# This file is part of Nitrocid KS
6-
#
7-
# Nitrocid KS is free software: you can redistribute it and/or modify
8-
# it under the terms of the GNU General Public License as published by
9-
# the Free Software Foundation, either version 3 of the License, or
10-
# (at your option) any later version.
11-
#
12-
# Nitrocid KS is distributed in the hope that it will be useful,
13-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15-
# GNU General Public License for more details.
16-
#
17-
# You should have received a copy of the GNU General Public License
18-
# along with this program. If not, see <https://www.gnu.org/licenses/>.
3+
# Repository root
4+
ROOTDIR=$( cd -- "$( dirname -- "$0" )/.." &> /dev/null && pwd )
195

206
# Convenience functions
217
checkerror() {
@@ -26,25 +12,29 @@ checkerror() {
2612
fi
2713
}
2814

29-
# This script builds KS. Use when you have dotnet installed.
30-
ksreleaseconf=$1
31-
if [ -z $ksreleaseconf ]; then
32-
ksreleaseconf=Release
15+
# This script builds.
16+
releaseconf=$1
17+
if [ -z $releaseconf ]; then
18+
releaseconf=Release
3319
fi
3420

3521
# Check for dependencies
3622
dotnetpath=`which dotnet`
3723
checkerror $? "dotnet is not found"
3824

25+
# Turn off telemetry and logo
26+
export DOTNET_CLI_TELEMETRY_OPTOUT=1
27+
export DOTNET_NOLOGO=1
28+
3929
# Download packages
4030
echo Downloading packages...
41-
"$dotnetpath" restore "../Nitrocid.sln" -p:Configuration=$ksreleaseconf ${@:2}
31+
"$dotnetpath" restore "$ROOTDIR/Nitrocid.sln" -p:Configuration=$releaseconf ${@:2}
4232
checkerror $? "Failed to download packages"
4333

44-
# Build KS
45-
echo Building KS...
46-
"$dotnetpath" build "../Nitrocid.sln" -p:Configuration=$ksreleaseconf -maxCpuCount:1 ${@:2}
47-
checkerror $? "Failed to build Nitrocid"
34+
# Build
35+
echo Building...
36+
"$dotnetpath" build "$ROOTDIR/Nitrocid.sln" -p:Configuration=$releaseconf ${@:2}
37+
checkerror $? "Failed to build"
4838

4939
# Inform success
5040
echo Build successful.

tools/docgen-pack.cmd

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
11
@echo off
22

3-
REM This script builds KS documentation and packs the artifacts. Use when you have VS installed.
4-
for /f "tokens=*" %%g in ('findstr "<Version>" ..\Directory.Build.props') do (set MIDVER=%%g)
5-
for /f "tokens=1 delims=<" %%a in ("%MIDVER:~9%") do (set ksversion=%%a)
3+
set ROOTDIR=%~dp0\..
4+
5+
REM This script builds the documentation and packs the artifacts.
6+
for /f "tokens=*" %%g in ('findstr "<Version>" %ROOTDIR%\Directory.Build.props') do (set MIDVER=%%g)
7+
for /f "tokens=1 delims=<" %%a in ("%MIDVER:~9%") do (set version=%%a)
68

79
:pack
810
echo Packing documentation...
9-
"%ProgramFiles%\7-Zip\7z.exe" a -tzip %temp%/%ksversion%-doc.zip "..\docs\*"
11+
"%ProgramFiles%\7-Zip\7z.exe" a -tzip %temp%/%version%-doc.zip "%ROOTDIR%\docs\*"
1012
if %errorlevel% == 0 goto :finalize
1113
echo There was an error trying to pack documentation (%errorlevel%).
1214
goto :finished
1315

1416
:finalize
15-
rmdir /S /Q "..\DocGen\api\"
16-
rmdir /S /Q "..\DocGen\obj\"
17-
rmdir /S /Q "..\docs\"
18-
move %temp%\%ksversion%-doc.zip
17+
rmdir /S /Q "%ROOTDIR%\DocGen\api\"
18+
rmdir /S /Q "%ROOTDIR%\DocGen\obj\"
19+
rmdir /S /Q "%ROOTDIR%\docs\"
20+
move %temp%\%version%-doc.zip %ROOTDIR%\tools\
1921
echo Build and pack successful.
2022
goto :finished
2123

tools/docgen-pack.sh

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,7 @@
11
#!/bin/bash
22

3-
# Nitrocid KS Copyright (C) 2018-2025 Aptivi
4-
#
5-
# This file is part of Nitrocid KS
6-
#
7-
# Nitrocid KS is free software: you can redistribute it and/or modify
8-
# it under the terms of the GNU General Public License as published by
9-
# the Free Software Foundation, either version 3 of the License, or
10-
# (at your option) any later version.
11-
#
12-
# Nitrocid KS is distributed in the hope that it will be useful,
13-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15-
# GNU General Public License for more details.
16-
#
17-
# You should have received a copy of the GNU General Public License
18-
# along with this program. If not, see <https://www.gnu.org/licenses/>.
3+
# Repository root
4+
ROOTDIR=$( cd -- "$( dirname -- "$0" )/.." &> /dev/null && pwd )
195

206
# Convenience functions
217
checkerror() {
@@ -26,8 +12,8 @@ checkerror() {
2612
fi
2713
}
2814

29-
# This script builds KS and packs the artifacts. Use when you have MSBuild installed.
30-
ksversion=$(grep "<Version>" ../Directory.Build.props | cut -d "<" -f 2 | cut -d ">" -f 2)
15+
# This script builds the documentation and packs the artifacts.
16+
version=$(grep "<Version>" $ROOTDIR/Directory.Build.props | cut -d "<" -f 2 | cut -d ">" -f 2)
3117
checkerror $? "Failed to get version. Check to make sure that the version is specified correctly in D.B.props"
3218

3319
# Check for dependencies
@@ -36,17 +22,17 @@ checkerror $? "zip is not found"
3622

3723
# Pack documentation
3824
echo Packing documentation...
39-
cd "../docs/" && "$zippath" -r /tmp/$ksversion-doc.zip . && cd -
25+
cd "$ROOTDIR/docs/" && "$zippath" -r /tmp/$version-doc.zip . && cd -
4026
checkerror $? "Failed to pack"
4127

4228
# Inform success
43-
rm -rf "../DocGen/api"
29+
rm -rf "$ROOTDIR/DocGen/api"
4430
checkerror $? "Failed to remove api folder"
45-
rm -rf "../DocGen/obj"
31+
rm -rf "$ROOTDIR/DocGen/obj"
4632
checkerror $? "Failed to remove obj folder"
47-
rm -rf "../docs"
33+
rm -rf "$ROOTDIR/docs"
4834
checkerror $? "Failed to remove docs folder"
49-
mv /tmp/$ksversion-doc.zip .
35+
mv /tmp/$version-doc.zip "$ROOTDIR/tools"
5036
checkerror $? "Failed to move archive from temporary folder"
5137
echo Pack successful.
5238
exit 0

0 commit comments

Comments
 (0)