From ce769a355cc25af9ebc5a3c308d68004dfbbedc2 Mon Sep 17 00:00:00 2001 From: Fabrice Le Fessant Date: Thu, 11 Jan 2024 23:37:41 +0100 Subject: [PATCH] Additional files for GIT, Autofonce and Github actions --- .autofonce | 35 +++++ .github/workflows/macos.yml | 118 +++++++++++++++ .github/workflows/ubuntu.yml | 204 +++++++++++++++++++++++++ .github/workflows/windows.yml | 93 ++++++++++++ .gitignore | 82 ++++++++++ .gitlab-ci.yml | 13 ++ ChangeLog | 16 ++ README.md | 37 +++++ build_aux/ar-lib | 271 ---------------------------------- tests/autofonce.env.sh | 19 +++ 10 files changed, 617 insertions(+), 271 deletions(-) create mode 100644 .autofonce create mode 100644 .github/workflows/macos.yml create mode 100644 .github/workflows/ubuntu.yml create mode 100644 .github/workflows/windows.yml create mode 100644 .gitignore create mode 100644 .gitlab-ci.yml delete mode 120000 build_aux/ar-lib create mode 100644 tests/autofonce.env.sh diff --git a/.autofonce b/.autofonce new file mode 100644 index 000000000..88a9539a4 --- /dev/null +++ b/.autofonce @@ -0,0 +1,35 @@ +[project] +# name to use to infer config +name = "gnucobol" + +# files used to locate the project top directory +# and to set the AUTOFONCE_SOURCE_DIR +source_anchors = [ "tests/testsuite.at", "!" ] + +# files used to locate the project build directory +# where the _autofonce/ directory will be created +# and to set the AUTOFONCE_BUILD_DIR +# use "!" to trigger an error if build dir is mandatory +build_anchors = [ "cobc/cobc.1", "!" ] + +# paths in project sources that are good candidates to +# be tested as build dirs. Useful to run autofonce +# from outside the build directory +build_dir_candidates = [ "_build" ] + +[testsuites] +# alias = "path-from-topdir" +[testsuites.testsuite] +file = "tests/testsuite.at" +path = [ "tests/testsuite.src"] +env = "testsuite" +[testsuites.nist] +file = "tests/cobol85/nist.at" +path = [ "tests/cobol85/nistrun.src"] +env = "testsuite" + +[envs] +# env_name = """...""" +# env_name = "> $GITHUB_PATH; \ + test -d "$opt/$d/lib" && export LDFLAGS="-L$opt/$d/lib $LDFLAGS"; \ + test -d "$opt/$d/include" && export CPPFLAGS="-I$opt/$d/include $CPPFLAGS"; \ + done; \ + echo "LDFLAGS=${LDFLAGS}" >> $GITHUB_ENV; \ + echo "CPPFLAGS=${CPPFLAGS}" >> $GITHUB_ENV + + - 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: bootstrap + run: | + ./autogen.sh + autoconf + autoreconf --install --force + + - name: Build environment setup + run: | + mkdir _build + echo "NPROC=`sysctl -n hw.ncpu`" >> $GITHUB_ENV + export TERM="vt100" + echo "TERM=$TERM" >> $GITHUB_ENV + + - name: configure + run: | + cd _build + ../configure --enable-cobc-internal-checks --enable-hardening --prefix /opt/cobol/gnucobol-gcos --exec-prefix /opt/cobol/gnucobol-gcos + + - name: Upload config.log + uses: actions/upload-artifact@v3 + with: + name: config.log + path: _build/config.log +# if: failure() + + - name: make + run: | + cd _build + make --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 + - name: make install + run: | + cd _build + sudo make install + find /opt/cobol > install.log + + - name: Upload install.log + uses: actions/upload-artifact@v3 + with: + name: install.log + path: _build/install.log + + - name: check + run: | + cd _build + make check TESTSUITEFLAGS="--jobs=$((${NPROC}+1))" + + - name: Upload testsuite.log + uses: actions/upload-artifact@v3 + if: failure() + with: + name: testsuite.log + path: _build/tests/testsuite.log + + - name: Cache newcob.val.Z + uses: actions/cache@v3 + id: newcob + with: + path: _build/tests/cobol85/newcob.val.Z.cached + key: newcob + + - name: Download newcob.val.Z + if: steps.newcob.outputs.cache-hit != 'true' + run: | + cd _build/tests/cobol85 + make newcob.val.Z + ln -f newcob.val.Z newcob.val.Z.cached + + - name: NIST85 Test Suite + run: | + cd _build/tests/cobol85 + ln -f newcob.val.Z.cached newcob.val.Z + make EXEC85 && make --jobs=$(($(nproc)+1)) test diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml new file mode 100644 index 000000000..352b6282f --- /dev/null +++ b/.github/workflows/ubuntu.yml @@ -0,0 +1,204 @@ +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 + include: + - os: ubuntu-latest + skip_test: true + + runs-on: ${{ matrix.os }} + + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - name: Checkout code + uses: actions/checkout@v3 + + - 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 + + - 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@v3 + if: failure() + with: + name: config.log + path: _build/config.log + + - name: make + run: | + cd _build + make --jobs=$(($(nproc)+1)) + + # - name: check + # run: | + # cd _build + # make check TESTSUITEFLAGS="--jobs=$(($(nproc)+1))" + + # note: distcheck also creates the dist tarball + - name: distcheck + run: | + cd _build + make --jobs=$(($(nproc)+1)) distcheck TESTSUITEFLAGS="--jobs=$(($(nproc)+1))" + + - name: Upload testsuite.log + uses: actions/upload-artifact@v3 + if: failure() + with: + # Assume there's only one directory matching `_build/gnucobol-*`: + name: testsuite.log + path: _build/gnucobol-${{ env.VERSION }}/_build/sub/tests/testsuite.log + + - name: Upload dist tarball + uses: actions/upload-artifact@v3.1.0 + with: + name: gnucobol-ci source distribution + path: _build/gnucobol*.tar* + if-no-files-found: error + retention-days: 0 + + - name: Cache newcob.val.Z + uses: actions/cache@v3 + id: newcob + with: + path: _build/tests/cobol85/newcob.val.Z.cached + key: newcob + + - name: Download newcob.val.Z + if: steps.newcob.outputs.cache-hit != 'true' + run: | + cd _build/tests/cobol85 + make newcob.val.Z + ln -f newcob.val.Z newcob.val.Z.cached + + - name: NIST85 Test Suite + run: | + cd _build/tests/cobol85 + ln -f newcob.val.Z.cached newcob.val.Z + make EXEC85 && make --jobs=$(($(nproc)+1)) test + + - uses: actions/upload-artifact@v3 + with: + name: NIST85 results + path: | + _build/tests/cobol85/**/*.log + _build/tests/cobol85/**/*.out + + - name: install + run: | + cd _build + make install + + + coverage: + name: Coverage and Warnings + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + # 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: w add additional C compiler syntax checks here to not need _another_ CI run + - name: configure + run: | + cd _build + ../configure --enable-code-coverage CPPFLAGS="-Werror=declaration-after-statement" + + - uses: actions/upload-artifact@v3 + if: failure() + with: + name: config.log + path: _build/config.log + + - name: make + run: | + cd _build + make --jobs=$(($(nproc)+1)) + + - name: coverage + run: | + cd _build + make check-code-coverage TESTSUITEFLAGS="--jobs=$(($(nproc)+1))" + + - uses: actions/upload-artifact@v3 + if: failure() + with: + name: testsuite.log + path: _build/tests/testsuite.log + + - uses: actions/upload-artifact@v3 + with: + name: coverage + path: _build/GnuCOBOL-**-coverage/ + + - 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.yml b/.github/workflows/windows.yml new file mode 100644 index 000000000..e238d741a --- /dev/null +++ b/.github/workflows/windows.yml @@ -0,0 +1,93 @@ +name: Windows Workflow + +on: + pull_request: + branches: [ gcos4gnucobol-3.x ] + push: + branches: [ gcos4gnucobol-3.x ] + # manual run in actions tab - for all branches + # workflow_dispatch: + +jobs: + build: + strategy: + fail-fast: false + matrix: + os: + - windows-latest + + runs-on: ${{ matrix.os }} + + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - name: Checkout code + uses: actions/checkout@v3 + + - name: Install packages + uses: msys2/setup-msys2@v2 + with: + update: true + install: autoconf automake libtool make mingw-w64-x86_64-db mingw-w64-x86_64-gmp libdb-devel mingw-w64-x86_64-gcc flex bison gmp-devel help2man texinfo gettext-devel + + - 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: bootstrap + run: | + ./autogen.sh + autoconf + autoreconf --install --force + shell: msys2 {0} + + - name: Build environment setup + run: | + mkdir _build + shell: msys2 {0} + + - name: configure + run: | + cd _build + ../configure --enable-cobc-internal-checks --enable-hardening --prefix /opt/cobol/gnucobol-gcos --exec-prefix /opt/cobol/gnucobol-gcos + shell: msys2 {0} + + - name: Upload config.log + uses: actions/upload-artifact@v3 + if: failure() + with: + name: config.log + path: _build/config.log + + - name: make + run: | + cd _build + make --jobs=$(($(nproc)+1)) + shell: msys2 {0} + + - name: install + run: | + cd _build + make install + find /opt/cobol > install.log + shell: msys2 {0} + + - name: Upload install.log + uses: actions/upload-artifact@v3 + with: + name: install.log + path: _build/install.log + + - name: check + continue-on-error: true + run: | + cd _build/tests + make check TESTSUITEFLAGS="--jobs=$(($(nproc)+1))" || (echo "not all tests passed") + make test + shell: msys2 {0} + + - name: Upload testsuite.log + uses: actions/upload-artifact@v3 + with: + name: testsuite.log + path: _build/tests/testsuite.log diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..8e2ee8661 --- /dev/null +++ b/.gitignore @@ -0,0 +1,82 @@ +*~ +*.la +.libs +*.lo +*.o +*.so + +.deps +Makefile.in + +/aclocal.m4 +/aminclude_static.am +/autom4te.cache +/bin/cob-config +/bin/cob-config.1 +/bin/cobcrun +/bin/cobcrun.1 +/bin/cobfile +/bin/gcdiff +/_build +/cobc/cobc +/cobc/cobc.1 +/cobc/parser.c +/cobc/parser.h +/cobc/parser.output +/cobc/pplex.c +/cobc/ppparse.c +/cobc/ppparse.h +/cobc/scanner.c +/config.h +/config.h.in +/config.log +/config.status +/configure +/doc/cbchelp.tex +/doc/cbconf.tex +/doc/cbexceptions.tex +/doc/cbhelp.tex +/doc/cbintr.tex +/doc/cbmnem.tex +/doc/cbrese.tex +/doc/cbrunt.tex +/doc/cbsyst.tex +/doc/gnucobol.info +/doc/stamp-vti +/doc/version.texi +/libtool +/Makefile +/po/en@boldquot.po +/po/en@quot.po +/po/*.gmo +/po/POTFILES +/pre-inst-env +/stamp-h1 +/tarstamp.h +/tests/atconfig +/tests/atlocal +/tests/cobol85/copy/ +/tests/cobol85/copyalt/ +/tests/cobol85/DB/ +/tests/cobol85/EXEC85 +/tests/cobol85/EXEC85.cob +/tests/cobol85/IC/ +/tests/cobol85/IF/ +/tests/cobol85/IX/ +/tests/cobol85/NC/ +/tests/cobol85/newcob.val +/tests/cobol85/OB/ +/tests/cobol85/RL/ +/tests/cobol85/RW/ +/tests/cobol85/SG/ +/tests/cobol85/SM/ +/tests/cobol85/SQ/ +/tests/cobol85/ST/ +/tests/cobol85/summary.log +/tests/package.m4 +/tests/run_prog_manual.sh +/tests/testsuite +/tests/testsuite.dir/ +/tests/testsuite.log +/tests/testsuite_manual +/build_aux/ar-lib diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 000000000..cd8e2acad --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,13 @@ +build: + stage: build + image: registry.ocamlpro.com/ocamlpro/ocaml-docker-images:4.12 + before_script: + - sudo apk add --upgrade --no-cache make patch gcc curl coreutils musl-dev opam git gmp-dev pkgconf libressl-dev emacs cmake g++ boost boost-dev boost-static autoconf automake libtool help2man texinfo bison make gcc db-dev flex gawk bash + script: + - ./build_aux/bootstrap + - mkdir _build + - cd _build + - ../configure --enable-cobc-internal-checks --enable-debug --prefix /opt/cobol/gnucobol-gcos --exec-prefix /opt/cobol/gnucobol-gcos + - make + - sudo make install + diff --git a/ChangeLog b/ChangeLog index 273939888..18d10b809 100644 --- a/ChangeLog +++ b/ChangeLog @@ -116,6 +116,10 @@ * HACKING: add notes for testing compatibility with GnuCOBOL modules generated by an earlier version of GnuCOBOL +2022-09-30 Nicolas Berthier + + * .github/workflows: fix ubuntu CI setup + 2022-09-21 Simon Sobisch * configure.ac: dropped extra check for GCC as done internally @@ -129,10 +133,22 @@ * configure.ac: check for ncursesw first, then ncurses; in case of ncurses check for ncurses.h again +2022-07-20 Nicolas Berthier + + * .github/workflows: fix handling of quotes in testuite artifact name + 2022-07-10 Simon Sobisch * configure.ac: check for PDC_free_memory_allocations +2022-07-07 Simon Sobisch + + * .github/workflows: CI now emits a coverage report artifact + +2022-05-24 Nicolas Berthier + + * .github/workflows: CI setups now emit artifacts + 2022-07-06 Nicolas Berthier * configure.ac: Check for __attribute__((pure)) diff --git a/README.md b/README.md index 7106f6948..6c7b0ff1c 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,40 @@ +[![Actions Status](https://github.com/ocamlpro/gnucobol/workflows/Ubuntu%20Workflow/badge.svg)](https://github.com/ocamlpro/gnucobol/actions/workflows/ubuntu.yml) +[![Actions Status](https://github.com/ocamlpro/gnucobol/workflows/Windows%20Workflow/badge.svg)](https://github.com/ocamlpro/gnucobol/actions/workflows/windows.yml) +[![Actions Status](https://github.com/ocamlpro/gnucobol/workflows/MacOS%20Workflow/badge.svg)](https://github.com/ocamlpro/gnucobol/actions/workflows/macos.yml) + +# Git Mirror of the GnuCOBOL Project + +## Foreword + +This repository is a GIT Mirror of the [GnuCOBOL +Project](https://gnucobol.sourceforge.io/), maintained by +[OCamlPro](https://ocamlpro.com) as part of the [SuperBOL Studio +Project](https://get-superbol.com). + +Two other Git Mirrors are available for GnuCOBOL: + +* [GnuCOBOL Documentation](https://sourceforge.net/p/gnucobol/code/HEAD/tree/external-doc/) is mirrored on https://github.com/ocamlpro/gnucobol-docs +* [GnuCOBOL Contribution Tree](https://sourceforge.net/p/gnucobol/contrib/HEAD/tree/) is mirrored on https://github.com/ocamlpro/gnucobol-contrib + +### History + +A previous version of this mirror was used from February 2022 to +January 2024. It has been moved to +https://github.com/ocamlpro/gnucobol2 . It was deprecated in favor of +this one, because it only contained a truncated history of the SVN +repository. + +Pull-Requests made on that repository are still available here: +https://github.com/ocamlpro/gnucobol2/pulls + +Since these two mirrors have no common history, former pull-requests +cannot be merged directly in this repository. Instead, we advise +former users to squash all their commits in one single commit, extract +it as a patch, and regenerate a new branch on this repository by +applying the patch. + +## README.md File of the Project + [GnuCOBOL](https://www.gnu.org/software/gnucobol/) is a free COBOL compiler licensed under the GNU Public License (GPL). It implements a substantial part of the COBOL 85, diff --git a/build_aux/ar-lib b/build_aux/ar-lib deleted file mode 120000 index be8806a2f..000000000 --- a/build_aux/ar-lib +++ /dev/null @@ -1,271 +0,0 @@ -#! /bin/sh -# Wrapper for Microsoft lib.exe - -me=ar-lib -scriptversion=2019-07-04.01; # UTC - -# Copyright (C) 2010-2019 Free Software Foundation, Inc. -# Written by Peter Rosin . -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# This file is maintained in Automake, please report -# bugs to or send patches to -# . - - -# func_error message -func_error () -{ - echo "$me: $1" 1>&2 - exit 1 -} - -file_conv= - -# func_file_conv build_file -# Convert a $build file to $host form and store it in $file -# Currently only supports Windows hosts. -func_file_conv () -{ - file=$1 - case $file in - / | /[!/]*) # absolute file, and not a UNC file - if test -z "$file_conv"; then - # lazily determine how to convert abs files - case `uname -s` in - MINGW*) - file_conv=mingw - ;; - CYGWIN* | MSYS*) - file_conv=cygwin - ;; - *) - file_conv=wine - ;; - esac - fi - case $file_conv in - mingw) - file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` - ;; - cygwin | msys) - file=`cygpath -m "$file" || echo "$file"` - ;; - wine) - file=`winepath -w "$file" || echo "$file"` - ;; - esac - ;; - esac -} - -# func_at_file at_file operation archive -# Iterate over all members in AT_FILE performing OPERATION on ARCHIVE -# for each of them. -# When interpreting the content of the @FILE, do NOT use func_file_conv, -# since the user would need to supply preconverted file names to -# binutils ar, at least for MinGW. -func_at_file () -{ - operation=$2 - archive=$3 - at_file_contents=`cat "$1"` - eval set x "$at_file_contents" - shift - - for member - do - $AR -NOLOGO $operation:"$member" "$archive" || exit $? - done -} - -case $1 in - '') - func_error "no command. Try '$0 --help' for more information." - ;; - -h | --h*) - cat <