Skip to content

Commit b69d247

Browse files
committed
Add new Build_old workflow for legacy support across multiple OS environments
1 parent c8c653a commit b69d247

2 files changed

Lines changed: 187 additions & 0 deletions

File tree

.github/workflows/Build_old.yml

Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
name: Build Solution
2+
3+
on:
4+
workflow_call:
5+
jobs:
6+
Build:
7+
name: ${{ matrix.os }}
8+
runs-on: ${{ matrix.os }}
9+
strategy:
10+
matrix:
11+
os: [ubuntu-latest, windows-latest, macos-latest]
12+
env:
13+
BUILD_CONFIGURATION: Release
14+
15+
steps:
16+
# ------------------------------------------------------------------------------------------------------
17+
# Createin version Tag & Number variables - only for CD Job
18+
# ------------------------------------------------------------------------------------------------------
19+
- name: Create Version Environment Variable - Windows
20+
if: ${{github.workflow == 'CD' && runner.os == 'Windows'}}
21+
id: set_version_windows
22+
run: |
23+
if ($env:GITHUB_EVENT_INPUTS_REVISION -ne 0) {
24+
Write-Output "Alpha Version"
25+
Write-Output "gingernumber=${{ github.event.inputs.major}}.${{ github.event.inputs.minor}}.${{ github.event.inputs.build}}.${{ github.event.inputs.revision}}" >> $env:GITHUB_ENV
26+
} elseif ($env:GITHUB_EVENT_INPUTS_BUILD -ne 0 -and $env:GITHUB_EVENT_INPUTS_REVISION -eq 0) {
27+
Write-Output "Beta Version"
28+
Write-Output "gingernumber=${{ github.event.inputs.major}}.${{ github.event.inputs.minor}}.${{ github.event.inputs.build}}.${{ github.event.inputs.revision}}" >> $env:GITHUB_ENV
29+
} elseif ($env:GITHUB_EVENT_INPUTS_BUILD -eq 0 -and $env:GITHUB_EVENT_INPUTS_REVISION -eq 0) {
30+
Write-Output "Official Version"
31+
Write-Output "gingernumber=${{ github.event.inputs.major}}.${{ github.event.inputs.minor}}.${{ github.event.inputs.build}}.${{ github.event.inputs.revision}}" >> $env:GITHUB_ENV
32+
}
33+
34+
- name: Create Version Environment Variable - Linux and macOS
35+
if: ${{github.workflow == 'CD' && (runner.os == 'Linux' || runner.os == 'macOS')}}
36+
id: set_version_unix
37+
run: |
38+
if [[ ${{github.event.inputs.revision}} != 0 ]]; then
39+
echo "Alpha Version"
40+
echo "gingernumber=${{ github.event.inputs.major}}.${{ github.event.inputs.minor}}.${{ github.event.inputs.build}}.${{ github.event.inputs.revision}}" >> $GITHUB_ENV
41+
elif [[ ${{github.event.inputs.build}} != 0 && ${{github.event.inputs.revision}} == 0 ]]; then
42+
echo "Beta Version"
43+
echo "gingernumber=${{ github.event.inputs.major}}.${{ github.event.inputs.minor}}.${{ github.event.inputs.build}}.${{ github.event.inputs.revision}}" >> $GITHUB_ENV
44+
elif [[ ${{github.event.inputs.build}} == 0 && ${{github.event.inputs.revision}} == 0 ]]; then
45+
echo "Official Version"
46+
echo "gingernumber=${{ github.event.inputs.major}}.${{ github.event.inputs.minor}}.${{ github.event.inputs.build}}.${{ github.event.inputs.revision}}" >> $GITHUB_ENV
47+
fi
48+
49+
- name: Print Version Environment Variable
50+
if: ${{github.workflow == 'CD'}}
51+
run: |
52+
echo "GingerNumber Version: ${{ env.gingernumber}}"
53+
54+
55+
# ------------------------------------------------------------------------------------------------------
56+
# Copy Ginger repo
57+
# ------------------------------------------------------------------------------------------------------
58+
- uses: actions/checkout@v3
59+
60+
# ------------------------------------------------------------------------------------------------------
61+
# Update Ginger Version
62+
# ------------------------------------------------------------------------------------------------------
63+
- name: 'Update Assembly - Windows'
64+
if: ${{github.workflow == 'CD' && runner.os == 'Windows'}}
65+
run: |
66+
$save=((Get-Content .\Ginger\GingerCoreCommon/GingerCoreCommon.csproj) -replace '<AssemblyVersion>*.*.*.*</AssemblyVersion>','<AssemblyVersion>${{ env.gingernumber}}</AssemblyVersion>') -replace '<FileVersion>*.*.*.*</FileVersion>','<FileVersion>${{ env.gingernumber}}</FileVersion>'
67+
echo $save > .\Ginger\GingerCoreCommon/GingerCoreCommon.csproj
68+
$save=(Get-Content .\Ginger\GingerInstallerScript.iss) -replace '#define MyAppVersion "*.*.*.*"','#define MyAppVersion "${{ env.gingernumber}}"'
69+
echo $save > .\Ginger\GingerInstallerScript.iss
70+
$save=(Get-Content .\Ginger\GingerCore\Drivers\JavaDriverLib\GingerJavaAgent\agent\com\amdocs\ginger\GingerAgent.java) -replace 'public static final String GINGER_JAVA_AGENT_VERSION="*.*.*.*";','public static final String GINGER_JAVA_AGENT_VERSION="${{ env.gingernumber}}";'
71+
echo $save > .\Ginger\GingerCore\Drivers\JavaDriverLib\GingerJavaAgent\agent\com\amdocs\ginger\GingerAgent.java
72+
$save=(Get-Content .\Ginger\GingerInstallerScriptGithub.iss) -replace '#define MyAppVersion "*.*.*.*"','#define MyAppVersion "${{ env.gingernumber}}"'
73+
echo $save > .\Ginger\GingerInstallerScriptGithub.iss
74+
75+
- name: 'Update Assembly - Linux'
76+
if: ${{github.workflow == 'CD' && runner.os == 'Linux'}}
77+
run: |
78+
sed -i 's/<AssemblyVersion>.*<\/AssemblyVersion>/<AssemblyVersion>${{ env.gingernumber}}<\/AssemblyVersion>/' ./Ginger/GingerCoreCommon/GingerCoreCommon.csproj
79+
sed -i 's/<FileVersion>.*<\/FileVersion>/<FileVersion>${{ env.gingernumber}}<\/FileVersion>/' ./Ginger/GingerCoreCommon/GingerCoreCommon.csproj
80+
sed -i 's/#define MyAppVersion ".*"/#define MyAppVersion "${{ env.gingernumber}}"/' ./Ginger/GingerInstallerScript.iss
81+
sed -i 's/public static final String GINGER_JAVA_AGENT_VERSION=".*";/public static final String GINGER_JAVA_AGENT_VERSION="${{ env.gingernumber}}";/' ./Ginger/GingerCore/Drivers/JavaDriverLib/GingerJavaAgent/agent/com/amdocs/ginger/GingerAgent.java
82+
sed -i 's/#define MyAppVersion ".*"/#define MyAppVersion "${{ env.gingernumber}}"/' ./Ginger/GingerInstallerScriptGithub.iss
83+
84+
- name: 'Update Assembly - macOS'
85+
if: ${{github.workflow == 'CD' && runner.os == 'macOS'}}
86+
run: |
87+
sed -i '' 's/<AssemblyVersion>.*<\/AssemblyVersion>/<AssemblyVersion>${{ env.gingernumber}}<\/AssemblyVersion>/' ./Ginger/GingerCoreCommon/GingerCoreCommon.csproj
88+
sed -i '' 's/<FileVersion>.*<\/FileVersion>/<FileVersion>${{ env.gingernumber}}<\/FileVersion>/' ./Ginger/GingerCoreCommon/GingerCoreCommon.csproj
89+
sed -i '' 's/#define MyAppVersion ".*"/#define MyAppVersion "${{ env.gingernumber}}"/' ./Ginger/GingerInstallerScript.iss
90+
sed -i '' 's/public static final String GINGER_JAVA_AGENT_VERSION=".*";/public static final String GINGER_JAVA_AGENT_VERSION="${{ env.gingernumber}}";/' ./Ginger/GingerCore/Drivers/JavaDriverLib/GingerJavaAgent/agent/com/amdocs/ginger/GingerAgent.java
91+
sed -i '' 's/#define MyAppVersion ".*"/#define MyAppVersion "${{ env.gingernumber}}"/' ./Ginger/GingerInstallerScriptGithub.iss
92+
93+
- name: 'Print OS type'
94+
run: |
95+
echo "Running on ${{ runner.os }}"
96+
97+
# ------------------------------------------------------------------------------------------------------
98+
# Install .Net core SDK 8.0.100
99+
# ------------------------------------------------------------------------------------------------------
100+
- name: 'Install .NET 8'
101+
uses: actions/setup-dotnet@v3
102+
with:
103+
dotnet-version: 8.0.100
104+
# ------------------------------------------------------------------------------------------------------
105+
# Install Mono - for Ubuntu as pre-requisite for building Ginger
106+
# ------------------------------------------------------------------------------------------------------
107+
- name: 'Install Mono'
108+
if: runner.os == 'Linux'
109+
run: |
110+
sudo apt-get update
111+
sudo apt-get install -y mono-complete
112+
113+
# ------------------------------------------------------------------------------------------------------
114+
# Install Nuget tool v1.0.5
115+
# ------------------------------------------------------------------------------------------------------
116+
- name: 'Setup Nuget'
117+
uses: Nuget/setup-nuget@v1.0.5
118+
119+
# ------------------------------------------------------------------------------------------------------
120+
# Restore Ginger solution NuGet packages
121+
# ------------------------------------------------------------------------------------------------------
122+
- name: 'Restore nuget packages'
123+
run: nuget restore ./Ginger/Ginger.sln
124+
125+
# ------------------------------------------------------------------------------------------------------
126+
# Build && Publish Ginger Solution
127+
# ------------------------------------------------------------------------------------------------------
128+
- name: 'Add msbuild to PATH'
129+
if: runner.os == 'Windows'
130+
uses: microsoft/setup-msbuild@v1.0.2
131+
132+
- name: 'Build Ginger Windows Solution'
133+
if: runner.os == 'Windows'
134+
run: msbuild ./Ginger/Ginger.sln /p:DebugSymbols=true /p:DebugType=full /p:Configuration=$env:BUILD_CONFIGURATION
135+
136+
- name: 'Publish GingerRuntime - Linux'
137+
if: runner.os == 'Linux'
138+
run: dotnet publish ./Ginger/GingerRuntime/GingerRuntime.csproj --runtime linux-x64 --self-contained true -c Release
139+
140+
- name: 'Publish GingerRuntime - macOS'
141+
if: runner.os == 'macOS'
142+
run: dotnet publish ./Ginger/GingerRuntime/GingerRuntime.csproj --runtime osx-x64 --self-contained true -c Release
143+
# ------------------------------------------------------------------------------------------------------
144+
# Upload Artifacts
145+
# ------------------------------------------------------------------------------------------------------
146+
- name: Cache static site content - Windows
147+
id: cache_windows
148+
if: runner.os == 'Windows'
149+
uses: actions/cache@v4
150+
with:
151+
path:
152+
./**
153+
key:
154+
cache-site-windows2-${{github.run_number}}
155+
enableCrossOsArchive:
156+
true
157+
158+
- name: Cache static site content - Linux
159+
id: cache_linux
160+
if: runner.os == 'Linux'
161+
uses: actions/cache@v4
162+
with:
163+
path:
164+
./**
165+
key:
166+
cache-site-linux2-${{ github.run_number }}
167+
enableCrossOsArchive:
168+
true
169+
170+
171+
- name: Cache static site content - macOS
172+
id: cache_macos
173+
if: runner.os == 'macOS'
174+
uses: actions/cache@v4
175+
with:
176+
path:
177+
./**
178+
key:
179+
cache-site-macos2-${{ github.run_number }}
180+
enableCrossOsArchive:
181+
true
182+

.github/workflows/CD.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ jobs:
3838
uses: ./.github/workflows/Build.yml
3939
secrets: inherit
4040

41+
Builder_old:
42+
name: Build_old
43+
uses: ./.github/workflows/Build_old.yml
44+
secrets: inherit
45+
4146
# Ginger_Unit-Test:
4247
# name: Execute Unit Tests
4348
# needs: Builder

0 commit comments

Comments
 (0)