Skip to content

Commit

Permalink
Merge branch 'main' into 8798
Browse files Browse the repository at this point in the history
  • Loading branch information
yoni206 committed Apr 30, 2024
2 parents 699f810 + 20121de commit 61efcf0
Show file tree
Hide file tree
Showing 2,446 changed files with 60,557 additions and 29,695 deletions.
Original file line number Diff line number Diff line change
@@ -1,33 +1,58 @@
name: Store binary
description: Store cvc5 binary to the latest tag or the current release
name: Add package
description: Create a package and store it to the latest tag or the current release
inputs:
binary:
description: file name of binary
binary-name:
description: target name of binary
build-dir:
description: path to the build directory
package-name:
description: target name of the package
github-token-latest:
description: token to upload binary to latest
description: token to upload package to latest
github-token-release:
description: token to upload binary to release
description: token to upload package to release
shell:
default: bash
runs:
using: composite
steps:
- name: Rename binary
shell: bash
- name: Create ZIP file
shell: ${{ inputs.shell }}
run: |
cp ${{ inputs.binary }} ${{ inputs.binary-name }}
echo "::group::Create ZIP file"
# Run 'make install' on build directory
pushd ${{ inputs.build-dir }}
make install
popd
# Remove Python bindings (if any).
# They are built for testing purposes, but
# only work for the specific CI Python version.
rm -rf ${{ inputs.build-dir }}/install/lib/python*
# Copy COPYING file and licenses directory to install directory
cp COPYING ${{ inputs.build-dir }}/install/
cp -r licenses ${{ inputs.build-dir }}/install/
# Create ZIP file
pushd ${{ inputs.build-dir }}
mv install ${{ inputs.package-name }}
zip -r ${{ inputs.package-name }} ${{ inputs.package-name }}
popd
# Move package to root directory
mv ${{ inputs.build-dir }}/${{ inputs.package-name }}.zip .
echo "::endgroup::"
- name: install pyGithub
shell: bash
shell: ${{ inputs.shell }}
run: |
python3 -m pip install pyGithub
- name: store to latest
- name: Store to latest
if: github.ref == 'refs/heads/main'
shell: 'python3 {0}'
env:
GITHUB_TOKEN: ${{ inputs.github-token-latest }}
BINARY: ${{ inputs.binary-name }}
PACKAGE: ${{ inputs.package-name }}.zip
run: |
import datetime
import os
Expand All @@ -54,8 +79,8 @@ runs:
rel = repo.create_git_release('latest', 'latest', 'Latest builds')
# generate new filename
binary = os.getenv('BINARY')
name,ext = os.path.splitext(binary)
package = os.getenv('PACKAGE')
name,ext = os.path.splitext(package)
curtime = repo.get_git_commit(sha).committer.date.strftime('%Y-%m-%d')
samedayprefix = '{}-{}-'.format(name, curtime)
filename = '{}-{}-{}{}'.format(name, curtime, sha[:7], ext)
Expand All @@ -66,7 +91,9 @@ runs:
for cnt,asset in enumerate(assets):
delete = False
if cnt >= 30:
# We generate 10 artifacts per build:
# {Linux, Linux-arm64, macOS, macOS-arm64, Windows} * {static, shared}
if cnt >= 20: # Keep at most 2 builds
delete = True
if asset.name.startswith(samedayprefix):
delete = True
Expand All @@ -78,14 +105,14 @@ runs:
asset.delete_asset()
# upload as asset with proper name
rel.upload_asset(binary, name=filename)
rel.upload_asset(package, name=filename)
- name: store to release
- name: Store to release
if: startsWith(github.ref, 'refs/tags/')
shell: 'python3 {0}'
env:
GITHUB_TOKEN: ${{ inputs.github-token-release }}
BINARY: ${{ inputs.binary-name }}
PACKAGE: ${{ inputs.package-name }}.zip
run: |
import os
from github import Github
Expand All @@ -100,5 +127,4 @@ runs:
ref = repo.get_git_ref('tags/' + refname)
commit = repo.get_git_commit(ref.object.sha)
rel = repo.create_git_release(refname, refname, commit.message)
rel.upload_asset(os.getenv('BINARY'))
rel.upload_asset(os.getenv('PACKAGE'))
2 changes: 1 addition & 1 deletion .github/actions/build-documentation/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ runs:
working-directory: ${{ inputs.build-dir }}

