Skip to content

ci(refactor): extract build setup logic into setup-build #408

ci(refactor): extract build setup logic into setup-build

ci(refactor): extract build setup logic into setup-build #408

Workflow file for this run

name: Test
on:
push:
pull_request:
workflow_dispatch:
jobs:
# Simple tests on Linux; except the ParFORM case, they probably pass unless
# the committer has forgotten running "make check".
check:
name: Test (${{ matrix.test }}) for ${{ matrix.bin }}${{ matrix.nthreads && format(' -w{0}', matrix.nthreads) || '' }}
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
include:
- {bin: form, test: default}
- {bin: tform, test: default}
- {bin: tform, test: default, nthreads: 2}
- {bin: parform, test: default, timeout: 15}
- {bin: form, test: checkpoint}
- {bin: tform, test: checkpoint}
- {bin: form, test: forcer, timeout: 60}
- {bin: tform, test: forcer, timeout: 60}
- {bin: tform, test: forcer, nthreads: 2, timeout: 60}
- {bin: tform, test: multithreaded}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # ensures a reachable tag
- name: Set up build
uses: ./.github/actions/setup-build
with:
features: ${{ matrix.bin }} ${{ matrix.test == 'forcer' && 'forcer' || '' }}
- name: Build
run: make -C sources -j 4 ${{ matrix.bin }}
- name: Test
run: ./check/check.rb ./sources/${{ matrix.bin }} --stat ${{ matrix.nthreads && format('-w{0}', matrix.nthreads) || '' }} ${{ matrix.timeout && format('--timeout {0}', matrix.timeout) || '' }} ${{ matrix.test != 'default' && format('-C {0}', matrix.test) || '' }}
# Check memory errors (e.g., uninitialized values and memory leaks)
# thoroughly by using Valgrind on Linux. To maximize the use of concurrent
# jobs, we divide the tests into smaller parts.
valgrind-check:
name: Valgrind check for ${{ matrix.bin }}${{ matrix.nthreads && format(' -w{0}', matrix.nthreads) || '' }} (${{ matrix.group }})
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
include:
- {bin: vorm, group: 1/5}
- {bin: vorm, group: 2/5}
- {bin: vorm, group: 3/5}
- {bin: vorm, group: 4/5}
- {bin: vorm, group: 5/5}
- {bin: tvorm, group: 1/10}
- {bin: tvorm, group: 2/10}
- {bin: tvorm, group: 3/10}
- {bin: tvorm, group: 4/10}
- {bin: tvorm, group: 5/10}
- {bin: tvorm, group: 6/10}
- {bin: tvorm, group: 7/10}
- {bin: tvorm, group: 8/10}
- {bin: tvorm, group: 9/10}
- {bin: tvorm, group: 10/10}
- {bin: tvorm, nthreads: 2, group: 1/10}
- {bin: tvorm, nthreads: 2, group: 2/10}
- {bin: tvorm, nthreads: 2, group: 3/10}
- {bin: tvorm, nthreads: 2, group: 4/10}
- {bin: tvorm, nthreads: 2, group: 5/10}
- {bin: tvorm, nthreads: 2, group: 6/10}
- {bin: tvorm, nthreads: 2, group: 7/10}
- {bin: tvorm, nthreads: 2, group: 8/10}
- {bin: tvorm, nthreads: 2, group: 9/10}
- {bin: tvorm, nthreads: 2, group: 10/10}
- {bin: parvorm, group: 1/10}
- {bin: parvorm, group: 2/10}
- {bin: parvorm, group: 3/10}
- {bin: parvorm, group: 4/10}
- {bin: parvorm, group: 5/10}
- {bin: parvorm, group: 6/10}
- {bin: parvorm, group: 7/10}
- {bin: parvorm, group: 8/10}
- {bin: parvorm, group: 9/10}
- {bin: parvorm, group: 10/10}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # ensures a reachable tag
- name: Set up build
uses: ./.github/actions/setup-build
with:
features: ${{ matrix.bin }} valgrind
- name: Build
run: make -C sources -j 4 ${{ matrix.bin }}
- name: Test
run: ./check/check.rb valgrind ./sources/${{ matrix.bin }} --stat -g ${{ matrix.group }} --retries 5 ${{ matrix.nthreads && format('-w{0}', matrix.nthreads) || '' }}
# Generate LCOV coverage data to be posted to coveralls.io. Note that
# we measure code coverage only for tests checked with Valgrind.
coverage:
name: Code coverage for ${{ matrix.bin }}${{ matrix.nthreads && format(' -w{0}', matrix.nthreads) || '' }}
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
include:
- {bin: vorm}
- {bin: tvorm}
- {bin: tvorm, nthreads: 2}
- {bin: parvorm}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # ensures a reachable tag
- name: Set up build
uses: ./.github/actions/setup-build
with:
features: ${{ matrix.bin }} coverage
- name: Build
run: make -C sources -j 4 ${{ matrix.bin }}
- name: Test
run: ./check/check.rb ./sources/${{ matrix.bin }} --stat --timeout 30 ${{ matrix.nthreads && format('-w{0}', matrix.nthreads) || '' }}
- name: Generate LCOV coverage data
run: |
lcov -d . -c -o coverage.lcov
lcov -r coverage.lcov */usr/include/* -o coverage.lcov
- name: Coveralls Parallel
uses: coverallsapp/github-action@v2
with:
flag-name: ${{ matrix.bin }}${{ matrix.nthreads && format(' -w{0}', matrix.nthreads) || '' }}
parallel: true
# Post LCOV coverage data to coveralls.io.
coverage-finish:
needs: [check, valgrind-check, coverage]
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@v2
with:
parallel-finished: true
# Tests with a 32-bit container.
check-i386:
name: 32-bit container check for ${{ matrix.bin }}${{ matrix.nthreads && format(' -w{0}', matrix.nthreads) || '' }}
runs-on: ubuntu-latest
container:
image: i386/debian:11.5
strategy:
fail-fast: false
matrix:
include:
- {bin: form}
- {bin: tform}
- {bin: tform, nthreads: 2}
steps:
# We have to use v1.
# See https://github.com/actions/checkout/issues/334
- name: Checkout repository
uses: actions/checkout@v1
- name: Set up build
uses: ./.github/actions/setup-build
with:
features: ${{ matrix.bin }}
- name: Build
run: make -C sources -j 4 ${{ matrix.bin }}
- name: Test
run: ./check/check.rb ./sources/${{ matrix.bin }} --stat --wordsize 2 ${{ matrix.nthreads && format('-w{0}', matrix.nthreads) || '' }}