From 94607879f7c84776d22ac7f327e64b6826e798dd Mon Sep 17 00:00:00 2001 From: Simon Sobisch Date: Mon, 30 Sep 2024 10:23:54 +0000 Subject: [PATCH] ci adjustments * ubuntu: * only run coverage and additional warnings when main ci build works - use its generated tarball * trigger MSYS1 build, passing the run-id (needs to be adjusted to a "pull" later * msys1+ubuntu: * use "build" instead of "_build" * upload config.log after the build - because we may need it to debug build issues * always upload the testsuite.log (additional build documentation) * msys1: * drop GC install log and therefore extra prefix * building BDB with all relevant patches from MSYS2 * GMP url changes, building it again for performance reasons * using msys-build instead of building Bison (only necessary for GC4) * enable NIST85, skipping extra IF106A as this hangs, ignoring failing NIST for now * ci cache adjustment: * remove split per matrix * split per software, enabling smaller updates * use CI tarball like for the minimal build --- .github/workflows/ubuntu.yml | 157 +++++++----- .github/workflows/windows-msys1.yml | 361 +++++++++++++++++++--------- 2 files changed, 337 insertions(+), 181 deletions(-) diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 1a3df6462..1722ce140 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -55,67 +55,67 @@ jobs: # - name: Build environment setup run: | - mkdir _build + mkdir build export TERM="vt100" echo "TERM=$TERM" >> $GITHUB_ENV echo "INSTALL_PATH=$(pwd)/_install" >> $GITHUB_ENV - name: Configure run: | - cd _build + 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: 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 - - - name: Build - run: | - make -C _build --jobs=$(($(nproc)+1)) + path: build/config.log # note: distcheck also creates the dist tarball - name: Build distribution archive & run tests run: | - make -C _build distcheck \ + make -C build distcheck \ TESTSUITEFLAGS="--jobs=$(($(nproc)+1))" \ --jobs=$(($(nproc)+1)) || \ - make -C _build/gnucobol-$VERSION/_build/sub/tests check \ + make -C build/gnucobol-$VERSION/build/sub/tests check \ TESTSUITEFLAGS="--recheck --verbose" - name: Upload testsuite.log uses: actions/upload-artifact@v4 - if: failure() + # if: failure() -> always upload as build result documentation with: - # Assume there's only one directory matching `_build/gnucobol-*`: + # 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 + 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* + 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 + 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 \ + make -C build/tests/cobol85 EXEC85 test \ --jobs=$(($(nproc)+1)) - name: Upload NIST85 Test Suite results @@ -123,10 +123,39 @@ jobs: 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 + build/tests/cobol85/summary.* + build/tests/cobol85/**/*.log + build/tests/cobol85/**/*.out + build/tests/cobol85/**/duration.txt + + trigger-more-workflows: + runs-on: ubuntu-latest + needs: build + steps: + - name: Get current workflow run ID + run: echo "RUN_ID=$GITHUB_RUN_ID" >> $GITHUB_ENV + + - name: Get the Current Branch + id: get_branch + run: | + # If the workflow was triggered by a pull request + if [ "${{ github.event.workflow_run.head_branch }}" ]; then + echo "BRANCH=${{ github.event.workflow_run.head_branch }}" >> $GITHUB_ENV + else + # Extract the branch name from ref (for push events) + echo "BRANCH=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV + fi + + - name: Trigger additional Workflows via API + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + BRANCH: ${{ env.BRANCH }} + run: | + curl -X POST \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer $GITHUB_TOKEN" \ + https://api.github.com/repos/${{ github.repository }}/actions/workflows/windows-msys1.yml/dispatches \ + -d '{"ref":"'"$BRANCH"'", "inputs": {"run_id": "'"${{ github.run_id }}"'"}}' minmal_build: name: Build and test with minimal dependencies @@ -152,50 +181,50 @@ jobs: - name: Build environment setup run: | tar -xvf gnucobol*.tar.* --strip-components=1 - mkdir _build + mkdir build - name: Configure run: | - cd _build + 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 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)) + path: build/config.log - name: run internal tests run: | - make -C _build check TESTSUITEFLAGS="--jobs=$(($(nproc)+1))" || \ - make -C _build check TESTSUITEFLAGS="--recheck --verbose" + 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() + # if: failure() -> always upload as build result documentation with: name: testsuite-${{ matrix.os }}-${{ github.job }}.log - path: _build/tests/testsuite.log + path: build/tests/testsuite.log - name: Cache newcob.val uses: actions/cache@v4 with: - path: _build/tests/cobol85/newcob.val + 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 \ + make -C build/tests/cobol85 EXEC85 test \ --jobs=$(($(nproc)+1)) - name: Upload NIST85 Test Suite results @@ -203,33 +232,34 @@ jobs: 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 + 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 - # 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 + sudo apt-get install libdb5.3-dev libxml2-dev libcjson-dev lcov - - name: Bootstrap - run: | - ./build_aux/bootstrap + - name: Get CI dist tarball + uses: actions/download-artifact@v4 + with: + name: gnucobol-ci source distribution - name: Build environment setup run: | - mkdir _build + tar -xvf gnucobol*.tar.* --strip-components=1 + mkdir build export TERM="vt100" echo "TERM=$TERM" >> $GITHUB_ENV @@ -239,72 +269,73 @@ jobs: # TODO: try and pass -pedantic via CPPFLAGS - name: Configure run: | - cd _build + 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 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)) + path: build/config.log - name: Coverage run: | - # make -C _build check-code-coverage # <- (ignores errors) - make -C _build check \ + # 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" + make -C build code-coverage-capture \ + CODE_COVERAGE_DIRECTORY="$(realpath .)/build" - name: Upload testsuite.log uses: actions/upload-artifact@v4 - if: failure() + # if: failure() -> always upload as build result documentation with: name: testsuite-${{ matrix.os }}-${{ github.job }}.log - path: _build/tests/testsuite.log + path: build/tests/testsuite.log - name: Upload coverage report uses: actions/upload-artifact@v4 with: name: coverage - path: _build/GnuCOBOL-**-coverage + path: build/GnuCOBOL-**-coverage - name: Cache newcob.val uses: actions/cache@v4 with: - path: _build/tests/cobol85/newcob.val + 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 \ + make -C build/tests/cobol85 EXEC85 test \ --jobs=$(($(nproc)+1)) \ --keep-going - make -C _build code-coverage-capture \ + make -C build code-coverage-capture \ CODE_COVERAGE_OUTPUT_DIRECTORY=extended-coverage \ CODE_COVERAGE_OUTPUT_FILE=extended-coverage.info \ - CODE_COVERAGE_DIRECTORY="$(realpath .)/_build" + CODE_COVERAGE_DIRECTORY="$(realpath .)/build" - name: Upload extended coverage report uses: actions/upload-artifact@v4 with: name: extended-coverage - path: _build/extended-coverage + path: build/extended-coverage - name: Upload coverage to codecov - uses: codecov/codecov-action@v2 + uses: codecov/codecov-action@v3 with: # token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos - directory: _build + 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-msys1.yml b/.github/workflows/windows-msys1.yml index 67f3801c6..1afd06c9c 100644 --- a/.github/workflows/windows-msys1.yml +++ b/.github/workflows/windows-msys1.yml @@ -1,24 +1,25 @@ name: Windows MSYS1 Workflow on: - pull_request: - branches: [ gcos4gnucobol-3.x ] - push: - # manual run in actions tab - for all branches workflow_dispatch: + inputs: + run_id: + description: 'The run ID of the workflow providing the CI tarball' + required: true env: MSYS_ROOT: C:\MinGW MSYS_BIN: C:\MinGW\msys\1.0\bin - BISON_PKGDATADIR: C:\MinGW\share\bison + #BISON_PKGDATADIR: C:\MinGW\share\bison M4: m4 MSYSTEM: MINGW32 - MSYSPKGS: msys-m4 msys-flex msys-coreutils msys-help2man - - MINGW_BISON_VERS: bison-3.0.1 - MINGW_GMP_VERS: gmp-6.3.0 + MSYSPKGS: msys-m4 msys-flex msys-coreutils msys-help2man msys-bison msys-patch + # GC4+: + #MSYSPKGS: msys-m4 msys-flex msys-coreutils msys-help2man + #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 @@ -33,25 +34,39 @@ jobs: strategy: fail-fast: false matrix: - os: - - windows-latest - arch: - - x86 target: - debug - release - runs-on: ${{ matrix.os }} + runs-on: windows-latest timeout-minutes: 45 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: 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: Get CI dist tarball + uses: actions/download-artifact@v4 + with: + name: gnucobol-ci source distribution + run-id: ${{ github.event.inputs.run_id }} + github-token: ${{ secrets.GITHUB_TOKEN }} + + #- name: Display structure of downloaded files + # run: ls -R - - name: Checkout code - uses: actions/checkout@v4 + - name: Build environment setup + run: | + bash -lc "tar -xvf gnucobol*.tar.* --strip-components=1" + mkdir build + rem sed -i 'N;s/else/else :;/g' .\configure + rem sed -i 's/\} else \:;/} else/g' .\configure + rem sed -i 's/#else \:;/#else/g' .\configure - name: Setup environment shell: pwsh @@ -67,61 +82,147 @@ jobs: 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 }} + 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 MinGW-bkup02.7z -o%MSYS_ROOT%\ + 7z x -y 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 + - name: Cleanup MSYS1 env 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" + rmdir /Q /S %MSYS_ROOT%\docs + rmdir /Q /S %MSYS_ROOT%\var + del /Q %MSYS_ROOT%\bin\gdb.exe - # Note: actually unavailable, so skip (works with the GMP alredy provided) - # - name: Install GMP - # if: steps.restore-msys.outputs.cache-hit != 'true' + - 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://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" + # 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 BDB - if: steps.restore-msys.outputs.cache-hit != 'true' + # - 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 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' + run: | + rem note: MSYS1 cannot connect to https://gmplib.org, so using GNU mirror side instead + curl -L https://ftp.gnu.org/gnu/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 --jobs=$(($(nproc)+1))" + + - name: Install GMP + run: | + bash -lc "make -C %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/%MINGW_BDB_VERS%.tar.gz -o %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 %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" + sed -i 's/_tcsclen/_mbslen/' %MINGW_BDB_VERS%\src\os_windows\os_stat.c + bash -lc "cd %MINGW_BDB_VERS% && patch -p1 -i ../db-tls-m4-fix-pthread.patch" + bash -lc "cd %MINGW_BDB_VERS% && patch -p1 -i ../mingw.patch" + bash -lc "cd %MINGW_BDB_VERS% && patch -p1 -i ../cx11.patch" + bash -lc "cd %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 PDCurses - if: steps.restore-msys.outputs.cache-hit != 'true' + - name: Install BDB + run: | + bash -lc "make -C %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 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' 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\"" + bash -lc "cd PDCursesMod-%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-%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-%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\"" echo #define CHTYPE_64 > PDCursesMod-%MINGW_PDCM_VERS%\pdcurses.h - echo #define PDC_DLL_BUILD >> PDCursesMod-%MINGW_PDCM_VERS%\pdcurses.h + echo #define PDC_DLLbuild >> PDCursesMod-%MINGW_PDCM_VERS%\pdcurses.h echo #include "pdcurses/curses.h" >> PDCursesMod-%MINGW_PDCM_VERS%\pdcurses.h + + - name: Install PDCursesMod + run: | 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" @@ -131,115 +232,139 @@ jobs: 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' + - 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: 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%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" + bash -lc "cd libxml2-%MINGW_XML2_VERS% && ./configure --prefix=/mingw --enable-debug && make --jobs=$(($(nproc)+1))" - - name: Cleanup MSYS1 env - if: steps.restore-msys.outputs.cache-hit != 'true' + - name: Install LibXML2 run: | - rmdir /Q /S %MSYS_ROOT%\docs - rmdir /Q /S %MSYS_ROOT%\var - del /Q %MSYS_ROOT%\bin\gdb.exe + bash -lc "make -C libxml2-%MINGW_XML2_VERS% install" - - name: Save MSYS1 cache - if: steps.restore-msys.outputs.cache-hit != 'true' + - name: Save LibXML2 cache + if: steps.restore-xml2.outputs.cache-hit != 'true' uses: actions/cache/save@v4 with: - key: cache-msys-${{ matrix.target }} - path: ${{ env.MSYS_ROOT }} + key: cache-msys-xml2 + path: libxml2-${{ env.MINGW_XML2_VERS }} - - 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 + - name: get cJSON 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" + curl -L https://raw.githubusercontent.com/DaveGamble/cJSON/v%MINGW_CJSON_VERS%/cJSON.c -o .\libcob\cJSON.c + curl -L https://raw.githubusercontent.com/DaveGamble/cJSON/v%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 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" + rem mkdir build + rem sed -i 'N;s/else/else :;/g' .\configure + rem sed -i 's/\} else \:;/} else/g' .\configure + rem sed -i 's/#else \:;/#else/g' .\configure + rem extra setting CPPFLAGS as " are wrong here + bash -lc "cd build && ../configure CPPFLAGS=\"-I../libcob\" %CFGOPT% --with-db --with-xml2 --with-json=local --with-curses=pdcurses --prefix=/mingw" + + - name: Build GnuCOBOL + run: | + rem Note: the extra CPATH below is only required in debug builds (otherwise gcc invoked from cobc does not find libcob.h [pre-inst-env]), for some reason... + bash -lc "CPATH=$(pwd) make -C build --jobs=$(($(nproc)+1))" + +# Note: the extra CPATH above is only required in debug builds (otherwise "extras" does not build), for some reason... - 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 + 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 + - name: Run testsuite run: | - bash -lc "cd _build && make install" - bash -lc "cd _build && find /opt/cobol > install.log" + sed -i '/AT_SETUP(\[temporary path invalid\])/a AT_XFAIL_IF(\[true\])' tests/testsuite.src/used_binaries.at + + sed -i '/AT_SETUP(\[Compare FLOAT-LONG with floating-point literal\])/a AT_XFAIL_IF(\[true\])' tests/testsuite.src/run_fundamental.at + sed -i '/AT_SETUP(\[Numeric operations (3) PACKED-DECIMAL\])/a AT_XFAIL_IF(\[true\])' tests/testsuite.src/run_fundamental.at + sed -i '/AT_SETUP(\[Numeric operations (7)\])/a AT_XFAIL_IF(\[true\])' tests/testsuite.src/run_fundamental.at + sed -i '/AT_SETUP(\[integer arithmetic on floating-point var\])/a AT_XFAIL_IF(\[true\])' tests/testsuite.src/run_fundamental.at + sed -i '/AT_SETUP(\[FLOAT-DECIMAL w\/o SIZE ERROR\])/a AT_XFAIL_IF(\[true\])' tests/testsuite.src/run_misc.at + sed -i '/AT_SETUP(\[FLOAT-SHORT \/ FLOAT-LONG w\/o SIZE ERROR\])/a AT_XFAIL_IF(\[true\])' tests/testsuite.src/run_misc.at + sed -i '/AT_SETUP(\[FLOAT-LONG with SIZE ERROR\])/a AT_XFAIL_IF(\[true\])' tests/testsuite.src/run_misc.at + sed -i '/AT_SETUP(\[FUNCTION ANNUITY\])/a AT_XFAIL_IF(\[true\])' tests/testsuite.src/run_functions.at + sed -i '/AT_SETUP(\[FUNCTION INTEGER\])/a AT_XFAIL_IF(\[true\])' tests/testsuite.src/run_functions.at + sed -i '/AT_SETUP(\[FUNCTION MOD (valid)\])/a AT_XFAIL_IF(\[true\])' tests/testsuite.src/run_functions.at + sed -i '/AT_SETUP(\[FUNCTION SECONDS-FROM-FORMATTED-TIME\])/a AT_XFAIL_IF(\[true\])' tests/testsuite.src/run_functions.at + sed -i '/AT_SETUP(\[GCOS floating-point usages\])/a AT_XFAIL_IF(\[true\])' tests/testsuite.src/run_extensions.at + sed -i '/AT_SETUP(\[BINARY: 64bit unsigned arithmetic notrunc\])/a AT_XFAIL_IF(\[true\])' tests/testsuite.src/data_binary.at + sed -i '/AT_SETUP(\[DISPLAY: ADD and SUBTRACT w\/o SIZE ERROR\])/a AT_XFAIL_IF(\[true\])' tests/testsuite.src/data_display.at + sed -i '/AT_SETUP(\[DISPLAY: ADD and SUBTRACT, all ROUNDED MODEs\])/a AT_XFAIL_IF(\[true\])' tests/testsuite.src/data_display.at + sed -i '/AT_SETUP(\[BCD ADD and SUBTRACT w\/o SIZE ERROR\])/a AT_XFAIL_IF(\[true\])' tests/testsuite.src/data_packed.at + sed -i '/AT_SETUP(\[BCD ADD and SUBTRACT, all ROUNDED MODEs\])/a AT_XFAIL_IF(\[true\])' tests/testsuite.src/data_packed.at + + rem Note: the extra CPATH below is only required in debug builds (otherwise gcc invoked from cobc does not find libcob.h [atlocal]), for some reason... + bash -lc "CPATH=$(pwd) make -C build/tests check TESTSUITEFLAGS=\"--jobs=$(($(nproc)+1))\" || CPATH=$(pwd) make -C build/tests check TESTSUITEFLAGS=\"--recheck --verbose\"" - - name: Upload install-${{ matrix.target }}.log + - name: Upload testsuite-${{ matrix.target }}.log uses: actions/upload-artifact@v4 + # if: failure() -> always upload as build result documentation with: - name: install-${{ matrix.target }}.log - path: ${{ env.GITHUB_WORKSPACE }}/_build/install.log + name: testsuite-${{ matrix.target }}.log + path: ${{ env.GITHUB_WORKSPACE }}/build/tests/testsuite.log - - name: Run testsuite + - 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 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" + rem FIXME: The NIST testsuite hangs forever in IF106A + perl -pi -e 's/^# OBNC1M/\$skip{IF106A} = 1; # OBNC1M/' tests/cobol85/report.pl + rem Note: the extra CPATH below is only required in debug builds (otherwise gcc invoked from cobc does not find libcob.h [atlocal]), for some reason... + bash -lc "CPATH=$(pwd) make -C build/tests test --jobs=$(($(nproc)+1)) || echo \"WARNING: NIST85 did not pass!\"" - - name: Upload testsuite-${{ matrix.target }}.log + - name: Upload NIST85 Test Suite results uses: actions/upload-artifact@v4 - if: failure() with: - name: testsuite-${{ matrix.target }}.log - path: ${{ env.GITHUB_WORKSPACE }}/_build/tests/testsuite.log + 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 run: | - bash -lc "cd _build && make distmingw" + bash -lc "make -C build 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 }} + path: ${{ env.GITHUB_WORKSPACE }}/build/${{ env.DISTDIR }}