From 28c84ab5cd17a400f366bb36dbf1f72af2478a1a Mon Sep 17 00:00:00 2001 From: Mark Pizzolato Date: Sat, 3 Dec 2022 16:34:40 -1000 Subject: [PATCH] github: Rework the CI build to build and generate zip in one batch file --- .github/workflows/build.yml | 26 +++++----------- Visual Studio Projects/build_simulators.cmd | 33 +++++++++++++++++++++ build_vstudio.bat | 2 +- 3 files changed, 41 insertions(+), 20 deletions(-) create mode 100644 Visual Studio Projects/build_simulators.cmd diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2342ca7a..3502689d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,12 +15,12 @@ jobs: simulators: # These are supposed to match ALL in makefile. # Each job builds ~15 simulators. - - 3b2 alpha altair altairz80 b5500 besm6 cdc1700 eclipse gri h316 hp2100 hp3000 - - i1401 i1620 i650 i701 i7010 i704 i7070 i7080 i7090 i7094 ibm1130 id16 id32 + - 3b2 3b2-700 alpha altair altairz80 b5500 besm6 cdc1700 eclipse gri h316 hp2100 hp3000 + - i1401 i1620 i650 i701 i7010 i704 i7070 i7080 i7090 i7094 ibm1130 id16 id32 vaxstation4000m60 vaxstation4000vlc - imlac infoserver100 infoserver1000 infoserver150vxt intel-mds lgp microvax1 microvax2 microvax2000 microvax3100 microvax3100e - microvax3100m80 microvax3900 nova pdp1 pdp10 pdp10-ka pdp10-ki pdp10-kl pdp10-ks pdp11 pdp15 pdp4 pdp6 pdp7 - - pdp8 pdp9 pdq3 rtvax1000 s3 sage scelbi sds sel32 sigma ssem swtp6800mp-a swtp6800mp-a2 tt2500 tx-0 - - uc15 vax vax730 vax750 vax780 vax8200 vax8600 vaxstation3100m30 vaxstation3100m38 vaxstation3100m76 vaxstation4000m60 vaxstation4000vlc + - pdp8 pdp9 pdq3 rtvax1000 s3 sage scelbi sds sel32 sigma ssem swtp6800mp-a swtp6800mp-a2 tt2500 tx-0 uc15 + - vax vax730 vax750 vax780 vax8200 vax8600 vaxstation3100m30 vaxstation3100m38 vaxstation3100m76 steps: - uses: actions/checkout@v3 - name: Install dependencies @@ -45,7 +45,7 @@ jobs: steps: - uses: actions/checkout@v3 - name: Install v141_xp (XP toolkit) - shell: pwsh + shell: powershell run: | $packageParams = @( "--productId", "Microsoft.VisualStudio.Product.Enterprise", "--channelId", "VisualStudio.17.Release", @@ -57,22 +57,10 @@ jobs: "--locale en-US" ) -join " " choco install visualstudio2022-workload-nativedesktop --package-parameters $packageParams - - name: vs2022-xp build + - name: vs2022-xp build and save XP runnable binaries in a Zip file shell: cmd - run: build_vstudio.bat + run: "Visual Studio Projects\build_simulators.cmd" - - name: Generate and save Zip XP Runnable binaries - shell: pwsh - run: | - $id_line = Select-String -Path "$pwd\Visual Studio Projects\.git-commit-id.h" -Pattern 'SIM_GIT_COMMIT_ID' - $id_name_pos = $id_line.line.IndexOf("SIM_GIT_COMMIT_ID") - $id = $id_line.Line.SubString($id_name_pos + 18, 8) - $datetime = Get-Date -Format "yyyy-mm-dd_hh-mm-ss" - $zipfile = "simh-4.0-Current--$datetime-$id.zip" - $zippath = "$pwd\NT\$zipfile" - Compress-Archive -Path "$pwd\NT\Win32-Release\*.exe" -DestinationPath "$zippath" - echo "ZIPPATH=$zippath" | Out-File -Append -Encoding ASCII -FilePath $Env:GITHUB_ENV - - uses: actions/upload-artifact@v3 with: name: Save Artifact ${{ env.ZIPPATH }} diff --git a/Visual Studio Projects/build_simulators.cmd b/Visual Studio Projects/build_simulators.cmd new file mode 100644 index 00000000..0b468d67 --- /dev/null +++ b/Visual Studio Projects/build_simulators.cmd @@ -0,0 +1,33 @@ +@echo off +:: Build Release simulators with Visual Studio and save the binaries +:: in a Zip file. +:: +pushd ~p0 +cd .. +# First build all the simulators +call build_vstudio.bat +if errorlevel 1 goto Done +cd "Visual Studio Projects" +# determine the zip file name +for /F "usebackq tokens=2" %%i in (`findstr /C:SIM_GIT_COMMIT_ID .git-commit-id`) do set GIT_COMMIT_ID=%%i +for /F "usebackq tokens=2" %%i in (`findstr /C:SIM_GIT_COMMIT_TIME .git-commit-id`) do set GIT_COMMIT_TIME=%%i +for /F "tokens=1 delims=-T" %%i in ("%GIT_COMMIT_TIME%") do set D_YYYY=%%i +for /F "tokens=2 delims=-T" %%i in ("%GIT_COMMIT_TIME%") do set D_MM=%%i +for /F "tokens=3 delims=-T" %%i in ("%GIT_COMMIT_TIME%") do set D_DD=%%i +set _SIM_MAJOR= +set _SIM_MINOR= +set _SIM_PATCH= +set _SIM_VERSION_MODE= +for /F "usebackq tokens=3" %%i in (`findstr/C:"#define SIM_MAJOR" ..\sim_rev.h`) do set _SIM_MAJOR=%%i +for /F "usebackq tokens=3" %%i in (`findstr/C:"#define SIM_MINOR" ..\sim_rev.h`) do set _SIM_MINOR=%%i +for /F "usebackq tokens=3" %%i in (`findstr/C:"#define SIM_PATCH" ..\sim_rev.h`) do set _SIM_PATCH=-%%i +for /F "usebackq tokens=3" %%i in (`findstr/C:"#define SIM_VERSION_MODE" ..\sim_rev.h`) do set _SIM_VERSION_MODE=-%%~i +if "%_SIM_PATCH%" equ "-0" set _SIM_PATCH= +set _ZipName=simh-%_SIM_MAJOR%.%_SIM_MINOR%%_SIM_PATCH%%_SIM_VERSION_MODE%--%D_YYYY%-%D_MM%-%D_DD%-%GIT_COMMIT_ID:~0,8%.zip +set _ZipPath=BIN\NT\%_ZipName% +echo Creating Zip File: %_ZipPath% +Powershell -NoLogo -Command Compress-Archive -Path "BIN\NT\Win32-Release\*.exe" -DestinationPath "%_ZipPath%" +echo ZIPPATH=%_ZipPath% >> %GITHUM_ENV% + +:Done +popd \ No newline at end of file diff --git a/build_vstudio.bat b/build_vstudio.bat index d36ed0f4..c401676b 100644 --- a/build_vstudio.bat +++ b/build_vstudio.bat @@ -1,4 +1,4 @@ -@echo on +@echo off :: Rebuild all of SIMH simulators using Visual Studio :: :: If this procedure is not invoked from a Developer command prompt