- name: Store Documentation
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: documentation
path: ${{ inputs.build-dir }}/docs/sphinx-gh/
46 changes: 37 additions & 9 deletions .github/actions/configure-and-build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ inputs:
default: ""
configure-config:
default: ""
macos-target:
default: ""
build-shared:
default: true
type: boolean
Expand All @@ -13,6 +15,8 @@ inputs:
type: boolean
strip-bin:
default: ""
shell:
default: bash
outputs:
shared-build-dir:
description: build directory of the shared build
Expand All @@ -23,20 +27,30 @@ outputs:
runs:
using: composite
steps:
- name: Set MACOSX_DEPLOYMENT_TARGET
if: runner.os == 'macOS' && inputs.macos-target
shell: ${{ inputs.shell }}
run: echo "MACOSX_DEPLOYMENT_TARGET=${{ inputs.macos-target }}" >> $GITHUB_ENV

- name: Shared build
id: shared-build
# Boolean inputs are actually strings:
# https://github.com/actions/runner/issues/1483
if: inputs.build-shared == '' || inputs.build-shared == 'true'
shell: bash
shell: ${{ inputs.shell }}
run: |
echo "::group::Shared build"
${{ inputs.configure-env }} ./configure.sh ${{ inputs.configure-config }} \
--prefix=$(pwd)/build-shared/install --werror --name=build-shared
--prefix=$(pwd)/build-shared/install --werror --name=build-shared \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache
# 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
if [[ "$RUNNER_OS" == "Windows" ]]; then
ccache --set-config="base_dir=$pwd"
else
# can not use `ccache --set-config=base_dir=` due to ccache bug, fixed with 3.7.10
$SED -i.orig -n -e '/^base_dir = /!p' -e "\$abase_dir = $pwd" $CCACHE_CONFIGPATH
fi
make -j${{ env.num_proc }}
Expand All @@ -48,14 +62,20 @@ runs:
# Boolean inputs are actually strings:
# https://github.com/actions/runner/issues/1483
if: inputs.build-static == '' || inputs.build-static == 'true'
shell: bash
shell: ${{ inputs.shell }}
run: |
echo "::group::Static build"
${{ inputs.configure-env }} ./configure.sh ${{ inputs.configure-config }} \
--prefix=$(pwd)/build-static/install --werror --static --name=build-static --no-java-bindings
--prefix=$(pwd)/build-static/install --werror --static --name=build-static --no-java-bindings \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache
cd build-static/ && pwd=$(pwd)
$SED -i.orig -n -e '/^base_dir = /!p' -e "\$abase_dir = $pwd" $CCACHE_CONFIGPATH
if [[ "$RUNNER_OS" == "Windows" ]]; then
ccache --set-config="base_dir=$pwd"
else
# can not use `ccache --set-config=base_dir=` due to ccache bug, fixed with 3.7.10
$SED -i.orig -n -e '/^base_dir = /!p' -e "\$abase_dir = $pwd" $CCACHE_CONFIGPATH
fi
make -j${{ env.num_proc }}
Expand All @@ -67,8 +87,16 @@ runs:
echo "::endgroup::"
- name: Reset ccache base_dir
shell: bash
shell: ${{ inputs.shell }}
run: |
echo "::group::Reset ccache base_dir"
$SED -i.orig -n -e '/^base_dir = /!p' -e "\$abase_dir =" $CCACHE_CONFIGPATH
if [[ "$RUNNER_OS" == "Windows" ]]; then
ccache --set-config="base_dir="
else
$SED -i.orig -n -e '/^base_dir = /!p' -e "\$abase_dir =" $CCACHE_CONFIGPATH
fi
echo "::endgroup::"
- name: ccache Statistics
shell: ${{ inputs.shell }}
run: ccache -s
101 changes: 65 additions & 36 deletions .github/actions/install-dependencies/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@ inputs:
windows-build:
default: false
type: boolean
shell:
default: bash
runs:
using: composite
steps:
- name: Install Linux software
if: runner.os == 'Linux'
shell: bash
shell: ${{ inputs.shell }}
run: |
echo "::group::Install Linux software"
sudo apt-get update
Expand All @@ -27,26 +29,26 @@ runs:
libedit-dev \
libgmp-dev \
libtinfo-dev \
flex \
libfl-dev \
flexc++
python3 -m pip install --user pexpect setuptools tomli
# 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
libfl-dev
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) + 1 ))" >> $GITHUB_ENV
echo "/usr/lib/ccache" >> $GITHUB_PATH
echo "::endgroup::"
- name: Install software for cross-compiling for arm64 Linux
if: runner.os == 'Linux'
shell: ${{ inputs.shell }}
run: |
echo "::group::Install software for cross-compiling for arm64 Linux"
sudo apt-get install -y \
gcc-aarch64-linux-gnu \
g++-aarch64-linux-gnu
echo "::endgroup::"
- name: Install software for cross-compiling for Windows
# Boolean inputs are actually strings:
# https://github.com/actions/runner/issues/1483
if: inputs.windows-build == 'true'
shell: bash
if: runner.os == 'Linux' && inputs.windows-build == 'true'
shell: ${{ inputs.shell }}
run: |
echo "::group::Install software for cross-compiling for Windows"
sudo apt-get update
Expand All @@ -59,10 +61,33 @@ runs:
sudo update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix
echo "::endgroup::"
- name: Install Windows software
if: runner.os == 'Windows' && inputs.windows-build == 'true'
uses: msys2/setup-msys2@v2
with:
update: true
msystem: MINGW64
path-type: inherit
install: |
make
mingw-w64-x86_64-ccache
mingw-w64-x86_64-cmake
mingw-w64-x86_64-gcc
mingw-w64-x86_64-gmp
zip
- name: Set up num_proc variable for Linux and Windows
if: runner.os == 'Linux' || runner.os == 'Windows'
shell: ${{ inputs.shell }}
run: |
echo "::group::Set up num_proc variable for Linux and Windows"
echo "num_proc=$(( $(nproc) + 1 ))" >> $GITHUB_ENV
echo "::endgroup::"
# Note: macOS comes with a libedit; it does not need to brew-installed
- name: Install macOS software
if: runner.os == 'macOS'
shell: bash
shell: ${{ inputs.shell }}
run: |
echo "::group::Install macOS software"
brew config
Expand All @@ -71,53 +96,57 @@ runs:
brew install \
ccache \
cln \
gmp \
pkgconfig \
flex \
gnu-sed
python3 -m pip install --user pexpect setuptools tomli pyparsing
# 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) + 1 ))" >> $GITHUB_ENV
echo "/usr/local/opt/ccache/libexec" >> $GITHUB_PATH
echo "::endgroup::"
# Required by PEP-668
- name: Set up Python virtual environment
if: runner.os == 'macOS'
shell: ${{ inputs.shell }}
run: |
echo "::group::Set up Python virtual environment"
python3 -m venv ~/.venv
echo "$HOME/.venv/bin" >> $GITHUB_PATH
echo "::endgroup::"
- name: Install Python modules for building and testing
shell: ${{ inputs.shell }}
run: |
echo "::group::Install Python modules for building and testing"
python3 -m pip install -r contrib/requirements_build.txt
python3 -m pip install pexpect # For interactive shell tests
echo "::endgroup::"
- name: Install software for Python bindings
if: inputs.with-python-bindings == 'true'
shell: bash
shell: ${{ inputs.shell }}
run: |
echo "::group::Install software for Python bindings"
python3 -m pip install -q --upgrade pip
python3 -m pip install --user pytest scikit-build
python3 -m pytest --version
python3 -m pip install --user Cython==3.*
# Add binary path of user site-packages to PATH
echo "$(python3 -m site --user-base)/bin" >> $GITHUB_PATH
python3 -m pip install -r contrib/requirements_python_dev.txt
echo "::endgroup::"
- name: Install software for Python packaging
if: inputs.with-python-packaging == 'true'
shell: bash
shell: ${{ inputs.shell }}
run: |
echo "::group::Install software for Python packaging"
python3 -m pip install -q --upgrade pip
python3 -m pip install --user twine
python3 -m pip install --user -U urllib3 requests
python3 -m pip install twine
python3 -m pip install -U urllib3 requests
echo "::endgroup::"
- name: Install software for documentation
if: inputs.with-documentation == 'true'
shell: bash
shell: ${{ inputs.shell }}
run: |
echo "::group::Install software for documentation"
sudo apt-get install -y doxygen python3-docutils python3-jinja2
python3 -m pip install --user \
python3 -m pip install \
sphinx==7.1.2 \
sphinxcontrib-bibtex==2.5.0 sphinx-tabs==3.4.1 sphinx-rtd-theme==1.3.0 breathe==4.35.0 \
sphinxcontrib-programoutput==0.17
Expand Down
Loading

0 comments on commit 61efcf0

Please sign in to comment.