Skip to content

Commit 7e726f7

Browse files
committed
# Resolved Conflicts: # README.md
2 parents 0158caa + c0b16b7 commit 7e726f7

29 files changed

Lines changed: 1892 additions & 43 deletions

.github/workflows/build.yml

Lines changed: 205 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,205 @@
1+
name: Build and Test MainRepo1
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- main
8+
pull_request:
9+
branches:
10+
- master
11+
- main
12+
workflow_dispatch: # Allows manual triggering
13+
14+
env:
15+
# Main repository directory:
16+
# Placeholder: ${{ env.REPO_DIR }}
17+
REPO_DIR: iglib
18+
# Main source project directory:
19+
# Placeholder: ${{ env.SOURCE_DIR }}
20+
SOURCE_DIR: iglib/igbase/
21+
# Solution to be built:
22+
# Placeholder: ${{ env.SOLUTION }}
23+
SOLUTION: iglib/IGLibBase.sln
24+
# Whether failed tests are ignored (should normally be false):
25+
# Placeholder: ${{ env.IGNORE_TEST_ERRORS }}
26+
IGNORE_TEST_ERRORS: false
27+
28+
jobs:
29+
30+
build-and-test:
31+
runs-on: windows-latest # use Windows for .NET Framework support
32+
# runs-on: ubuntu-latest # runs on GitHub-hosted Ubuntu
33+
strategy:
34+
matrix:
35+
dotnet-version: [ '10.0' ]
36+
37+
steps:
38+
39+
# CHECKOUT Main Repository
40+
- name: Clone Main Repository
41+
uses: actions/checkout@v4
42+
with:
43+
repository: ajgorhoe/IGLib.workspace.base.${{ env.REPO_DIR }}
44+
path: ${{ env.REPO_DIR }}
45+
ref: master
46+
# Important: set fetch-depth 0 to avoid shallow clones (needed
47+
# for GitVersion):
48+
fetch-depth: 0
49+
# Temporary token created automatically for the main repo (owner of the workflow)
50+
token: ${{ secrets.GITHUB_TOKEN }}
51+
52+
# CONFIGURE GIT to use access token for owned repos
53+
- name: CONFIGURE GIT credentials for private repos
54+
shell: pwsh
55+
run: |
56+
# # Option 1 - via configuration file
57+
# # Because Git may have different idea of the location of home
58+
# # directory (and of config. file .git-credentials) than PowerShell,
59+
# # we explicitly define where the location of config. is.
60+
# if ($IsWindows) {
61+
# $credPath = "$env:USERPROFILE\.git-credentials"
62+
# } else {
63+
# $credPath = "$HOME/.git-credentials"
64+
# }
65+
# git config --global credential.helper "store --file=$credPath"
66+
# " https://x-access-token:${{ secrets.PAT_ACTIONS_IGLIB_READONLY }}@github.com" | Out-File -FilePath $credPath -Encoding ascii
67+
# git config --global credential.useHttpPath true
68+
# # Option 2 - Inject credentials directly into Git’s configuration for the current session:
69+
git config --global url."https://x-access-token:${{ secrets.PAT_ACTIONS_IGLIB_READONLY }}@github.com/".insteadOf "https://github.com/"
70+
71+
# CLONE DEPENDENCY repositories:
72+
- name: CLONE DEPENDENCY repos
73+
shell: pwsh
74+
continue-on-error: false
75+
# Important: set --depth 0 to avoid shallow clones (needed
76+
# for GitVersion)
77+
# TODO: Update scripts should later be moved from 00_initmodules/ to scripts/
78+
run: |
79+
echo "Cloning dependencies via repo's own script (UpdateRepoGroup_IGLibDpendenciesBasic.ps1)`n`n..."
80+
./${{ env.REPO_DIR }}/00_initmodules/UpdateRepoGroup_IGLibDpendenciesBasic.ps1
81+
82+
- name: CHECK DIRECTORY STRUCTURE
83+
shell: pwsh
84+
continue-on-error: true
85+
run: |
86+
Write-Host "`nChecking directory structure...`n"
87+
Write-Host "Current directory: $(Get-Location)`n"
88+
Write-Host "Directory Contents ('./', depth 2):`n"
89+
${{ env.REPO_DIR }}/scripts/ShowDirectoryTree.ps1 -Path "./" -MaxDepth 2 -IncludeHidden
90+
91+
- name: CHECK DIRECTORY STRUCTURE, 3 levels
92+
shell: pwsh
93+
continue-on-error: true
94+
run: |
95+
Write-Host "`nChecking directory structure...`n"
96+
Write-Host "Current directory: $(Get-Location)`n"
97+
Write-Host "Directory Contents ('./', depth 3):`n"
98+
${{ env.REPO_DIR }}/scripts/ShowDirectoryTree.ps1 -Path "./" -MaxDepth 3 -IncludeHidden
99+
100+
- name: CHECK DIRECTORY STRUCTURE, SELECTED DETAILS
101+
shell: pwsh
102+
continue-on-error: true
103+
run: |
104+
Write-Host "`n`nChecking directory structure - details...`n"
105+
Write-Host "`n`n`nCurrent directory: $(Get-Location)`n"
106+
Write-Host "`nListing './`${{ env.REPO_DIR }}', depth 2 (main repo dir in some detail):`n"
107+
${{ env.REPO_DIR }}/scripts/ShowDirectoryTree.ps1 -Path "./${{ env.REPO_DIR }}" -MaxDepth 2 -IncludeHidden
108+
# Write-Host "`n`n`nCurrent directory: $(Get-Location)`n"
109+
# Write-Host "`nListing './`${{ env.SOURCE_DIR }}', depth 3 (main project in more detail):`n"
110+
# ${{ env.REPO_DIR }}/scripts/ShowDirectoryTree.ps1 -Path "./${{ env.SOURCE_DIR }}" -MaxDepth 3 -IncludeHidden
111+
# Write-Host "`n`nCurrent directory: $(Get-Location)`n"
112+
# Write-Host "`nListing './_external', depth 2 (external dependencies in some detail):`n"
113+
# ${{ env.REPO_DIR }}/scripts/ShowDirectoryTree.ps1 -Path "./_external" -MaxDepth 2 -IncludeHidden
114+
115+
- name: SET UP .NET SDK
116+
uses: actions/setup-dotnet@v4
117+
with:
118+
dotnet-version: ${{ matrix.dotnet-version }}
119+
120+
# INSTALL global DOTNET TOOLS
121+
- name: INSTALL global DOTNET TOOLS (GitVersion)
122+
run: |
123+
dotnet tool install --global GitVersion.Tool
124+
125+
- name: Setup MSBuild for .NET Framework
126+
uses: microsoft/setup-msbuild@v1 # Needed for .NET Framework builds
127+
128+
# RUN PRE-BUILD SCRIPT (PowerShell)
129+
- name: Run Pre-Build PowerShell Script
130+
run: pwsh -File ${{ env.REPO_DIR }}/scripts/PrintEnv.ps1
131+
132+
# Verify .NET SDK version and global tools to insure everything we need is installed:
133+
- name: VERIFY .NET SDK and global tools
134+
shell: pwsh
135+
run: |
136+
Write-Host "Checking .NET SDK version..."
137+
dotnet --version
138+
Write-Host "Listing global dotnet tools..."
139+
dotnet tool list --global
140+
141+
# Verify that GitVersion works properly & printing the calculated version of the current commit:
142+
# Remark: malfunctioning of GitVersion (likely due to misconfiguration) is often a cause for
143+
# subsequent build to fail.
144+
- name: CHECK GitVersion
145+
shell: pwsh
146+
run: |
147+
Write-Host "Verifying GitVersion and printing version of the current commit..."
148+
cd ${{ env.REPO_DIR }}
149+
Write-Host "Directory for getting the version:`n $($(Get-Location).Path)"
150+
Write-Host "Running: 'dotnet gitversion /showvariable FullSemVer'"
151+
Write-Host "Repository VERSION returned by GitVersion:"
152+
dotnet gitversion /showvariable FullSemVer
153+
154+
# RESTORE DEPENDENCIES
155+
- name: Restore NuGet packages
156+
shell: pwsh
157+
run: |
158+
Write-Host "Restoring NuGet packages for ${{ env.SOLUTION }} ... `n"
159+
dotnet restore ${{ env.SOLUTION }}
160+
161+
# BUILD Main Project & Test Project in Release Mode
162+
- name: Build Solution
163+
shell: pwsh
164+
run: |
165+
Write-Host "Building solution: ${{ env.SOLUTION }} ... `n"
166+
dotnet build ${{ env.SOLUTION }} --configuration Release --no-restore
167+
168+
# RUN TESTS & COLLECT RESULTS
169+
- name: Run Tests
170+
id: teststep
171+
# shell: pwsh
172+
# Remark: we use the solution instead of projects.
173+
shell: pwsh
174+
continue-on-error: true # ToDo: set to false later!
175+
run: |
176+
Write-Host "Running tests for ${{ env.SOLUTION }} ... `n"
177+
dotnet test ${{ env.SOLUTION }} --configuration Release --logger trx --results-directory TestResults
178+
# ${{ env.IGNORE_TEST_ERRORS }}
179+
180+
- name: Upload test results
181+
if: always() # runs even if previous step failed
182+
uses: actions/upload-artifact@v4
183+
with:
184+
# Name of the uploaded artifact (arbitrary):
185+
name: TestResults
186+
# Path (relative to the workspace) of the file(s) or folder(s) to
187+
# upload as artifact:
188+
path: ./TestResults
189+
190+
# Report tests failure
191+
- name: Report tests failure
192+
if: steps.teststep.outcome == 'failure'
193+
run: echo "⚠️ Some tests failed, but the pipeline will continue."
194+
195+
# UPLOAD BUILD OUTPUT (DLLs, EXEs, etc.)
196+
- name: Upload Build Artifacts
197+
uses: actions/upload-artifact@v4
198+
with:
199+
name: BuildArtifacts
200+
path: ${{ env.SOURCE_DIR }}/bin/Release/
201+
202+
# RUN a TEST SCRIPT (PowerShell)
203+
- name: Run Post-Build PowerShell Script
204+
run: pwsh -File ${{ env.REPO_DIR }}/scripts/PrintEnv.ps1
205+

