Skip to content

Commit

Permalink
Additional files for GIT, Autofonce and Github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
lefessan committed Jan 11, 2024
1 parent b3f8309 commit ce769a3
Show file tree
Hide file tree
Showing 10 changed files with 617 additions and 271 deletions.
35 changes: 35 additions & 0 deletions .autofonce
Original file line number Diff line number Diff line change
@@ -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 = "<local-path-to-env-file"
testsuite = "<tests/autofonce.env.sh"

118 changes: 118 additions & 0 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
name: MacOS Workflow

on:
pull_request:
branches: [ gcos4gnucobol-3.x ]
push:
branches: [ gcos4gnucobol-3.x ]

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

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

steps:
- name: Configure git
run: git config --global core.symlinks false

# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout code
uses: actions/checkout@v3

- name: Install packages
run: |
brew install automake help2man texinfo bison berkeley-db@4
opt="/usr/local/opt"; \
for d in automake help2man bison texinfo berkeley-db@4; do \
test -d "$opt/$d/bin" && echo "$opt/$d/bin" >> $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
204 changes: 204 additions & 0 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
@@ -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)

Loading

0 comments on commit ce769a3

Please sign in to comment.