Skip to content

Commit

Permalink
Add Windows MSVC workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
ddeclerck committed Apr 23, 2024
1 parent 89c45a3 commit e5fc966
Show file tree
Hide file tree
Showing 4 changed files with 175 additions and 13 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
name: MacOS Workflow

on:
pull_request:
branches: [ gcos4gnucobol-3.x ]
push:
branches: [ gcos4gnucobol-3.x ]
# pull_request:
# branches: [ gcos4gnucobol-3.x ]
# push:
# branches: [ gcos4gnucobol-3.x ]
# manual run in actions tab - for all branches
workflow_dispatch:

jobs:
build:
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
name: Ubuntu Workflow

on:
pull_request:
branches: [ gcos4gnucobol-3.x ]
push:
# pull_request:
# branches: [ gcos4gnucobol-3.x ]
# push:
# branches: [ gcos4gnucobol-3.x ]
# manual run in actions tab - for all branches
workflow_dispatch:

Expand Down
159 changes: 159 additions & 0 deletions .github/workflows/windows-msvc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
name: Windows MSVC Workflow

on:
pull_request:
branches: [ gcos4gnucobol-3.x ]
push:
branches: [ gcos4gnucobol-3.x, ci_msvc2 ]
# manual run in actions tab - for all branches
workflow_dispatch:

env:
FLEXBISON: https://github.com/lexxmark/winflexbison/releases/download/v2.5.25/win_flex_bison-2.5.25.zip
MSBUILD: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\MSBuild.exe
VCVARS: C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat
VCPKG_ROOT: C:\vcpkg
VCPKGS: mpir:x64-windows pdcurses:x64-windows berkeleydb:x64-windows libxml2:x64-windows cjson:x64-windows
MSYS2_ROOT: C:\msys64
MSYSPKGS: autoconf

jobs:
build:
strategy:
fail-fast: false
matrix:
os:
- windows-latest

runs-on: ${{ matrix.os }}

steps:

- name: Set git user
run: |
git config --global user.name github-actions
git config --global user.email [email protected]
- name: Checkout code
uses: actions/checkout@v3

- name: Setup environment
shell: cmd
run: echo GITHUB_WORKSPACE=%GITHUB_WORKSPACE%>> %GITHUB_ENV%

- name: Restore VCPKG package cache
id: restore-vcpkg
uses: actions/cache/restore@v3
with:
key: cache-vcpkg
path: |
${{ env.VCPKG_ROOT }}/installed
${{ env.VCPKG_ROOT }}/packages
- name: Install VCPKG packages
if: steps.restore-vcpkg.outputs.cache-hit != 'true'
run: |
cd $env:VCPKG_ROOT
git pull
.\bootstrap-vcpkg.bat -disableMetrics
vcpkg integrate install
vcpkg install (-split $env:VCPKGS)
vcpkg update
vcpkg upgrade (-split $env:VCPKGS) --no-dry-run
- name: Save VCPKG package cache
if: steps.restore-vcpkg.outputs.cache-hit != 'true'
uses: actions/cache/save@v3
with:
key: cache-vcpkg
path: |
${{ env.VCPKG_ROOT }}/installed
${{ env.VCPKG_ROOT }}/packages
- name: Restore WinFlexBison cache
uses: actions/cache/restore@v3
id: restore-flexbison
with:
key: cache-flexbison
path: ${{ env.GITHUB_WORKSPACE }}\flexbison

- name: Install WinFlexBison
if: steps.restore-flexbison.outputs.cache-hit != 'true'
run: |
Invoke-WebRequest -Uri $env:FLEXBISON -OutFile flexbison.zip
Expand-Archive flexbison.zip -DestinationPath flexbison
- name: Save WinFlexBison cache
if: steps.restore-flexbison.outputs.cache-hit != 'true'
uses: actions/cache/save@v3
with:
key: cache-flexbison
path: ${{ env.GITHUB_WORKSPACE }}/flexbison

- name: Configure GnuCOBOL
run: |
cd build_windows
Get-Content -Path 'config.h.in' | ForEach-Object { $_ `
-replace '(#define\s+CONFIGURED_ISAM)\s.+$', '$1 BDB' `
-replace '(#define\s+CONFIGURED_CURSES)\s.+$', '$1 PDCURSES' `
-replace '(#define\s+CONFIGURED_XML)\s.+$', '$1 XML2' `
-replace '(#define\s+CONFIGURED_JSON)\s.+$', '$1 CJSON_CJSON' `
} | Set-Content -Path 'config.h'
& .\maketarstamp.ps1 > tarstamp.h
- name: Generate parser
shell: cmd
run: |
set PATH=%cd%\flexbison;%PATH%
cd build_windows
cmd /C makebisonflex.cmd
- name: Build GnuCOBOL
run: |
cd build_windows
vcpkg integrate install
& $env:MSBUILD "vs2019\GnuCOBOL.sln" /m /p:Platform=x64 /p:Configuration=Release
- name: Install MSYS2 packages
shell: cmd
run: |
set PATH=%MSYS2_ROOT%\usr\bin;%PATH%
pacman --needed --noconfirm -S %MSYSPKGS%
echo PATH=%PATH%>> %GITHUB_ENV%
- name: Building testsuite
shell: cmd
run: |
cd tests
echo at_testdir='tests' > atconfig
echo abs_builddir='%cd%' >> atconfig
echo at_srcdir='.' >> atconfig
echo abs_srcdir='%cd%' >> atconfig
echo at_top_srcdir='..' >> atconfig
echo abs_top_srcdir='%cd%\..' >> atconfig
echo at_top_build_prefix='../' >> atconfig
echo abs_top_builddir='%cd%\..' >> atconfig
echo at_top_builddir=$at_top_build_prefix >> atconfig
echo EXEEXT='.exe' >> atconfig
echo AUTOTEST_PATH='tests' >> atconfig
echo SHELL=${CONFIG_SHELL-'/bin/sh'} >> atconfig
echo m4_define([AT_PACKAGE_STRING], [GnuCOBOL 3.2]) > package.m4
echo m4_define([AT_PACKAGE_BUGREPORT], [[email protected]]) >> package.m4
bash -c "sed 's/x64\/Debug/x64\/Release/g' atlocal_win > atlocal"
bash -c "autom4te --lang=autotest -I ./testsuite.src ./testsuite.at -o ./testsuite"
- name: Running testsuite
shell: cmd
run: |
set COB_CFLAGS=/I "%cd%" /I "%VCPKG_ROOT%\installed\x64-windows\include"
set COB_LIBS=libcob.lib /LIBPATH:"%cd%\build_windows\x64\Release" /FORCE:MULTIPLE
call "%VCVARS%"
cd tests
bash -c "./testsuite"
- name: Upload testsuite.log
uses: actions/upload-artifact@v3
if: failure()
with:
name: testsuite.log
path: ${{ env.GITHUB_WORKSPACE }}/tests/testsuite.log
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: Windows Workflow
name: Windows MSYS2 Workflow

on:
pull_request:
branches: [ gcos4gnucobol-3.x ]
push:
branches: [ gcos4gnucobol-3.x ]
# pull_request:
# branches: [ gcos4gnucobol-3.x ]
# push:
# branches: [ gcos4gnucobol-3.x ]
# manual run in actions tab - for all branches
# workflow_dispatch:
workflow_dispatch:

jobs:
build:
Expand Down

0 comments on commit e5fc966

Please sign in to comment.