Skip to content

ci adjustments

ci adjustments #1267

Workflow file for this run

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 [email protected]
# 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: 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"
- name: Upload testsuite.log
uses: actions/upload-artifact@v4
# if: failure() -> always upload as build result documentation
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
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
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: 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: 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() -> always upload as build result documentation
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
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get 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
uses: actions/upload-artifact@v4
if: failure()
with:
name: config-${{ matrix.os }}-${{ 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
uses: actions/upload-artifact@v4
# if: failure() -> always upload as build result documentation
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@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)