00_initmodules/InitIGLibModules.csproj11

Lines changed: 0 additions & 15 deletions
This file was deleted.

00_initmodules/InitIGLibModules.sln

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio Version 17
4-
VisualStudioVersion = 17.0.31903.59
3+
# Visual Studio Version 18
4+
VisualStudioVersion = 18.0.11116.177 d18.0
55
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InitIGLibModules", "InitIGLibModules/InitIGLibModules.csproj", "{8A0F1413-BF57-4AEE-B96D-F04F91E97BDC}"
6+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "InitIGLibModules", "InitIGLibModules\InitIGLibModules.csproj", "{8A0F1413-BF57-4AEE-B96D-F04F91E97BDC}"
7+
EndProject
8+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InitIGLibModulesBasic", "InitIGLibModulesBasic\InitIGLibModulesBasic.csproj", "{1FB38A61-830F-C806-F22B-44420D8A063B}"
79
EndProject
810
Global
911
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -15,6 +17,10 @@ Global
1517
{8A0F1413-BF57-4AEE-B96D-F04F91E97BDC}.Debug|Any CPU.Build.0 = Debug|Any CPU
1618
{8A0F1413-BF57-4AEE-B96D-F04F91E97BDC}.Release|Any CPU.ActiveCfg = Release|Any CPU
1719
{8A0F1413-BF57-4AEE-B96D-F04F91E97BDC}.Release|Any CPU.Build.0 = Release|Any CPU
20+
{1FB38A61-830F-C806-F22B-44420D8A063B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21+
{1FB38A61-830F-C806-F22B-44420D8A063B}.Debug|Any CPU.Build.0 = Debug|Any CPU
22+
{1FB38A61-830F-C806-F22B-44420D8A063B}.Release|Any CPU.ActiveCfg = Release|Any CPU
23+
{1FB38A61-830F-C806-F22B-44420D8A063B}.Release|Any CPU.Build.0 = Release|Any CPU
1824
EndGlobalSection
1925
GlobalSection(SolutionProperties) = preSolution
2026
HideSolutionNode = FALSE

00_initmodules/InitIGLibModules/InitIGLibModules.csproj

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
to be built, the script is not run. You can force re-running the scritp simply by rebuilding the
1212
project in Visual Studio, via command-line, or by any other means.
1313
-->
14-
<Exec Command="pwsh -ExecutionPolicy Bypass -NoProfile -File &quot;$(ProjectDir)/../UpdateRepoGroup_IGLibDpendencies.ps1&quot;"
15-
ContinueOnError="true" />
14+
<Exec Command="pwsh -ExecutionPolicy Bypass -NoProfile -File &quot;$(ProjectDir)/../UpdateRepoGroup_IGLibDpendencies.ps1&quot;" ContinueOnError="true" />
1615
</Target>
16+
<ItemGroup>
17+
<ProjectReference Include="..\InitIGLibModulesBasic\InitIGLibModulesBasic.csproj" />
18+
</ItemGroup>
1719
</Project>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
using System;
2+
3+
namespace InitIGLibModulesBasic
4+
{
5+
public class Class1Basic
6+
{
7+
8+
}
9+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<TargetFramework>netstandard2.0</TargetFramework>
4+
<OutputType>Library</OutputType>
5+
<RunPostBuildEvent>OnOutputUpdated</RunPostBuildEvent>
6+
</PropertyGroup>
7+
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
8+
<!--
9+
This project runs the script that clones or updates all the dependency repositories.
10+
The script is run in a post-build step. Therefore, if the project is up-to-date and does not need
11+
to be built, the script is not run. You can force re-running the scritp simply by rebuilding the
12+
project in Visual Studio, via command-line, or by any other means.
13+
-->
14+
<Exec Command="pwsh -ExecutionPolicy Bypass -NoProfile -File &quot;$(ProjectDir)/../UpdateRepoGroup_IGLibDpendenciesBasic.ps1&quot;"
15+
ContinueOnError="true" />
16+
</Target>
17+
</Project>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//using System;
2+
3+
//namespace InitIGLibModules Basic
4+
//{
5+
// class Program
6+
// {
7+
// static void MainInitIGLibModules(string[] args)
8+
// {
9+
// //Console.WriteLine(Environment.NewLine + "Presence of this executable testifies that: " + Environment.NewLine
10+
// // + " IGLib modules have been initialized in the build process." + Environment.NewLine);
11+
// }
12+
// }
13+
//}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
2+
# Clones or updates all repositories needed by IGLib.
3+
Write-Host "`n`nCloning / updating all repositories needed by IGLib ...`n"
4+
5+
# Get the script directory such that relative paths can be resolved:
6+
$scriptPath = $MyInvocation.MyCommand.Path
7+
$scriptDir = Split-Path $scriptPath -Parent
8+
$scriptFilename = [System.IO.Path]::GetFileName($scriptPath)
9+
10+
Write-Host "Script directory: $scriptDir"
11+
12+
Write-Host "`nUpdating iglibexternal WITH contained dependencies:"
13+
& $(Join-Path $scriptDir "UpdateRepo_iglibexternaWithIGLibDependenciesBasic.ps1")
14+
15+
Write-Host "`nUpdating IGLibCore:"
16+
& $(Join-Path $scriptDir "UpdateRepo_IGLibCore.ps1")
17+
18+
Write-Host "`nUpdating IGLibScript:"
19+
& $(Join-Path $scriptDir "UpdateRepo_IGLibScripts.ps1")
20+
21+
Write-Host "`nUpdating unittests:"
22+
& $(Join-Path $scriptDir "UpdateRepo_unittests.ps1")
23+
24+
25+
Write-Host " ... updating repositoris needed by IGLib completed.`n`n"
26+

0 commit comments

Comments
 (0)