From 78592171ca0cbd6b66c5ce0005c27381ec55b6ed Mon Sep 17 00:00:00 2001 From: Simon Sobisch Date: Sat, 5 Oct 2024 20:36:52 +0000 Subject: [PATCH] ci adjustments * ubuntu: * only run jobs for "coverage" and "additional warnings" if the main ci build works and use its generated tarball in both cases * add two new artifacts: test binaries and windows source * ubuntu+msys1+msys2+macos: * upload config.log after the build - because we may need it to debug build issues * always upload the testsuite.log (additional build documentation) * ubuntu+msys1+msys2: * use --with-pkgversion to mark CI binaries * msys1: * GMP url changes, building it again for performance reasons * building BDB with all relevant patches from MSYS2 * drop GC install log step and therefore extra prefix * using msys-build instead of building Bison (only necessary for GC4) * drop extra CFLAGS previously necessary for local cJSON (fixed in 3.x) * enable NIST85 (+ comment-code in case we ever need to skip something there and/or ignoring failing NIST) --> as after last upstream update everything works * ci cache adjustment: * remove split per matrix * split per software, enabling smaller updates * use CI tarball like for the minimal build, drop flex+bison * drop workflow specific expected failures that now work fine * move env to MSYS job * resolve env vars by build API instead of runner * integrate msys1.yml into ubuntu.yml, renaming to build_nightly.yml * msys2: * split NIST + internal testsuite and run the later with less jobs to prevent hanging * split between "prepare" and "build" job, with the former generating a full distribution inclusive documentation, and the later having less packages installed, allowing to enable i386 again * msys2+macos: * uploading NIST test results * msvc: * testsuite skip adjustments from the generated testsuite * enable building binary package and artifact * export dependencies and artifact temporarily disable (duplicate) PR builds --- .github/workflows/build_nightly.yml | 700 ++++++++++++++++++++++++++++ .github/workflows/macos.yml | 37 +- .github/workflows/ubuntu.yml | 310 ------------ .github/workflows/windows-msvc.yml | 99 ++-- .github/workflows/windows-msys1.yml | 245 ---------- .github/workflows/windows-msys2.yml | 182 +++++--- 6 files changed, 913 insertions(+), 660 deletions(-) create mode 100644 .github/workflows/build_nightly.yml delete mode 100644 .github/workflows/ubuntu.yml delete mode 100644 .github/workflows/windows-msys1.yml diff --git a/.github/workflows/build_nightly.yml b/.github/workflows/build_nightly.yml new file mode 100644 index 000000000..9530077be --- /dev/null +++ b/.github/workflows/build_nightly.yml @@ -0,0 +1,700 @@ +name: Build, Test and provide Nightly (Ubuntu + MSYS1) + +on: + + # pull_request: + # branches: [ gcos4gnucobol-3.x ] + push: + # manual run in actions tab - for all branches + workflow_dispatch: + + +jobs: + + build: + name: Build, test and provide nightly + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + runs-on: ${{ matrix.os }} + + steps: + - name: Install packages + run: | + sudo apt -y update + sudo apt -y install automake libtool libdb5.3-dev libxml2-dev libcjson-dev \ + bison flex help2man gettext texlive + + - name: Set git user + run: | + git config --global user.name github-actions + git config --global user.email github-actions-bot@users.noreply.github.com + + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - name: Checkout code + uses: actions/checkout@v4 + + - name: Bootstrap + run: | + ./build_aux/bootstrap + + # FIXME: With TERM="dumb" `make check` fails with: + # ... + # 571: ACCEPT OMITTED (SCREEN) FAILED (run_accept.at:307) + # ... + # 693: ON EXCEPTION clause of DISPLAY FAILED (run_misc.at:6335) + # 695: LINE/COLUMN 0 exceptions FAILED (run_misc.at:6414) + # 694: EC-SCREEN-LINE-NUMBER and -STARTING-COLUMN FAILED (run_misc.at:6376) + # ... + # Failure cases read: "Error opening terminal: unknown." on + # stderr, and exit with code 1. + # + # Another alternative is passing `--with-curses=no` to the + # configure script, yet distcheck does call configure too... + # + - name: Build environment setup + run: | + mkdir _build + export TERM="vt100" + echo "TERM=$TERM" >> $GITHUB_ENV + + - name: Configure + run: | + cd _build + ../configure --enable-cobc-internal-checks \ + --enable-hardening \ + --prefix /opt/gnucobol3 \ + --with-pkgversion="GnuCOBOL CI" + echo "VERSION=PACKAGE_VERSION" | cpp -P -imacros config.h | tr -d \" \ + >> $GITHUB_ENV + + - name: Build + run: | + make -C _build --jobs=$(($(nproc)+1)) + + - name: Upload config.log + uses: actions/upload-artifact@v4 + if: failure() + with: + name: config-${{ matrix.os }}-${{ github.job }}.log + path: _build/config.log + + # note: distcheck also creates the dist tarball + - name: Build distribution archive & run tests + run: | + make -C _build distcheck \ + TESTSUITEFLAGS="--jobs=$(($(nproc)+1))" \ + --jobs=$(($(nproc)+1)) || \ + make -C _build/gnucobol-$VERSION/_build/sub/tests check \ + TESTSUITEFLAGS="--recheck --verbose" + make -C _build --jobs=$(($(nproc)+1)) dist DIST_TARGETS="dist-gzip distwin-zip" + make -C _build --jobs=$(($(nproc)+1)) distbin DISTBIN_TARGETS="distbin-xz" + + - name: Upload testsuite.log + if: ${{ ! cancelled() }} #-> always upload as build result documentation + uses: actions/upload-artifact@v4 + with: + # Assume there's only one directory matching `build/gnucobol-*`: + name: testsuite-${{ matrix.os }}-${{ github.job }}.log + path: _build/gnucobol-${{ env.VERSION }}/_build/sub/tests/testsuite.log + + - name: Upload dist tarball + uses: actions/upload-artifact@v4 + with: + name: gnucobol-ci source distribution + path: _build/gnucobol*.tar.gz + if-no-files-found: error + retention-days: 0 + + - name: Upload dist tarball + uses: actions/upload-artifact@v4 + with: + name: gnucobol-ci windows source distribution + path: _build/gnucobol*.zip + if-no-files-found: error + retention-days: 0 + + - name: Upload test binaries + uses: actions/upload-artifact@v4 + with: + name: gnucobol-ci binary distribution + path: _build/gnucobol*.tar.xz + if-no-files-found: error + retention-days: 0 + + - name: Cache newcob.val + uses: actions/cache@v4 + with: + path: _build/tests/cobol85/newcob.val + key: newcob-val + save-always: true + enableCrossOsArchive: true + + - name: NIST85 Test Suite + run: | + make -C _build/tests/cobol85 EXEC85 test \ + --jobs=$(($(nproc)+1)) + + - name: Upload NIST85 Test Suite results + uses: actions/upload-artifact@v4 + with: + name: NIST85 results on ${{ matrix.os }}-${{ github.job }} + path: | + _build/tests/cobol85/summary.* + _build/tests/cobol85/**/*.log + _build/tests/cobol85/**/*.out + _build/tests/cobol85/**/duration.txt + + #minmal_build: + # name: Build and test with minimal dependencies + # strategy: + # fail-fast: true + # matrix: + # os: [ubuntu-latest] + # needs: build + # runs-on: ${{ matrix.os }} + + # steps: + + # - name: Install packages + # run: | + # sudo apt -y update + # sudo apt -y install build-essential libgmp-dev + # sudo apt -y remove bison flex + + # - name: Get CI dist tarball + # uses: actions/download-artifact@v4 + # with: + # name: gnucobol-ci source distribution + + # - name: Build environment setup + # run: | + # tar -xvf gnucobol*.tar.* --strip-components=1 + # mkdir _build + + # - name: Configure + # run: | + # cd _build + # ../configure --disable-dependency-tracking \ + # --without-db --without-curses \ + # --without-xml2 --without-json \ + # --without-iconv --disable-nls + + # - name: Build + # run: | + # make -C _build --jobs=$(($(nproc)+1)) + + # - name: Upload config.log + # if: failure() + # uses: actions/upload-artifact@v4 + # with: + # name: config-${{ matrix.os }}-${{ github.job }}.log + # path: _build/config.log + + # - name: run internal tests + # run: | + # make -C _build check TESTSUITEFLAGS="--jobs=$(($(nproc)+1))" || \ + # make -C _build check TESTSUITEFLAGS="--recheck --verbose" + + # - name: Upload testsuite.log + # if: ${{ ! cancelled() }} #-> always upload as build result documentation + # uses: actions/upload-artifact@v4 + # with: + # name: testsuite-${{ matrix.os }}-${{ github.job }}.log + # path: _build/tests/testsuite.log + + # - name: Cache newcob.val + # uses: actions/cache@v4 + # with: + # path: _build/tests/cobol85/newcob.val + # key: newcob-val + # save-always: true + # enableCrossOsArchive: true + + # - name: NIST85 Test Suite + # run: | + # make -C _build/tests/cobol85 EXEC85 test \ + # --jobs=$(($(nproc)+1)) + + # - name: Upload NIST85 Test Suite results + # if: ${{ ! cancelled() }} #-> always upload as build result documentation + # uses: actions/upload-artifact@v4 + # with: + # name: NIST85 results on ${{ matrix.os }}-${{ github.job }} + # path: | + # _build/tests/cobol85/summary.* + # _build/tests/cobol85/**/*.log + # _build/tests/cobol85/**/*.out + # _build/tests/cobol85/**/duration.txt + + + #coverage: + # name: Coverage and Warnings + # needs: build + # runs-on: ubuntu-latest + + # steps: + # - name: Checkout code + # uses: actions/checkout@v4 + + # - name: Install dependencies + # run: | + # sudo apt -y install libdb5.3-dev libxml2-dev libcjson-dev lcov + + # - name: Get CI dist tarball + # uses: actions/download-artifact@v4 + # with: + # name: gnucobol-ci source distribution + + # - name: Build environment setup + # run: | + # tar -xvf gnucobol*.tar.* --strip-components=1 + # mkdir _build + # export TERM="vt100" + # echo "TERM=$TERM" >> $GITHUB_ENV + + # # note: add additional C compiler syntax checks here to not need + # # _another_ CI run + # # + # # TODO: try and pass -pedantic via CPPFLAGS + # - name: Configure + # run: | + # cd _build + # ../configure --enable-code-coverage \ + # --with-db --with-xml2 --with-json=cjson --with-curses=ncursesw \ + # CPPFLAGS="-Werror=declaration-after-statement" \ + # CC="gcc -std=c89" + + # - name: Build + # run: | + # make -C _build --jobs=$(($(nproc)+1)) + + # - name: Upload config.log + # if: failure() + # uses: actions/upload-artifact@v4 + # with: + # name: config-${{ github.job }}.log + # path: _build/config.log + + # - name: Coverage + # run: | + # # make -C _build check-code-coverage # <- (ignores errors) + # make -C _build check \ + # TESTSUITEFLAGS="--jobs=$(($(nproc)+1))" + # make -C _build code-coverage-capture \ + # CODE_COVERAGE_DIRECTORY="$(realpath .)/_build" + + # - name: Upload testsuite.log + # if: ${{ ! cancelled() }} #-> always upload as build result documentation + # uses: actions/upload-artifact@v4 + # with: + # name: testsuite-${{ github.job }}.log + # path: _build/tests/testsuite.log + + # - name: Upload coverage report + # uses: actions/upload-artifact@v4 + # with: + # name: coverage + # path: _build/GnuCOBOL-**-coverage + + # - name: Cache newcob.val + # uses: actions/cache@v4 + # with: + # path: _build/tests/cobol85/newcob.val + # key: newcob-val + # save-always: true + # enableCrossOsArchive: true + + # - name: Extended coverage + # run: | + # make -C _build/tests/cobol85 EXEC85 test \ + # --jobs=$(($(nproc)+1)) \ + # --keep-going + # make -C _build code-coverage-capture \ + # CODE_COVERAGE_OUTPUT_DIRECTORY=extended-coverage \ + # CODE_COVERAGE_OUTPUT_FILE=extended-coverage.info \ + # CODE_COVERAGE_DIRECTORY="$(realpath .)/_build" + + # - name: Upload extended coverage report + # uses: actions/upload-artifact@v4 + # with: + # name: extended-coverage + # path: _build/extended-coverage + + # - name: Upload coverage to codecov + # uses: codecov/codecov-action@v3 + # with: + # # token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos + # directory: _build + # # Shall fail until we have a working account on codecov.io + # fail_ci_if_error: false # optional (default = false) + # verbose: true # optional (default = false) + + + msys_build_test_createdist: + + needs: build + runs-on: windows-latest + timeout-minutes: 30 + + env: + MSYS_ROOT: C:\MinGW + MSYS_BIN: C:\MinGW\msys\1.0\bin + #BISON_PKGDATADIR: C:\MinGW\share\bison + # M4: m4 + MSYSTEM: MINGW32 + MSYSPKGS: msys-m4 msys-coreutils msys-patch + #MSYSPKGS: msys-m4 msys-flex msys-coreutils msys-help2man msys-bison msys-patch GC3 from VCS + #MINGW_AUTOCONF_VERS: 2.7.0 # only needed to build from VCS, not from dist tarball + #MINGW_BISON_VERS: bison-3.6 # minimal for GC 4.x+ + MINGW_GMP_VERS: gmp-6.3.0 # always update for performance reasons + MINGW_BDB_VERS: db-6.0.19.NC + MINGW_PDCM_VERS: 4.4.0 + MINGW_CJSON_VERS: 1.7.18 + MINGW_XML2_VERS: 2.8.0 + + strategy: + fail-fast: false + matrix: + target: + - debug + - release + + steps: + + - name: Get CI dist tarball + uses: actions/download-artifact@v4 + with: + name: gnucobol-ci source distribution + + - name: Build environment setup + run: | + bash -lc "tar -xvf gnucobol*.tar.* --strip-components=1" + mkdir _build + + - name: Setup environment + run: | + echo GITHUB_WORKSPACE=$env:GITHUB_WORKSPACE >> $env:GITHUB_ENV + echo HOME=$env:GITHUB_WORKSPACE >> $env:GITHUB_ENV + echo PATH="$env:MSYS_BIN;$env:PATH" >> $env:GITHUB_ENV + If ("${{ matrix.target }}" -eq "release") { + echo DISTDIR=GnuCOBOL_mingw >> $env:GITHUB_ENV + echo CFGOPT="--with-pkgversion=GnuCOBOL-CI-MSYS" >> $env:GITHUB_ENV + } else { + echo DISTDIR=GnuCOBOL_mingw_dbg >> $env:GITHUB_ENV + echo CFGOPT="--with-pkgversion=GnuCOBOL-CI-MSYS-Debug --enable-debug --enable-cobc-internal-checks --enable-hardening" >> $env:GITHUB_ENV + } + + - name: Restore MSYS1 cache + id: restore-msys + uses: actions/cache/restore@v4 + with: + key: cache-msys + 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 -y MinGW-bkup02.7z -o${{ env.MSYS_ROOT }}\ + + - name: Install MSYS1 packages + if: steps.restore-msys.outputs.cache-hit != 'true' + run: | + ${{ env.MSYS_ROOT }}\bin\mingw-get install %MSYSPKGS% + + - name: Cleanup MSYS1 env + if: steps.restore-msys.outputs.cache-hit != 'true' + shell: cmd + run: | + rmdir /Q /S ${{ env.MSYS_ROOT }}\docs + rmdir /Q /S ${{ env.MSYS_ROOT }}\var + del /Q ${{ env.MSYS_ROOT }}\bin\gdb* + + - name: Save MSYS1 cache + if: steps.restore-msys.outputs.cache-hit != 'true' + uses: actions/cache/save@v4 + with: + key: cache-msys + path: ${{ env.MSYS_ROOT }} + + + # - name: Restore Bison cache + # id: restore-bison + # uses: actions/cache/restore@v4 + # with: + # key: cache-msys-bison + # path: ${{ env.MINGW_BISON_VERS }} + + # - name: Install Bison + # if: steps.restore-bison.outputs.cache-hit != 'true' + # run: | + # curl -L https://ftp.gnu.org/gnu/bison/%MINGW_BISON_VERS%.tar.gz -o %MINGW_BISON_VERS%.tar.gz + # tar -xvf %MINGW_BISON_VERS%.tar.gz + # bash -lc "cd %MINGW_BISON_VERS% && ./configure --prefix=/mingw && make" + + # - name: Install Bison + # run: | + # bash -lc "make -C %MINGW_BISON_VERS% install" + + # - name: Save Bison cache + # if: steps.restore-bison.outputs.cache-hit != 'true' + # uses: actions/cache/save@v4 + # with: + # key: cache-msys-bison + # path: ${{ env.MINGW_BISON_VERS }} + + + # - name: Restore Autoconf cache + # id: restore-autoconf + # uses: actions/cache/restore@v4 + # with: + # key: cache-msys-autoconf + # path: ${{ env.MINGW_BISON_VERS }} + + # - name: Install Autoconf 2.70 + # if: steps.restore-autoconf.outputs.cache-hit != 'true' + # run: | + # curl -L https://ftpmirror.gnu.org/autoconf/%MINGW_AUTOCONF_VERS%.tar.gz -o %MINGW_AUTOCONF_VERS%.tar.gz + # tar -xvzf %MINGW_AUTOCONF_VERS%.tar.gz + # bash -lc "cd %MINGW_AUTOCONF_VERS% && ./configure" + # bash -lc "cd %MINGW_AUTOCONF_VERS% && make" + + # - name: Install Autoconf + # run: | + # bash -lc "cd %MINGW_AUTOCONF_VERS% && make install" + + # - name: Save Autoconf cache + # if: steps.restore-autoconf.outputs.cache-hit != 'true' + # uses: actions/cache/save@v4 + # with: + # key: cache-msys-autoconf + # path: ${{ env.MINGW_BISON_VERS }} + + + - name: Restore GMP cache + id: restore-gmp + uses: actions/cache/restore@v4 + with: + key: cache-msys-gmp + path: ${{ env.MINGW_GMP_VERS }} + + - name: Build GMP + if: steps.restore-gmp.outputs.cache-hit != 'true' + shell: cmd + run: | + rem note: MSYS1 cannot connect to https://gmplib.org, so using GNU mirror side instead + curl -L https://ftp.gnu.org/gnu/gmp/${{ env.MINGW_GMP_VERS }}.tar.xz -o ${{ env.MINGW_GMP_VERS }}.tar.xz + tar -xvf ${{ env.MINGW_GMP_VERS }}.tar.xz + bash -lc "cd ${{ env.MINGW_GMP_VERS }} && ./configure --prefix=/mingw --enable-fat --enable-shared --disable-static CFLAGS=\"-Wno-attributes -Wno-ignored-attributes\" ABI=32 && make --jobs=$(($(nproc)+1))" + + - name: Install GMP + run: | + bash -lc "make -C ${{ env.MINGW_GMP_VERS }} install" + + - name: Save GMP cache + if: steps.restore-gmp.outputs.cache-hit != 'true' + uses: actions/cache/save@v4 + with: + key: cache-msys-gmp + path: ${{ env.MINGW_GMP_VERS }} + + + - name: Restore BDB cache + id: restore-bdb + uses: actions/cache/restore@v4 + with: + key: cache-msys-bdb + path: ${{ env.MINGW_BDB_VERS }} + + - name: Build BDB + if: steps.restore-bdb.outputs.cache-hit != 'true' + run: | + curl -L https://download.oracle.com/berkeley-db/${{ env.MINGW_BDB_VERS }}.tar.gz -o ${{ env.MINGW_BDB_VERS }}.tar.gz + curl -L https://raw.githubusercontent.com/msys2/MINGW-packages/refs/heads/master/mingw-w64-db/0001-db-tls-m4-fix-pthread.patch -o db-tls-m4-fix-pthread.patch + curl -L https://raw.githubusercontent.com/msys2/MINGW-packages/refs/heads/master/mingw-w64-db/mingw.patch -o mingw.patch + curl -L https://raw.githubusercontent.com/msys2/MINGW-packages/refs/heads/master/mingw-w64-db/cclang_cxx_11.patch -o cx11.patch + tar -xvf ${{ env.MINGW_BDB_VERS }}.tar.gz + sed -i 's/_tcsclen/mbslen/' ${{ env.MINGW_BDB_VERS }}\src\os_windows\os_stat.c + bash -lc "cd ${{ env.MINGW_BDB_VERS }} && /bin/patch -p1 -i ../db-tls-m4-fix-pthread.patch" + bash -lc "cd ${{ env.MINGW_BDB_VERS }} && /bin/patch -p1 -i ../mingw.patch" + bash -lc "cd ${{ env.MINGW_BDB_VERS }} && /bin/patch -p1 -i ../cx11.patch" + bash -lc "cd ${{ env.MINGW_BDB_VERS }}/build_unix && ../dist/configure --prefix=/mingw --enable-mingw --enable-debug --disable-static --disable-replication --disable-tcl --without-cryptography LIBCSO_LIBS=-lwsock32 && make --jobs=$(($(nproc)+1))" + + - name: Install BDB + run: | + bash -lc "make -C ${{ env.MINGW_BDB_VERS }}/build_unix install" + + - name: Save BDB cache + if: steps.restore-bdb.outputs.cache-hit != 'true' + uses: actions/cache/save@v4 + with: + key: cache-msys-bdb + path: ${{ env.MINGW_BDB_VERS }} + + + - name: Restore LibXML2 cache + id: restore-xml2 + uses: actions/cache/restore@v4 + with: + key: cache-msys-xml2 + path: libxml2-${{ env.MINGW_XML2_VERS }} + + - name: Build LibXML2 + if: steps.restore-xml2.outputs.cache-hit != 'true' + run: | + curl -L https://github.com/GNOME/libxml2/archive/refs/tags/v${{ env.MINGW_XML2_VERS }}.tar.gz -o libxml2-${{ env.MINGW_XML2_VERS }}.tar.xz + tar -xvf libxml2-${{ env.MINGW_XML2_VERS }}.tar.xz + bash -lc "cd libxml2-${{ env.MINGW_XML2_VERS }} && ./autogen.sh" + bash -lc "cd libxml2-${{ env.MINGW_XML2_VERS }} && ./configure --prefix=/mingw --enable-debug && make --jobs=$(($(nproc)+1))" + + - name: Install LibXML2 + run: | + bash -lc "make -C libxml2-${{ env.MINGW_XML2_VERS }} install" + + - name: Save LibXML2 cache + if: steps.restore-xml2.outputs.cache-hit != 'true' + uses: actions/cache/save@v4 + with: + key: cache-msys-xml2 + path: libxml2-${{ env.MINGW_XML2_VERS }} + + + - name: Restore PDCursesMod cache + id: restore-pdcm + uses: actions/cache/restore@v4 + with: + key: cache-msys-pdcm + path: PDCursesMod-${{ env.MINGW_PDCM_VERS }} + + - name: Build PDCursesMod + if: steps.restore-pdcm.outputs.cache-hit != 'true' + shell: cmd + run: | + curl -L https://github.com/Bill-Gray/PDCursesMod/archive/refs/tags/v${{ env.MINGW_PDCM_VERS }}.tar.gz -o "PDCursesMod-${{ env.MINGW_PDCM_VERS }}.tar.xz" + tar -xvf PDCursesMod-${{ env.MINGW_PDCM_VERS }}.tar.xz + rem: consider inclusion of https://github.com/Bill-Gray/PDCursesMod/commit/45949000c3ac1375f5f821d72f46e4726a3a6a2f.patch + bash -lc "cd PDCursesMod-${{ env.MINGW_PDCM_VERS }} && make -C wincon --jobs=$(($(nproc)+1)) INFOEX=N CHTYPE_64=Y DEBUG=Y DLL=Y DLLNAME=libpdcurses LIBNAME=libpdcurses.dll" + bash -lc "cd PDCursesMod-${{ env.MINGW_PDCM_VERS }} && make -C wingui --jobs=$(($(nproc)+1)) CHTYPE_64=Y DEBUG=Y DLL=Y DLLNAME=libpdcurses LIBNAME=libpdcurses.dll" + bash -lc "cd PDCursesMod-${{ env.MINGW_PDCM_VERS }} && make -C vt --jobs=$(($(nproc)+1)) CHTYPE_64=Y DEBUG=Y DLL=Y DLLNAME=libpdcurses LIBNAME=libpdcurses.dll CFLAGS=\"-Wall -Wextra -pedantic -g -DPDCDEBUG -fPIC -DPDC_DLLbuild\"" + rem: only works this way on cmd + echo #define CHTYPE_64 > PDCursesMod-${{ env.MINGW_PDCM_VERS }}\pdcurses.h + echo #define PDC_DLLbuild >> PDCursesMod-${{ env.MINGW_PDCM_VERS }}\pdcurses.h + echo #include "pdcurses/curses.h" >> PDCursesMod-${{ env.MINGW_PDCM_VERS }}\pdcurses.h + + - name: Install PDCursesMod + run: | + bash -lc "cd PDCursesMod-${{ env.MINGW_PDCM_VERS }} && install wincon/libpdcurses.dll.a /mingw/lib/" + bash -lc "cd PDCursesMod-${{ env.MINGW_PDCM_VERS }} && install wincon/libpdcurses.dll /mingw/bin/" + bash -lc "cd PDCursesMod-${{ env.MINGW_PDCM_VERS }} && install wincon/libpdcurses.dll /mingw/bin/libpdcurses-wincon.dll" + bash -lc "cd PDCursesMod-${{ env.MINGW_PDCM_VERS }} && install wingui/libpdcurses.dll /mingw/bin/libpdcurses-wingui.dll" + bash -lc "cd PDCursesMod-${{ env.MINGW_PDCM_VERS }} && install vt/libpdcurses.dll /mingw/bin/libpdcurses-vt.dll" + bash -lc "install -d /mingw/include/pdcurses" + bash -lc "cd PDCursesMod-${{ env.MINGW_PDCM_VERS }} && install -m 0644 curses.h panel.h term.h /mingw/include/pdcurses/" + bash -lc "cd PDCursesMod-${{ env.MINGW_PDCM_VERS }} && install -m 0644 pdcurses.h /mingw/include/" + + - name: Save PDCursesMod cache + if: steps.restore-pdcm.outputs.cache-hit != 'true' + uses: actions/cache/save@v4 + with: + key: cache-msys-pdcm + path: PDCursesMod-${{ env.MINGW_PDCM_VERS }} + + + - name: get cJSON + run: | + curl -L https://raw.githubusercontent.com/DaveGamble/cJSON/v${{ env.MINGW_CJSON_VERS }}/cJSON.c -o .\libcob\cJSON.c + curl -L https://raw.githubusercontent.com/DaveGamble/cJSON/v${{ env.MINGW_CJSON_VERS }}/cJSON.h -o .\libcob\cJSON.h + + + # - name: Bootstrap GnuCOBOL + # run: | + # sed -i 's/AM_PROG_AR/m4_ifdef\(\[AM_PROG_AR\], \[AM_PROG_AR\]\)/g' .\configure.ac + # sed -i 's/po extras doc tests/po extras tests/g' .\Makefile.am + # bash -lc "./autogen.sh" + + - name: Configure GnuCOBOL + shell: cmd + run: | + bash -lc "cd _build && ../configure %CFGOPT% --with-db --with-xml2 --with-json=local --with-curses=pdcurses --prefix=/mingw" + rem Note: GC4 may need CPPFLAGS="-I../libcob" for local cJSON + + - name: Build GnuCOBOL + shell: cmd + run: | + bash -lc "CPATH=$(pwd) make -C _build --jobs=$(($(nproc)+1))" + rem Note: the extra CPATH above is only required in debug builds (otherwise gcc invoked from cobc does not find libcob.h [pre-inst-env]), for some reason... + + - name: Upload config-${{ matrix.target }}.log + if: failure() + uses: actions/upload-artifact@v4 + with: + name: config-${{ matrix.target }}.log + path: _build/config.log + + - name: Run testsuite + shell: cmd + run: | + rem skip test as it sometimes works and sometimes not... + rem instead of + rem sed -i '/AT_SETUP(\[temporary path invalid\])/a AT_SKIP_IF(\[true\])' tests/testsuite.src/used_binaries.at + rem use + sed -i '/used_binaries/{N;/temporary path invalid/{N;N;N;N;s/traceon/traceon; echo "workflow:1" >"$at_check_line_file"; at_fn_check_skip 77/;}}' tests/testsuite + + + rem change to expected fail if there's an error specific to the CI that we don't want to change + rem in the testsuite for expected result (should normally only be a temporary thing) + rem instead of + rem sed -i '/AT_SETUP(\[Compare FLOAT-LONG with floating-point literal\])/a AT_XFAIL_IF(\[true\])' tests/testsuite.src/run_fundamental.at + rem use + rem sed -i '/run_fundamental/{N;/Compare FLOAT-LONG with floating-point literal/{N;s/at_xfail=no/at_xfail=yes/;}}' tests/testsuite + + bash -lc "CPATH=$(pwd) make -C _build/tests check" + rem Note: the extra CPATH above is only required in debug builds (otherwise gcc invoked from cobc does not find libcob.h [atlocal]), for some reason... + + - name: Upload testsuite-${{ matrix.target }}.log + if: ${{ ! cancelled() }} #-> always upload as build result documentation + uses: actions/upload-artifact@v4 + with: + name: testsuite-${{ matrix.target }}.log + path: _build/tests/testsuite.log + + - name: Cache newcob.val + uses: actions/cache@v4 + with: + path: _build/tests/cobol85/newcob.val + key: newcob-val + save-always: true + enableCrossOsArchive: true + + - name: Run NIST85 testsuite + # if we ever need to disable something in the tests: skip like here IF106A + # and later expect a failure + # perl -pi -e 's/^# OBNC1M/\$skip{IF106A} = 1; # OBNC1M/' tests/cobol85/report.pl + # bash -lc "CPATH=$(pwd) make -C _build/tests test --jobs=$(($(nproc)+1)) || echo \"WARNING: NIST85 did not pass!\"" + shell: cmd + run: | + bash -lc "CPATH=$(pwd) make -C _build/tests test --jobs=$(($(nproc)+1))" + rem Note: the extra CPATH above is only required in debug builds (otherwise gcc invoked from cobc does not find libcob.h [atlocal]), for some reason... + + - name: Upload NIST85 Test Suite results + if: ${{ ! cancelled() }} #-> always upload as build result documentation + uses: actions/upload-artifact@v4 + with: + name: NIST85 results on ${{ matrix.target }} + path: | + _build/tests/cobol85/summary.* + _build/tests/cobol85/**/*.log + _build/tests/cobol85/**/*.out + _build/tests/cobol85/**/duration.txt + + - name: Package GnuCOBOL MinGW nightly + run: | + bash -lc "make -C _build distmingw" + + - name: Upload GnuCOBOL_mingw-${{ matrix.target }} + uses: actions/upload-artifact@v4 + with: + name: GnuCOBOL_mingw-${{ matrix.target }} + path: _build/${{ env.DISTDIR }} diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 7115b1f94..13a81718e 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -1,9 +1,9 @@ name: MacOS Workflow on: - pull_request: - branches: [ gcos4gnucobol-3.x ] - push: + # pull_request: + # branches: [ gcos4gnucobol-3.x ] + # push: # manual run in actions tab - for all branches workflow_dispatch: @@ -57,6 +57,10 @@ jobs: --enable-hardening \ --prefix /opt/cobol/gnucobol-gcos \ + - name: make + run: | + make -C _build --jobs=$((${NPROC}+1)) + - name: Upload config.log uses: actions/upload-artifact@v4 with: @@ -64,10 +68,6 @@ jobs: path: _build/config.log if: failure() - - name: make - run: | - make -C _build --jobs=$((${NPROC}+1)) - # make install must be done before make check, otherwise # execution of generated COBOL files fail for a missing # /usr/local/lib/libcob.dylib @@ -89,7 +89,7 @@ jobs: - name: Upload testsuite.log uses: actions/upload-artifact@v4 - if: failure() + if: ${{ ! cancelled() }} #-> always upload as build result documentation with: name: testsuite-${{ matrix.os }}.log path: _build/tests/testsuite.log @@ -102,7 +102,22 @@ jobs: save-always: true enableCrossOsArchive: true - - name: NIST85 Test Suite +# - name: NIST85 Test Suite +# run: | +# make -C _build/tests/cobol85 EXEC85 test \ +# --jobs=$((${NPROC}+1)) + + - name: Run NIST85 testsuite run: | - make -C _build/tests/cobol85 EXEC85 test \ - --jobs=$((${NPROC}+1)) + make -C _build/tests test --jobs=$((${NPROC}+1)) + + - name: Upload NIST85 Test Suite results + if: ${{ ! cancelled() }} #-> always upload as build result documentation + uses: actions/upload-artifact@v4 + with: + name: NIST85 results on ${{ matrix.os }} + path: | + _build/tests/cobol85/summary.* + _build/tests/cobol85/**/*.log + _build/tests/cobol85/**/*.out + _build/tests/cobol85/**/duration.txt diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml deleted file mode 100644 index 1a3df6462..000000000 --- a/.github/workflows/ubuntu.yml +++ /dev/null @@ -1,310 +0,0 @@ -name: Ubuntu Workflow - -on: - - pull_request: - branches: [ gcos4gnucobol-3.x ] - push: - # manual run in actions tab - for all branches - workflow_dispatch: - - -jobs: - - build: - name: Build, test and provide nightly - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest] - runs-on: ${{ matrix.os }} - - steps: - - name: Install packages - run: | - sudo apt-get update - sudo apt-get install automake libtool libdb5.3-dev libxml2-dev libcjson-dev \ - bison flex help2man gettext texlive - - - name: Set git user - run: | - git config --global user.name github-actions - git config --global user.email github-actions-bot@users.noreply.github.com - - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - name: Checkout code - uses: actions/checkout@v4 - - - name: Bootstrap - run: | - ./build_aux/bootstrap - - # FIXME: With TERM="dumb" `make check` fails with: - # ... - # 571: ACCEPT OMITTED (SCREEN) FAILED (run_accept.at:307) - # ... - # 693: ON EXCEPTION clause of DISPLAY FAILED (run_misc.at:6335) - # 695: LINE/COLUMN 0 exceptions FAILED (run_misc.at:6414) - # 694: EC-SCREEN-LINE-NUMBER and -STARTING-COLUMN FAILED (run_misc.at:6376) - # ... - # Failure cases read: "Error opening terminal: unknown." on - # stderr, and exit with code 1. - # - # Another alternative is passing `--with-curses=no` to the - # configure script, yet distcheck does call configure too... - # - - name: Build environment setup - run: | - mkdir _build - export TERM="vt100" - echo "TERM=$TERM" >> $GITHUB_ENV - echo "INSTALL_PATH=$(pwd)/_install" >> $GITHUB_ENV - - - name: Configure - run: | - cd _build - ../configure --enable-cobc-internal-checks \ - --enable-hardening \ - --prefix ${INSTALL_PATH} - echo "VERSION=PACKAGE_VERSION" | cpp -P -imacros config.h | tr -d \" \ - >> $GITHUB_ENV - - - name: Upload config.log - uses: actions/upload-artifact@v4 - if: failure() - with: - name: config-${{ matrix.os }}-${{ github.job }}.log - path: _build/config.log - - - name: Build - run: | - make -C _build --jobs=$(($(nproc)+1)) - - # note: distcheck also creates the dist tarball - - name: Build distribution archive & run tests - run: | - make -C _build distcheck \ - TESTSUITEFLAGS="--jobs=$(($(nproc)+1))" \ - --jobs=$(($(nproc)+1)) || \ - make -C _build/gnucobol-$VERSION/_build/sub/tests check \ - TESTSUITEFLAGS="--recheck --verbose" - - - name: Upload testsuite.log - uses: actions/upload-artifact@v4 - if: failure() - with: - # Assume there's only one directory matching `_build/gnucobol-*`: - name: testsuite-${{ matrix.os }}-${{ github.job }}.log - path: _build/gnucobol-${{ env.VERSION }}/_build/sub/tests/testsuite.log - - - name: Upload dist tarball - uses: actions/upload-artifact@v4 - with: - name: gnucobol-ci source distribution - path: _build/gnucobol*.tar* - if-no-files-found: error - retention-days: 0 - - - name: Cache newcob.val - uses: actions/cache@v4 - with: - path: _build/tests/cobol85/newcob.val - key: newcob-val - save-always: true - enableCrossOsArchive: true - - - name: NIST85 Test Suite - run: | - make -C _build/tests/cobol85 EXEC85 test \ - --jobs=$(($(nproc)+1)) - - - name: Upload NIST85 Test Suite results - uses: actions/upload-artifact@v4 - with: - name: NIST85 results on ${{ matrix.os }}-${{ github.job }} - path: | - _build/tests/cobol85/summary.* - _build/tests/cobol85/**/*.log - _build/tests/cobol85/**/*.out - _build/tests/cobol85/**/duration.txt - - minmal_build: - name: Build and test with minimal dependencies - strategy: - fail-fast: true - matrix: - os: [ubuntu-latest] - needs: build - runs-on: ${{ matrix.os }} - - steps: - - - name: Install packages - run: | - sudo apt-get update - sudo apt-get install build-essential libgmp-dev - - - name: Get CI dist tarball - uses: actions/download-artifact@v4 - with: - name: gnucobol-ci source distribution - - - name: Build environment setup - run: | - tar -xvf gnucobol*.tar.* --strip-components=1 - mkdir _build - - - name: Configure - run: | - cd _build - ../configure --disable-dependency-tracking \ - --without-db --without-curses \ - --without-xml2 --without-json \ - --without-iconv --disable-nls - - - name: Upload config.log - uses: actions/upload-artifact@v4 - if: failure() - with: - name: config-${{ matrix.os }}-${{ github.job }}.log - path: _build/config.log - - - name: Build - run: | - make -C _build --jobs=$(($(nproc)+1)) - - - name: run internal tests - run: | - make -C _build check TESTSUITEFLAGS="--jobs=$(($(nproc)+1))" || \ - make -C _build check TESTSUITEFLAGS="--recheck --verbose" - - - name: Upload testsuite.log - uses: actions/upload-artifact@v4 - if: failure() - with: - name: testsuite-${{ matrix.os }}-${{ github.job }}.log - path: _build/tests/testsuite.log - - - name: Cache newcob.val - uses: actions/cache@v4 - with: - path: _build/tests/cobol85/newcob.val - key: newcob-val - save-always: true - enableCrossOsArchive: true - - - name: NIST85 Test Suite - run: | - make -C _build/tests/cobol85 EXEC85 test \ - --jobs=$(($(nproc)+1)) - - - name: Upload NIST85 Test Suite results - uses: actions/upload-artifact@v4 - with: - name: NIST85 results on ${{ matrix.os }}-${{ github.job }} - path: | - _build/tests/cobol85/summary.* - _build/tests/cobol85/**/*.log - _build/tests/cobol85/**/*.out - _build/tests/cobol85/**/duration.txt - - - coverage: - name: Coverage and Warnings - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v4 - - # note: less dependencies as we don't generate a dist tarball, one additional for lcov - - name: Install dependencies - run: | - sudo apt-get install automake libtool libdb5.3-dev libxml2-dev \ - libcjson-dev bison flex help2man gettext lcov - - - name: Bootstrap - run: | - ./build_aux/bootstrap - - - name: Build environment setup - run: | - mkdir _build - export TERM="vt100" - echo "TERM=$TERM" >> $GITHUB_ENV - - # note: add additional C compiler syntax checks here to not need - # _another_ CI run - # - # TODO: try and pass -pedantic via CPPFLAGS - - name: Configure - run: | - cd _build - ../configure --enable-code-coverage \ - CPPFLAGS="-Werror=declaration-after-statement" \ - CC="gcc -std=c89" - - - name: Upload config.log - uses: actions/upload-artifact@v4 - if: failure() - with: - name: config-${{ matrix.os }}-${{ github.job }}.log - path: _build/config.log - - - name: Build - run: | - make -C _build --jobs=$(($(nproc)+1)) - - - name: Coverage - run: | - # make -C _build check-code-coverage # <- (ignores errors) - make -C _build check \ - TESTSUITEFLAGS="--jobs=$(($(nproc)+1))" - make -C _build code-coverage-capture \ - CODE_COVERAGE_DIRECTORY="$(realpath .)/_build" - - - name: Upload testsuite.log - uses: actions/upload-artifact@v4 - if: failure() - with: - name: testsuite-${{ matrix.os }}-${{ github.job }}.log - path: _build/tests/testsuite.log - - - name: Upload coverage report - uses: actions/upload-artifact@v4 - with: - name: coverage - path: _build/GnuCOBOL-**-coverage - - - name: Cache newcob.val - uses: actions/cache@v4 - with: - path: _build/tests/cobol85/newcob.val - key: newcob-val - save-always: true - enableCrossOsArchive: true - - - name: Extended coverage - run: | - make -C _build/tests/cobol85 EXEC85 test \ - --jobs=$(($(nproc)+1)) \ - --keep-going - make -C _build code-coverage-capture \ - CODE_COVERAGE_OUTPUT_DIRECTORY=extended-coverage \ - CODE_COVERAGE_OUTPUT_FILE=extended-coverage.info \ - CODE_COVERAGE_DIRECTORY="$(realpath .)/_build" - - - name: Upload extended coverage report - uses: actions/upload-artifact@v4 - with: - name: extended-coverage - path: _build/extended-coverage - - - name: Upload coverage to codecov - uses: codecov/codecov-action@v2 - with: - # token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos - directory: _build - # Shall fail until we have a working account on codecov.io - fail_ci_if_error: false # optional (default = false) - verbose: true # optional (default = false) diff --git a/.github/workflows/windows-msvc.yml b/.github/workflows/windows-msvc.yml index b748e62d6..cbe2eae85 100644 --- a/.github/workflows/windows-msvc.yml +++ b/.github/workflows/windows-msvc.yml @@ -1,8 +1,8 @@ name: Windows MSVC Workflow on: - pull_request: - branches: [ gcos4gnucobol-3.x ] + # pull_request: + # branches: [ gcos4gnucobol-3.x ] push: # manual run in actions tab - for all branches workflow_dispatch: @@ -62,7 +62,7 @@ jobs: echo VCVARS=$env:VCVARS32 >> $env:GITHUB_ENV echo VCPKGS=$env:VCPKGS32 >> $env:GITHUB_ENV echo ARCHDIR=Win32 >> $env:GITHUB_ENV - } Else { + } else { echo VCVARS=$env:VCVARS64 >> $env:GITHUB_ENV echo VCPKGS=$env:VCPKGS64 >> $env:GITHUB_ENV echo ARCHDIR=x64 >> $env:GITHUB_ENV @@ -80,7 +80,7 @@ jobs: - name: Bootstrap VCPKG if: steps.restore-vcpkg.outputs.cache-hit != 'true' run: | - cd /d %VCPKG_ROOT% + cd /d ${{ env.VCPKG_ROOT }} vcpkg update git pull cmd /C .\bootstrap-vcpkg.bat -disableMetrics @@ -133,6 +133,7 @@ jobs: -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' ` + -replace '"\(" PACKAGE_NAME "\) "', '"( GnuCOBOL ${{ matrix.target }} CI ) "' ` } | Set-Content -Path 'config.h' & .\maketarstamp.ps1 > tarstamp.h @@ -153,26 +154,6 @@ jobs: run: | pacman --needed --noconfirm -S $MSYSPKGS - - name: Adjust testsuite - shell: C:\shells\msys2bash.cmd {0} - run: | - cd tests - sed -i '/AT_SETUP(\[runtime check: write to internal storage (1)\])/a AT_SKIP_IF(\[true\])' testsuite.src/run_misc.at - - # Skip two tests that behave differently (fail or hand) under MSVC Debug - # - System routine CBL_GC_HOSTED: fails because libcob is linked with the debug version - # of the C runtime while the generated module is linked with the release version - # - PROGRAM COLLATING SEQUENCE: fails because of a data loss in a cast, due - # to lack of specific handling of LOW/HIGH-VALUE for NATIONAL alphabets - # (see typeck.c:cb_validate_collating) - - name: Adjust testsuite for Debug target - if: ${{ matrix.target == 'Debug' }} - shell: C:\shells\msys2bash.cmd {0} - run: | - cd tests - sed -i '/AT_SETUP(\[System routine CBL_GC_HOSTED\])/a AT_SKIP_IF(\[true\])' testsuite.src/run_extensions.at - sed -i '/AT_SETUP(\[PROGRAM COLLATING SEQUENCE\])/a AT_SKIP_IF(\[true\])' testsuite.src/syn_definition.at - - name: Build testsuite shell: C:\shells\msys2bash.cmd {0} run: | @@ -194,30 +175,68 @@ jobs: sed 's/x64\/Debug/${{ env.ARCHDIR }}\/${{ matrix.target }}/g' atlocal_win > atlocal autom4te --lang=autotest -I ./testsuite.src ./testsuite.at -o ./testsuite + - name: Adjust testsuite + shell: C:\shells\msys2bash.cmd {0} + run: | + # sed -i '/AT_SETUP(\[runtime check: write to internal storage (1)\])/a AT_SKIP_IF(\[true\])' tests/testsuite.src/run_misc.at + sed -i '/run_misc/{N;/write to internal storage (1)/{N;N;N;N;s/traceon/traceon; echo "workflow:1" >"$at_check_line_file"; at_fn_check_skip 77/;}}' tests/testsuite + + # Skip two tests that behave differently (fail or hand) under MSVC Debug + # - System routine CBL_GC_HOSTED: fails because libcob is linked with the debug version + # of the C runtime while the generated module is linked with the release version + # - PROGRAM COLLATING SEQUENCE: fails because of a data loss in a cast, due + # to lack of specific handling of LOW/HIGH-VALUE for NATIONAL alphabets + # (see typeck.c:cb_validate_collating) + - name: Adjust testsuite for Debug target + if: ${{ matrix.target == 'Debug' }} + shell: C:\shells\msys2bash.cmd {0} + run: | + #sed -i '/AT_SETUP(\[System routine CBL_GC_HOSTED\])/a AT_SKIP_IF(\[true\])' tests/testsuite.src/run_extensions.at + #sed -i '/AT_SETUP(\[PROGRAM COLLATING SEQUENCE\])/a AT_SKIP_IF(\[true\])' tests/testsuite.src/syn_definition.at + #sed -i '/run_extensions/{N;/System routine CBL_GC_HOSTED/{N;N;N;N;s/traceon/traceon; echo "workflow:2" >"$at_check_line_file"; at_fn_check_skip 77/;}}' tests/testsuite + #sed -i '/syn_definition/{N;/PROGRAM COLLATING SEQUENCE/{N;N;N;N;s/traceon/traceon; echo "workflow:3" >"$at_check_line_file"; at_fn_check_skip 77/;}}' tests/testsuite + sed -i '/run_extensions/{N;/System routine CBL_GC_HOSTED/{N;s/at_xfail=no/at_xfail=yes/;}}' tests/testsuite + sed -i '/syn_definition/{N;/PROGRAM COLLATING SEQUENCE/{N;s/at_xfail=no/at_xfail=yes/;}}' tests/testsuite + - name: Run testsuite run: | cd tests - set CL=/I "%VCPKG_ROOT%\installed\${{ matrix.arch }}-windows\include" + set CL=/I "${{ env.VCPKG_ROOT }}\installed\${{ matrix.arch }}-windows\include" call "%VCVARS%" set MSYS2_PATH_TYPE=inherit C:\shells\msys2bash.cmd -c "./testsuite || ./testsuite --recheck --verbose" - name: Upload testsuite-${{ matrix.arch }}-${{ matrix.target }}.log uses: actions/upload-artifact@v4 - if: failure() + if: ${{ ! cancelled() }} #-> always upload as build result documentation with: name: testsuite-${{ matrix.arch }}-${{ matrix.target }}.log - path: ${{ env.GITHUB_WORKSPACE }}/tests/testsuite.log - - # - name: Package GnuCOBOL - # run: | - # cd build_windows - # set CL=/I "%VCPKG_ROOT%\installed\${{ matrix.arch }}-windows\include" - # call "%VCVARS%" - # cmd /C .\makedist.cmd > $env:GITHUB_ENV - echo HOME=$env:GITHUB_WORKSPACE >> $env:GITHUB_ENV - echo PATH="$env:MSYS_BIN;$env:PATH" >> $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 MSYS1 cache - 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 - tar -xvf %MINGW_BISON_VERS%.tar.xz - bash -lc "cd %MINGW_BISON_VERS% && ./configure --prefix=/mingw && make" - bash -lc "cd %MINGW_BISON_VERS% && make install" - - # Note: actually unavailable, so skip (works with the GMP alredy provided) - # - 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 - # tar -xvf %MINGW_GMP_VERS%.tar.xz - # bash -lc "cd %MINGW_GMP_VERS% && ./configure --prefix=/mingw --enable-fat --enable-shared --disable-static CFLAGS=\"-Wno-attributes -Wno-ignored-attributes\" ABI=32 && make" - # bash -lc "cd %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 - tar -xvf %MINGW_BDB_VERS%.tar.gz - sed -i 's/_tcsclen/strlen/' %MINGW_BDB_VERS%\src\os_windows\os_stat.c - bash -lc "cd %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 %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" - tar -xvf PDCursesMod-%MINGW_PDCM_VERS%.tar.xz - bash -lc "cd PDCursesMod-%MINGW_PDCM_VERS%\wincon && make INFOEX=N CHTYPE_64=Y DEBUG=Y DLL=Y DLLNAME=libpdcurses LIBNAME=libpdcurses.dll" - bash -lc "cd PDCursesMod-%MINGW_PDCM_VERS%\wingui && make CHTYPE_64=Y DEBUG=Y DLL=Y DLLNAME=libpdcurses LIBNAME=libpdcurses.dll" - bash -lc "cd 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 PDCursesMod-%MINGW_PDCM_VERS% && install wincon/libpdcurses.dll.a /mingw/lib/" - bash -lc "cd PDCursesMod-%MINGW_PDCM_VERS% && install wincon/libpdcurses.dll /mingw/bin/" - bash -lc "cd PDCursesMod-%MINGW_PDCM_VERS% && install wincon/libpdcurses.dll /mingw/bin/libpdcurses-wincon.dll" - bash -lc "cd PDCursesMod-%MINGW_PDCM_VERS% && install wingui/libpdcurses.dll /mingw/bin/libpdcurses-wingui.dll" - bash -lc "cd PDCursesMod-%MINGW_PDCM_VERS% && install vt/libpdcurses.dll /mingw/bin/libpdcurses-vt.dll" - bash -lc "install -d /mingw/include/pdcurses" - bash -lc "cd PDCursesMod-%MINGW_PDCM_VERS% && install -m 0644 curses.h panel.h term.h /mingw/include/pdcurses/" - bash -lc "cd PDCursesMod-%MINGW_PDCM_VERS% && install -m 0644 pdcurses.h /mingw/include/" - - - name: Install LibXML2 - if: steps.restore-msys.outputs.cache-hit != 'true' - run: | - curl -L https://github.com/GNOME/libxml2/archive/refs/tags/v%MINGW_XML2_VERS%.tar.gz -o libxml2-%MINGW_XML2_VERS%.tar.xz - tar -xvf libxml2-%MINGW_XML2_VERS%.tar.xz - bash -lc "cd libxml2-%MINGW_XML2_VERS% && ./autogen.sh" - bash -lc "cd libxml2-%MINGW_XML2_VERS% && ./configure --prefix=/mingw && make" - bash -lc "cd libxml2-%MINGW_XML2_VERS% && make install" - - - 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 MSYS1 cache - 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 - tar -xvf cjson-%MINGW_CJSON_VERS%.tar.xz - copy cjson-%MINGW_CJSON_VERS%\cJSON.* .\libcob - - - name: Bootstrap GnuCOBOL - run: | - sed -i 's/AM_PROG_AR/m4_ifdef\(\[AM_PROG_AR\], \[AM_PROG_AR\]\)/g' .\configure.ac - sed -i 's/po extras doc tests/po extras tests/g' .\Makefile.am - bash -lc "./autogen.sh" - - - name: Configure GnuCOBOL - run: | - mkdir _build - sed -i 'N;s/else/else :;/g' .\configure - sed -i 's/\} else \:;/} else/g' .\configure - sed -i 's/#else \:;/#else/g' .\configure - bash -lc "cd _build && CFLAGS=\"-I ../libcob\" ../configure %CFGOPT% --with-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: ${{ env.GITHUB_WORKSPACE }}/_build/config.log - - - name: Build GnuCOBOL - run: | - bash -lc "cd _build && CPATH=$(pwd)/.. make --jobs=$(($(nproc)+1))" - -# Note: the extra CPATH above is only required in debug builds, for some reason... - - - name: Install GnuCOBOL - run: | - bash -lc "cd _build && make install" - bash -lc "cd _build && find /opt/cobol > install.log" - - - name: Upload install-${{ matrix.target }}.log - uses: actions/upload-artifact@v4 - with: - name: install-${{ matrix.target }}.log - path: ${{ env.GITHUB_WORKSPACE }}/_build/install.log - - - name: Run testsuite - run: | - sed -i '/AT_SETUP(\[temporary path invalid\])/a AT_SKIP_IF(\[true\])' tests/testsuite.src/used_binaries.at - - sed -i '/AT_SETUP(\[Compare FLOAT-LONG with floating-point literal\])/a AT_SKIP_IF(\[true\])' tests/testsuite.src/run_fundamental.at - sed -i '/AT_SETUP(\[Numeric operations (3) PACKED-DECIMAL\])/a AT_SKIP_IF(\[true\])' tests/testsuite.src/run_fundamental.at - sed -i '/AT_SETUP(\[Numeric operations (7)\])/a AT_SKIP_IF(\[true\])' tests/testsuite.src/run_fundamental.at - sed -i '/AT_SETUP(\[integer arithmetic on floating-point var\])/a AT_SKIP_IF(\[true\])' tests/testsuite.src/run_fundamental.at - sed -i '/AT_SETUP(\[FLOAT-DECIMAL w\/o SIZE ERROR\])/a AT_SKIP_IF(\[true\])' tests/testsuite.src/run_misc.at - sed -i '/AT_SETUP(\[FLOAT-SHORT \/ FLOAT-LONG w\/o SIZE ERROR\])/a AT_SKIP_IF(\[true\])' tests/testsuite.src/run_misc.at - sed -i '/AT_SETUP(\[FLOAT-LONG with SIZE ERROR\])/a AT_SKIP_IF(\[true\])' tests/testsuite.src/run_misc.at - sed -i '/AT_SETUP(\[FUNCTION ANNUITY\])/a AT_SKIP_IF(\[true\])' tests/testsuite.src/run_functions.at - sed -i '/AT_SETUP(\[FUNCTION INTEGER\])/a AT_SKIP_IF(\[true\])' tests/testsuite.src/run_functions.at - sed -i '/AT_SETUP(\[FUNCTION MOD (valid)\])/a AT_SKIP_IF(\[true\])' tests/testsuite.src/run_functions.at - sed -i '/AT_SETUP(\[FUNCTION SECONDS-FROM-FORMATTED-TIME\])/a AT_SKIP_IF(\[true\])' tests/testsuite.src/run_functions.at - sed -i '/AT_SETUP(\[GCOS floating-point usages\])/a AT_SKIP_IF(\[true\])' tests/testsuite.src/run_extensions.at - sed -i '/AT_SETUP(\[BINARY: 64bit unsigned arithmetic notrunc\])/a AT_SKIP_IF(\[true\])' tests/testsuite.src/data_binary.at - sed -i '/AT_SETUP(\[DISPLAY: ADD and SUBTRACT w\/o SIZE ERROR\])/a AT_SKIP_IF(\[true\])' tests/testsuite.src/data_display.at - sed -i '/AT_SETUP(\[DISPLAY: ADD and SUBTRACT, all ROUNDED MODEs\])/a AT_SKIP_IF(\[true\])' tests/testsuite.src/data_display.at - sed -i '/AT_SETUP(\[BCD ADD and SUBTRACT w\/o SIZE ERROR\])/a AT_SKIP_IF(\[true\])' tests/testsuite.src/data_packed.at - sed -i '/AT_SETUP(\[BCD ADD and SUBTRACT, all ROUNDED MODEs\])/a AT_SKIP_IF(\[true\])' tests/testsuite.src/data_packed.at - - bash -lc "cd _build/tests && CPATH=/opt/cobol/gnucobol/include make check TESTSUITEFLAGS=\"--jobs=$(($(nproc)+1))\"" - -# Note: the extra CPATH above is only required in debug builds, for some reason... - -# The NIST testsuite hangs forever in IF -# bash -lc "CPATH=/opt/cobol/gnucobol/include make test" - - - name: Upload testsuite-${{ matrix.target }}.log - uses: actions/upload-artifact@v4 - if: failure() - with: - name: testsuite-${{ matrix.target }}.log - path: ${{ env.GITHUB_WORKSPACE }}/_build/tests/testsuite.log - - - name: Package GnuCOBOL - run: | - bash -lc "cd _build && make distmingw" - - - name: Upload GnuCOBOL_mingw-${{ matrix.target }} - uses: actions/upload-artifact@v4 - with: - name: GnuCOBOL_mingw-${{ matrix.target }} - path: ${{ env.GITHUB_WORKSPACE }}/_build/${{ env.DISTDIR }} diff --git a/.github/workflows/windows-msys2.yml b/.github/workflows/windows-msys2.yml index 59ba117b5..e33dc95d2 100644 --- a/.github/workflows/windows-msys2.yml +++ b/.github/workflows/windows-msys2.yml @@ -1,45 +1,112 @@ name: Windows MSYS2 Workflow on: - pull_request: - branches: [ gcos4gnucobol-3.x ] + # pull_request: + # branches: [ gcos4gnucobol-3.x ] push: # manual run in actions tab - for all branches workflow_dispatch: jobs: + prepare: + runs-on: windows-latest + timeout-minutes: 30 + + steps: + + - name: Set git user + run: | + git config --global user.name github-actions + git config --global user.email github-actions-bot@users.noreply.github.com + + - name: Checkout code + uses: actions/checkout@v4 + + # - name: Setup environment + # run: | + # echo GITHUB_WORKSPACE=$env:GITHUB_WORKSPACE >> $env:GITHUB_ENV + + - name: Install packages + uses: msys2/setup-msys2@v2 + with: + update: true + msystem: mingw64 + install: autoconf automake libtool make flex bison help2man texinfo texinfo-tex + mingw-w64-x86_64-cc + mingw-w64-x86_64-gmp + mingw-w64-x86_64-gettext-runtime gettext-devel + + - name: Bootstrap GnuCOBOL + shell: msys2 {0} + run: | + ./build_aux/bootstrap install + + - name: Configure GnuCOBOL + shell: msys2 {0} + run: | + mkdir _build + cd _build + ../configure --without-db --without-curses --without-xml2 --without-json + + - name: Build GnuCOBOL Source Distribution + shell: msys2 {0} + run: | + make -C _build --jobs=$(($(nproc)+1)) + make -C _build --jobs=$(($(nproc)+1)) dist + + - name: Upload config-dist.log + uses: actions/upload-artifact@v4 + if: ${{ ! cancelled() }} #-> always upload as build result documentation + with: + name: config-dist.log + path: _build/config.log + + - name: Upload dist tarball + uses: actions/upload-artifact@v4 + with: + name: gnucobol-ci source distribution msys2 + path: _build/gnucobol*.tar.gz + if-no-files-found: error + retention-days: 1 + build: strategy: fail-fast: false matrix: include: - - { os: windows-latest, target: release, sys: mingw64, env: x86_64 } - - { os: windows-latest, target: debug, sys: mingw64, env: x86_64 } - - { os: windows-latest, target: debug, sys: ucrt64, env: ucrt-x86_64 } - - { os: windows-latest, target: debug, sys: clang64, env: clang-x86_64 } - # - { target: debug, sys: mingw32, env: i686 } - runs-on: ${{matrix.os}} + - { target: release, sys: mingw64, env: x86_64 } + - { target: debug, sys: mingw64, env: x86_64 } + - { target: debug, sys: ucrt64, env: ucrt-x86_64 } + - { target: debug, sys: clang64, env: clang-x86_64 } + - { target: debug, sys: mingw32, env: i686 } + runs-on: windows-latest, + needs: build timeout-minutes: 45 steps: - - name: Set git user + - name: Install packages run: | - git config --global user.name github-actions - git config --global user.email github-actions-bot@users.noreply.github.com + sudo apt -y update + sudo apt -y install build-essential libgmp-dev + sudo apt -y remove bison flex - - name: Checkout code - uses: actions/checkout@v4 + - name: Get CI dist tarball + uses: actions/download-artifact@v4 + with: + name: gnucobol-ci source distribution - - name: Setup environment + - name: Build environment setup run: | - echo GITHUB_WORKSPACE=$env:GITHUB_WORKSPACE >> $env:GITHUB_ENV + tar -xvf gnucobol*.tar.* --strip-components=1 + mkdir _build + # echo GITHUB_WORKSPACE=$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 CFGOPT="--with-pkgversion=GnuCOBOL-CI-MSYS2" >> $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 + echo CFGOPT="--with-pkgversion=GnuCOBOL-CI-MSYS2-debug --enable-debug --enable-cobc-internal-checks --enable-hardening" >> $env:GITHUB_ENV } - name: Install packages @@ -47,38 +114,32 @@ jobs: with: update: true msystem: ${{matrix.sys}} - install: autoconf automake libtool make flex bison help2man texinfo + install: make mingw-w64-${{matrix.env}}-cc - mingw-w64-${{matrix.env}}-gmp gmp-devel - mingw-w64-${{matrix.env}}-gettext-runtime gettext-devel + mingw-w64-${{matrix.env}}-gmp + mingw-w64-${{matrix.env}}-gettext-runtime mingw-w64-${{matrix.env}}-ncurses mingw-w64-${{matrix.env}}-libxml2 mingw-w64-${{matrix.env}}-cjson - mingw-w64-${{matrix.env}}-db libdb-devel - - - name: Bootstrap GnuCOBOL - shell: msys2 {0} - run: | - ./build_aux/bootstrap install + mingw-w64-${{matrix.env}}-db - name: Configure GnuCOBOL shell: msys2 {0} run: | - mkdir _build cd _build ../configure $CFGOPT --with-db --prefix=/opt/cobol/gnucobol + - name: Build GnuCOBOL + shell: msys2 {0} + run: | + make -C _build --jobs=$(($(nproc)+1)) + - name: Upload config-${{matrix.sys}}-${{matrix.target}}.log uses: actions/upload-artifact@v4 if: failure() with: name: config-${{matrix.sys}}-${{matrix.target}}.log - path: ${{ env.GITHUB_WORKSPACE }}/_build/config.log - - - name: Build GnuCOBOL - shell: msys2 {0} - run: | - make -C _build --jobs=$(($(nproc)+1)) + path: _build/config.log - name: Cache newcob.val uses: actions/cache@v4 @@ -88,39 +149,52 @@ jobs: save-always: true enableCrossOsArchive: true + - name: Run NIST85 testsuite + shell: msys2 {0} + run: | + make -C _build/tests test --jobs=$(($(nproc)+1)) TESTSUITEFLAGS="--jobs=$(($(nproc)+1))" + + - name: Upload NIST85 Test Suite results + if: ${{ ! cancelled() }} #-> always upload as build result documentation + uses: actions/upload-artifact@v4 + with: + name: NIST85 results on ${{ matrix.target }} + path: | + _build/tests/cobol85/summary.* + _build/tests/cobol85/**/*.log + _build/tests/cobol85/**/*.out + _build/tests/cobol85/**/duration.txt + - name: Run testuite shell: msys2 {0} run: | - sed '/AT_SETUP(\[temporary path invalid\])/a \ - AT_SKIP_IF(\[true\])' \ - -i tests/testsuite.src/used_binaries.at - make -C _build/tests checkall \ - --jobs=$(($(nproc)+1)) \ - TESTSUITEFLAGS="--jobs=$(($(nproc)+1))" || \ - make -C _build/tests check \ - TESTSUITEFLAGS="--recheck --verbose" + # skip test as it sometimes works and sometimes not... + # instead of + # sed -i '/AT_SETUP(\[temporary path invalid\])/a AT_SKIP_IF(\[true\])' tests/testsuite.src/used_binaries.at + # use + sed -i '/used_binaries/{N;/temporary path invalid/{N;N;N;N;s/traceon/traceon; echo "workflow:1" >"$at_check_line_file"; at_fn_check_skip 77/;}}' tests/testsuite + + # to work around regular hangs we run NIST first, then the internal + # and the later only with 2 jobs + make -C _build/tests check TESTSUITEFLAGS="--jobs=2" || \ + make -C _build/tests check TESTSUITEFLAGS="--recheck --verbose" - name: Upload testsuite-${{matrix.sys}}-${{matrix.target}}.log uses: actions/upload-artifact@v4 - if: failure() + if: ${{ ! cancelled() }} #-> always upload as build result documentation with: name: testsuite-${{matrix.sys}}-${{matrix.target}}.log - path: ${{ env.GITHUB_WORKSPACE }}/_build/tests/testsuite.log + path: _build/tests/testsuite.log - - name: Package GnuCOBOL + - name: Package GnuCOBOL MinGW nightly shell: msys2 {0} run: | make -C _build distmingw - - - name: Tar GnuCOBOL_mingw-${{matrix.sys}}-${{matrix.target}} - shell: msys2 {0} - run: | - cd _build - tar -cvf ../GnuCOBOL_mingw-${{matrix.sys}}-${{matrix.target}}.tar \ - "${{ env.DISTDIR }}" + tar -cvf GnuCOBOL_msys2-${{matrix.sys}}-${{matrix.target}}.tar \ + _build/"${{ env.DISTDIR }}" - name: Upload GnuCOBOL_mingw-${{matrix.sys}}-${{matrix.target}}.tar uses: actions/upload-artifact@v4 with: - name: GnuCOBOL_mingw-${{matrix.sys}}-${{matrix.target}}.tar - path: GnuCOBOL_mingw-${{matrix.sys}}-${{matrix.target}}.tar + name: GnuCOBOL_msys2-${{matrix.sys}}-${{matrix.target}}.tar + path: GnuCOBOL_msys2-${{matrix.sys}}-${{matrix.target}}.tar