This PR changes our strategy to deal with shared vs. static builds in CI jobs.
All jobs now build cvc5 both shared and static by default. The builds happen in different build directories (build-shared and build-static), and we configure ccache such that these two build directories share a common cache.
name: Add binary to release
description: Add cvc5 binary to the current release
inputs:
+ binary:
+ description: file name of binary
github-token:
description: token to upload binary
runs:
- name: Rename binaries for release
shell: bash
run: |
- cp build/bin/cvc5 cvc5-${{ runner.os }}
+ cp ${{ inputs.binary }} cvc5-${{ runner.os }}
- name: Add binaries to release
uses: softprops/action-gh-release@v1
name: Build documentation
description: Build documentation and store it as artifact
+inputs:
+ build-dir:
+ default: build
runs:
using: composite
steps:
if [ "${{ github.event_name }}" == "pull_request" ] ; then
echo "${{ github.event.number }}" > docs/sphinx-gh/prnum
fi
- working-directory: build
+ working-directory: ${{ inputs.build-dir }}
- name: Store Documentation
uses: actions/upload-artifact@v2
with:
name: documentation
- path: build/docs/sphinx-gh/
+ path: ${{ inputs.build-dir }}/docs/sphinx-gh/
--- /dev/null
+name: Configure and build
+description: Run configure script and build
+inputs:
+ configure-env:
+ default: ""
+ configure-config:
+ default: ""
+ build-shared:
+ default: true
+ build-static:
+ default: true
+outputs:
+ shared-build-dir:
+ description: build directory of the shared build
+ value: ${{ steps.shared-build.outputs.build-dir }}
+ static-build-dir:
+ description: build directory of the static build
+ value: ${{ steps.static-build.outputs.build-dir }}
+runs:
+ using: composite
+ steps:
+ - name: Shared build
+ id: shared-build
+ shell: bash
+ run: |
+ echo "::group::Shared build"
+ if [[ "${{ inputs.build-shared }}" != "true" ]]; then exit 0; fi
+ ${{ inputs.configure-env }} ./configure.sh ${{ inputs.configure-config }} \
+ --prefix=$(pwd)/build-shared/install --werror --name=build-shared
+
+ # can not use `ccache --set-config=base_dir=` due to ccache bug, fixed with 3.7.10
+ cd build-shared/ && pwd=$(pwd)
+ $SED -i.orig -n -e '/^base_dir = /!p' -e "\$abase_dir = $pwd" $CCACHE_CONFIGPATH
+
+ make -j${{ env.num_proc }}
+
+ echo "::set-output name=build-dir::$pwd"
+ echo "::endgroup::"
+
+ - name: Static build
+ id: static-build
+ shell: bash
+ run: |
+ echo "::group::Static build"
+ if [[ "${{ inputs.build-static }}" != "true" ]]; then exit 0; fi
+ ${{ inputs.configure-env }} ./configure.sh ${{ inputs.configure-config }} \
+ --prefix=$(pwd)/build-static/install --werror --static --name=build-static
+
+ cd build-static/ && pwd=$(pwd)
+ $SED -i.orig -n -e '/^base_dir = /!p' -e "\$abase_dir = $pwd" $CCACHE_CONFIGPATH
+
+ make -j${{ env.num_proc }}
+
+ echo "::set-output name=build-dir::$pwd"
+ echo "::endgroup::"
+
+ - name: Reset ccache base_dir
+ shell: bash
+ run: |
+ echo "::group::Reset ccache base_dir"
+ $SED -i.orig -n -e '/^base_dir = /!p' -e "\$abase_dir =" $CCACHE_CONFIGPATH
+ echo "::endgroup::"
- name: Install Linux software
shell: bash
run: |
+ echo "::group::Install Linux software"
if [[ $RUNNER_OS != "Linux" ]]; then exit 0; fi
sudo apt-get update
sudo apt-get install -y \
# variables of the runner are not automatically imported:
#
# https://github.com/actions/runner/blob/master/docs/adrs/0278-env-context.md#dont-populate-the-env-context-with-environment-variables-from-runner-machine
+ echo "SED=sed" >> $GITHUB_ENV
+ echo "CCACHE_CONFIGPATH=/home/runner/.ccache/ccache.conf" >> $GITHUB_ENV
echo "image_version=$ImageVersion" >> $GITHUB_ENV
echo "num_proc=$(nproc)" >> $GITHUB_ENV
echo "/usr/lib/ccache" >> $GITHUB_PATH
+ echo "::endgroup::"
# Note: macOS comes with a libedit; it does not need to brew-installed
- name: Install macOS software
shell: bash
run: |
+ echo "::group::Install macOS software"
if [[ $RUNNER_OS != "macOS" ]]; then exit 0; fi
brew update --quiet
brew install \
cln \
gmp \
pkgconfig \
- flex
+ flex \
+ gnu-sed
python3 -m pip install pexpect setuptools toml
# Make ImageVersion accessible as env.image_version. Environment
# variables of the runner are not automatically imported:
#
# https://github.com/actions/runner/blob/master/docs/adrs/0278-env-context.md#dont-populate-the-env-context-with-environment-variables-from-runner-machine
+ echo "SED=gsed" >> $GITHUB_ENV
+ echo "CCACHE_CONFIGPATH=/Users/runner/Library/Preferences/ccache/ccache.conf" >> $GITHUB_ENV
echo "image_version=$ImageVersion" >> $GITHUB_ENV
echo "num_proc=$(sysctl -n hw.logicalcpu)" >> $GITHUB_ENV
echo "/usr/local/opt/ccache/libexec" >> $GITHUB_PATH
+ echo "::endgroup::"
- - name: Install Python packages
+ - name: Install software for Python bindings
shell: bash
run: |
+ echo "::group::Install software for Python bindings"
if [[ "${{ inputs.with-python-bindings }}" != "true" ]]; then exit 0; fi
python3 -m pip install pytest scikit-build
python3 -m pytest --version
python3 -m pip install \
Cython==0.29.* --install-option="--no-cython-compile"
echo "$(python3 -m site --user-base)/bin" >> $GITHUB_PATH
+ echo "::endgroup::"
- name: Install software for documentation
shell: bash
run: |
+ echo "::group::Install software for documentation"
if [[ "${{ inputs.with-documentation }}" != "true" ]]; then exit 0; fi
sudo apt-get install -y doxygen python3-docutils python3-jinja2
python3 -m pip install \
sphinxcontrib-bibtex sphinx-tabs sphinx-rtd-theme breathe \
sphinxcontrib-programoutput
+ echo "::endgroup::"
name: Run tests
description: Run all available tests
inputs:
+ build-dir:
+ default: build/
check-examples:
default: true
check-python-bindings:
ARGS: --output-on-failure -LE regress[${{ inputs.regressions-exclude }}]
CVC5_REGRESSION_ARGS: --no-early-exit
RUN_REGRESSION_ARGS: ${{ inputs.regressions-args }}
- working-directory: build
+ working-directory: ${{ inputs.build-dir }}
- name: Run Unit Tests
shell: bash
run: |
if [[ "${{ inputs.check-unit-tests }}" != "true" ]]; then exit 0; fi
make -j${{ env.num_proc }} apitests units
- working-directory: build
+ working-directory: ${{ inputs.build-dir }}
- name: Install Check
shell: bash
make -j${{ env.num_proc }} install
echo -e "#include <cvc5/cvc5.h>\nint main() { cvc5::api::Solver s; return 0; }" > /tmp/test.cpp
g++ -std=c++17 /tmp/test.cpp -I install/include -L install/lib -lcvc5
- working-directory: build
+ working-directory: ${{ inputs.build-dir }}
- name: Python Install Check
shell: bash
run: |
if [[ "${{ inputs.check-python-bindings }}" != "true" ]]; then exit 0; fi
- export PYTHONPATH="$PYTHONPATH:$(dirname $(find build/install/ -name "pycvc5" -type d))"
+ export PYTHONPATH="$PYTHONPATH:$(dirname $(find ${{ inputs.build-dir }}/install/ -name "pycvc5" -type d))"
python3 -c "import pycvc5"
- name: Check Examples
if [[ "${{ inputs.check-examples }}" != "true" ]]; then exit 0; fi
mkdir build
cd build
- cmake .. -DCMAKE_PREFIX_PATH=$(pwd)/../../build/install/lib/cmake
+ cmake .. -DCMAKE_PREFIX_PATH=${{ inputs.build-dir }}/install/lib/cmake
make -j${{ env.num_proc }}
ctest -j${{ env.num_proc }} --output-on-failure
- working-directory: examples
\ No newline at end of file
+ working-directory: examples
- name: Setup dependencies cache
uses: actions/cache@v2
with:
- path: build/deps
+ path: |
+ build-shared/deps
+ build-static/deps
key: ${{ inputs.cache-key }}-${{ runner.os }}-deps-${{ hashFiles('cmake/**') }}-${{ hashFiles('.github/**') }}
with:
cache-key: ${{ matrix.cache-key }}
- - name: Configure
- run: |
- ${{ matrix.env }} ./configure.sh ${{ matrix.config }} \
- --prefix=$(pwd)/build/install \
- --werror
-
- - name: Build
- run: make -j${{ env.num_proc }}
- working-directory: build
+ - name: Configure and build
+ id: configure-and-build
+ uses: ./.github/actions/configure-and-build
+ with:
+ configure-env: ${{ matrix.env }}
+ configure-config: ${{ matrix.config }}
- name: ccache Statistics
run: ccache -s
- name: Run tests
uses: ./.github/actions/run-tests
with:
+ build-dir: ${{ steps.configure-and-build.outputs.shared-build-dir }}
check-examples: ${{ matrix.check-examples }}
check-python-bindings: ${{ matrix.python-bindings }}
check-unit-tests: ${{ matrix.check-units }}
- name: Build documentation
if: matrix.build-documentation
uses: ./.github/actions/build-documentation
+ with:
+ build-dir: ${{ steps.configure-and-build.outputs.shared-build-dir }}
- name: Add binary to release
if: matrix.store-to-release && startsWith(github.ref, 'refs/tags/')
uses: ./.github/actions/add-to-release
with:
+ binary: ${{ steps.configure-and-build.outputs.static-build-dir }}/bin/cvc5
github-token: ${{ secrets.GITHUB_TOKEN }}