Skip to content

CI for forward-porting GC3 patches to GC4 #108

CI for forward-porting GC3 patches to GC4

CI for forward-porting GC3 patches to GC4 #108

name: Windows MSYS1 BDB (build only)
on:
pull_request:
branches: [ gc4 ]
push:
branches: [ gc3_to_gc4 ]
# manual run in actions tab - for all branches
workflow_dispatch:
env:
MSYS_ROOT: C:\MinGW
BASH: C:\MinGW\msys\1.0\bin\bash
BISON_PKGDATADIR: C:\MinGW\share\bison
MSYSTEM: MINGW32
MSYSPKGS: msys-m4 msys-flex msys-coreutils msys-help2man
M4: m4
MINGW_BISON_VERS: bison-3.0.1
MINGW_GMP_VERS: gmp-6.3.0
MINGW_BDB_VERS: db-6.0.19.NC
MINGW_PDCM_VERS: 4.4.0
MINGW_CJSON_VERS: 1.7.18
jobs:
build:
strategy:
fail-fast: false
matrix:
os:
- windows-latest
target:
- debug
- release
runs-on: ${{ matrix.os }}
defaults:
run:
shell: cmd
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@v4
- name: Setup environment
shell: pwsh
run: |
echo GITHUB_WORKSPACE=$env:GITHUB_WORKSPACE >> $env:GITHUB_ENV
echo GHWS=$env:GITHUB_WORKSPACE >> $env:GITHUB_ENV
If ("${{ matrix.target }}" -eq "release") {
echo DISTDIR=GnuCOBOL_mingw >> $env:GITHUB_ENV
echo CFGOPT="" >> $env:GITHUB_ENV
} Else {
echo DISTDIR=GnuCOBOL_mingw_dbg >> $env:GITHUB_ENV
echo CFGOPT="--enable-debug --enable-cobc-internal-checks --enable-hardening" >> $env:GITHUB_ENV
}
- name: Restore MSYS env
id: restore-msys
uses: actions/cache/restore@v4
with:
key: cache-msys-${{ matrix.target }}
path: |
${{ env.MSYS_ROOT }}
- name: Install MSYS1
if: steps.restore-msys.outputs.cache-hit != 'true'
run: |
curl -O https://www.arnoldtrembley.com/MinGW-bkup02.7z
7z x MinGW-bkup02.7z -o%MSYS_ROOT%\
- name: Install MSYS1 packages
if: steps.restore-msys.outputs.cache-hit != 'true'
run: |
%BASH% -lc "mingw-get install %MSYSPKGS%"
- name: Install Bison 3.0
if: steps.restore-msys.outputs.cache-hit != 'true'
run: |
curl -L "https://mirror.ibcp.fr/pub/gnu/bison/%MINGW_BISON_VERS%.tar.xz" -o "%MINGW_BISON_VERS%.tar.xz"
%BASH% -lc "cd \"%GHWS%\" && tar -xvf %MINGW_BISON_VERS%.tar.xz"
%BASH% -lc "cd \"%GHWS%/%MINGW_BISON_VERS%\" && ./configure --prefix=/mingw && make"
%BASH% -lc "cd \"%GHWS%/%MINGW_BISON_VERS%\" && make install"
# - name: Install GMP
# if: steps.restore-msys.outputs.cache-hit != 'true'
# run: |
# curl -L "https://gmplib.org/download/gmp/%MINGW_GMP_VERS%.tar.xz" -o "%MINGW_GMP_VERS%.tar.xz"
# %BASH% -lc "cd \"%GHWS%\" && tar -xvf %MINGW_GMP_VERS%.tar.xz"
# %BASH% -lc "cd \"%GHWS%/%MINGW_GMP_VERS%\" && ./configure --prefix=/mingw --enable-fat --enable-shared --disable-static CFLAGS=\"-Wno-attributes -Wno-ignored-attributes\" ABI=32 && make"
# %BASH% -lc "cd \"%GHWS%/%MINGW_GMP_VERS%\" && make install"
- name: Install BDB
if: steps.restore-msys.outputs.cache-hit != 'true'
run: |
curl -L "https://download.oracle.com/berkeley-db/%MINGW_BDB_VERS%.tar.gz" -o "%MINGW_BDB_VERS%.tar.gz"
%BASH% -lc "cd \"%GHWS%\" && tar -xvf %MINGW_BDB_VERS%.tar.gz && sed -i 's/_tcsclen/strlen/' %MINGW_BDB_VERS%/src/os_windows/os_stat.c"
%BASH% -lc "cd \"%GHWS%/%MINGW_BDB_VERS%/build_unix\" && ../dist/configure --prefix=/mingw --enable-mingw --enable-debug --disable-static --disable-replication --disable-tcl LIBCSO_LIBS=-lwsock32 && make || make"
%BASH% -lc "cd \"%GHWS%/%MINGW_BDB_VERS%/build_unix\" && make install"
- name: Install PDCurses
if: steps.restore-msys.outputs.cache-hit != 'true'
run: |
curl -L "https://github.com/Bill-Gray/PDCursesMod/archive/refs/tags/v%MINGW_PDCM_VERS%.tar.gz" -o "PDCursesMod-%MINGW_PDCM_VERS%.tar.xz"
%BASH% -lc "cd \"%GHWS%\" && tar -xvf PDCursesMod-%MINGW_PDCM_VERS%.tar.xz"
%BASH% -lc "cd \"%GHWS%/PDCursesMod-%MINGW_PDCM_VERS%\wincon\" && make INFOEX=N CHTYPE_64=Y DEBUG=Y DLL=Y DLLNAME=libpdcurses LIBNAME=libpdcurses.dll"
%BASH% -lc "cd \"%GHWS%/PDCursesMod-%MINGW_PDCM_VERS%\wingui\" && make CHTYPE_64=Y DEBUG=Y DLL=Y DLLNAME=libpdcurses LIBNAME=libpdcurses.dll"
%BASH% -lc "cd \"%GHWS%/PDCursesMod-%MINGW_PDCM_VERS%\vt\" && make CHTYPE_64=Y DEBUG=Y DLL=Y DLLNAME=libpdcurses LIBNAME=libpdcurses.dll CFLAGS=\"-Wall -Wextra -pedantic -g -DPDCDEBUG -fPIC -DPDC_DLL_BUILD\""
echo #define CHTYPE_64 > "PDCursesMod-%MINGW_PDCM_VERS%\pdcurses.h" && echo #define PDC_DLL_BUILD >> "PDCursesMod-%MINGW_PDCM_VERS%\pdcurses.h" && echo #include "pdcurses/curses.h" >> "PDCursesMod-%MINGW_PDCM_VERS%\pdcurses.h"
%BASH% -lc "cd \"%GHWS%/PDCursesMod-%MINGW_PDCM_VERS%\" && install wincon/libpdcurses.dll.a /mingw/lib/"
%BASH% -lc "cd \"%GHWS%/PDCursesMod-%MINGW_PDCM_VERS%\" && install wincon/libpdcurses.dll /mingw/bin/"
%BASH% -lc "cd \"%GHWS%/PDCursesMod-%MINGW_PDCM_VERS%\" && install wincon/libpdcurses.dll /mingw/bin/libpdcurses-wincon.dll"
%BASH% -lc "cd \"%GHWS%/PDCursesMod-%MINGW_PDCM_VERS%\" && install wingui/libpdcurses.dll /mingw/bin/libpdcurses-wingui.dll"
%BASH% -lc "cd \"%GHWS%/PDCursesMod-%MINGW_PDCM_VERS%\" && install vt/libpdcurses.dll /mingw/bin/libpdcurses-vt.dll"
%BASH% -lc "install -d /mingw/include/pdcurses"
%BASH% -lc "cd \"%GHWS%/PDCursesMod-%MINGW_PDCM_VERS%\" && install -m 0644 curses.h panel.h term.h /mingw/include/pdcurses/"
%BASH% -lc "cd \"%GHWS%/PDCursesMod-%MINGW_PDCM_VERS%\" && install -m 0644 pdcurses.h /mingw/include/"
- name: Cleanup MSYS1 env
if: steps.restore-msys.outputs.cache-hit != 'true'
run: |
rmdir /Q /S %MSYS_ROOT%\docs
rmdir /Q /S %MSYS_ROOT%\var
del /Q %MSYS_ROOT%\bin\gdb.exe
- name: Save MSYS env
if: steps.restore-msys.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
key: cache-msys-${{ matrix.target }}
path: |
${{ env.MSYS_ROOT }}
- name: Download CJSON sources
run: |
curl -L "https://github.com/DaveGamble/cJSON/archive/refs/tags/v%MINGW_CJSON_VERS%.tar.gz" -o "cjson-%MINGW_CJSON_VERS%.tar.xz"
%BASH% -lc "cd \"%GHWS%\" && tar -xvf cjson-%MINGW_CJSON_VERS%.tar.xz"
%BASH% -lc "cd \"%GHWS%\" && cp cjson-%MINGW_CJSON_VERS%/cJSON.[ch] ./libcob/"
- name: Bootstrap GnuCOBOL
run: |
%BASH% -lc "cd \"%GHWS%\" && sed -i 's/AM_PROG_AR/m4_ifdef\(\[AM_PROG_AR\], \[AM_PROG_AR\]\)/g' ./configure.ac"
%BASH% -lc "cd \"%GHWS%\" && sed -i 's/po extras doc tests/po extras tests/g' ./Makefile.am"
%BASH% -lc "cd \"%GHWS%\" && ./autogen.sh"
- name: Configure GnuCOBOL
run: |
%BASH% -lc "cd \"%GHWS%\" && mkdir _build"
%BASH% -lc "cd \"%GHWS%\" && sed -i 'N;s/else/else :;/g' ./configure"
%BASH% -lc "cd \"%GHWS%\" && sed -i 's/\} else \:;/} else/g' ./configure"
%BASH% -lc "cd \"%GHWS%/_build\" && ../configure %CFGOPT% --with-db --with-indexed=db --prefix /opt/cobol/gnucobol"
- name: Upload config-${{ matrix.target }}.log
uses: actions/upload-artifact@v4
if: failure()
with:
name: config-${{ matrix.target }}.log
path: _build/config.log
- name: Build GnuCOBOL
run: |
%BASH% -lc "cd \"%GHWS%/_build\" && CPATH=$(pwd)/.. make --jobs=$(($(nproc)+1))"
- name: Install GnuCOBOL
run: |
%BASH% -lc "cd \"%GHWS%/_build\" && make install"
%BASH% -lc "cd \"%GHWS%/_build\" && find /opt/cobol > install.log"
- name: Upload install-${{ matrix.target }}.log
uses: actions/upload-artifact@v4
with:
name: install-${{ matrix.target }}.log
path: _build/install.log
- name: Run testsuite
continue-on-error: true
run: |
%BASH% -lc "cd \"%GHWS%" && sed -i '/AT_SETUP(\[ACCEPT OMITTED (SCREEN)\])/a AT_SKIP_IF(\[true\])' tests/testsuite.src/run_accept.at"
%BASH% -lc "cd \"%GHWS%/_build/tests\" && CPATH=/opt/cobol/gnucobol/include make check TESTSUITEFLAGS=\"--jobs=$(($(nproc)+1))\""
- name: Upload testsuite-${{ matrix.target }}.log
uses: actions/upload-artifact@v4
with:
name: testsuite-${{ matrix.target }}.log
path: _build/tests/testsuite.log
- name: Package GnuCOBOL
run: |
%BASH% -lc "cd \"%GHWS%/_build\" && make distmingw"
- name: Upload GnuCOBOL_mingw-${{ matrix.target }}
uses: actions/upload-artifact@v4
with:
name: GnuCOBOL_mingw-${{ matrix.target }}
path: _build/${{ env.DISTDIR }}