[core] various updates related to Codac2 #347
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This file generates .deb (Unix) and .nupkg (Windows) files | |
on: | |
push: | |
branches: '**' | |
tags: '' # Restrict to blank tags | |
pull_request: | |
jobs: | |
# This job may be commented if a new release should not be created... | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: softprops/action-gh-release@v1 | |
id: create_release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
draft: true | |
tag_name: autotagname-${{ github.sha }} | |
if: (github.event_name != 'pull_request')&&(github.ref_name == 'master') | |
unixmatrix: | |
runs-on: ${{ matrix.cfg.os }} | |
defaults: | |
run: | |
shell: ${{ matrix.cfg.shell }} | |
strategy: | |
fail-fast: false | |
matrix: | |
cfg: | |
- { os: windows-2022, shell: cmd, arch: x64, runtime: vc17, cmake_params: '-G "Visual Studio 17" -T v143 -A x64', cmake_flags: ' /wd4267 /wd4244 /wd4305 /wd4996', test_config: 'Release/', desc: 'Windows Visual Studio 2022 x64' } | |
- { os: windows-2022, shell: cmd, arch: x86, runtime: vc17, cmake_params: '-G "Visual Studio 17" -T v143 -A Win32', cmake_flags: ' /wd4267 /wd4244 /wd4305 /wd4996', test_config: 'Release/', choco_flags: '--x86', desc: 'Windows Visual Studio 2022 x86' } | |
- { os: windows-2022, shell: cmd, arch: x64, runtime: vc16, cmake_params: '-G "Visual Studio 17" -T v142 -A x64', cmake_flags: ' /wd4267 /wd4244 /wd4305 /wd4996', test_config: 'Release/', desc: 'Windows Visual Studio 2019 x64' } | |
- { os: windows-2022, shell: cmd, arch: x86, runtime: vc16, cmake_params: '-G "Visual Studio 17" -T v142 -A Win32', cmake_flags: ' /wd4267 /wd4244 /wd4305 /wd4996', test_config: 'Release/', choco_flags: '--x86', desc: 'Windows Visual Studio 2019 x86' } | |
- { os: windows-2022, shell: cmd, arch: x64, runtime: vc15, cmake_params: '-G "Visual Studio 17" -T v141 -A x64', cmake_flags: ' /wd4267 /wd4244 /wd4305 /wd4996', test_config: 'Release/', desc: 'Windows Visual Studio 2017 x64' } | |
- { os: windows-2022, shell: cmd, arch: x86, runtime: vc15, cmake_params: '-G "Visual Studio 17" -T v141 -A Win32', cmake_flags: ' /wd4267 /wd4244 /wd4305 /wd4996', test_config: 'Release/', choco_flags: '--x86', desc: 'Windows Visual Studio 2017 x86' } | |
- { os: windows-2022, shell: cmd, arch: x64, runtime: mingw11, cmake_params: '-G "MinGW Makefiles"', cmake_flags: '-fPIC', desc: 'Windows MinGW 11.2.0 x64' } | |
- { os: windows-2022, shell: cmd, arch: x86, runtime: mingw11, cmake_params: '-G "MinGW Makefiles"', cmake_flags: '-fPIC', choco_flags: '--x86', desc: 'Windows MinGW 11.2.0 x86' } | |
- { os: windows-2019, shell: cmd, arch: x64, runtime: mingw8, cmake_params: '-G "MinGW Makefiles"', cmake_flags: '-fPIC', desc: 'Windows MinGW 8.1.0 x64' } | |
- { os: windows-2019, shell: cmd, arch: x86, runtime: mingw8, cmake_params: '-G "MinGW Makefiles"', cmake_flags: '-fPIC', choco_flags: '--x86', desc: 'Windows MinGW 8.1.0 x86' } | |
- { os: windows-2019, shell: cmd, arch: x64, runtime: mingw7, cmake_params: '-G "MinGW Makefiles"', cmake_flags: '-fPIC', desc: 'Windows MinGW 7.3.0 x64' } | |
- { os: windows-2019, shell: cmd, arch: x86, runtime: mingw7, cmake_params: '-G "MinGW Makefiles"', cmake_flags: '-fPIC', choco_flags: '--x86', desc: 'Windows MinGW 7.3.0 x86' } | |
- { os: ubuntu-22.04, shell: bash, arch: amd64, runtime: jammy, cmake_flags: '-fPIC', desc: 'Ubuntu 22.04' } | |
- { os: ubuntu-20.04, shell: bash, arch: amd64, runtime: focal, cmake_flags: '-fPIC', desc: 'Ubuntu 20.04' } | |
- { os: macos-12, shell: bash, arch: arm64, runtime: monterey, cmake_params: '-D CMAKE_SYSTEM_NAME=Darwin -D CMAKE_OSX_ARCHITECTURES=arm64', cmake_flags: '-fPIC', desc: 'macOS Monterey arm64' } | |
- { os: macos-12, shell: bash, arch: x86_64, runtime: monterey, cmake_params: '-D CMAKE_SYSTEM_NAME=Darwin -D CMAKE_OSX_ARCHITECTURES=x86_64', cmake_flags: '-fPIC', desc: 'macOS Monterey x86_64' } | |
- { os: macos-11, shell: bash, arch: arm64, runtime: bigsur, cmake_params: '-D CMAKE_SYSTEM_NAME=Darwin -D CMAKE_OSX_ARCHITECTURES=arm64', cmake_flags: '-fPIC', desc: 'macOS Big Sur arm64' } | |
- { os: macos-11, shell: bash, arch: x86_64, runtime: bigsur, cmake_params: '-D CMAKE_SYSTEM_NAME=Darwin -D CMAKE_OSX_ARCHITECTURES=x86_64', cmake_flags: '-fPIC', desc: 'macOS Big Sur x86_64' } | |
name: ${{ matrix.cfg.desc }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true | |
fetch-depth: 0 | |
clean: false | |
# From https://github.com/Munkei/VersionFromGit.cmake/blob/master/VersionFromGit.cmake | |
- run: echo "git_tag=`git describe --tags --abbrev=0`" >> $GITHUB_ENV | |
shell: bash | |
# See https://askubuntu.com/questions/620533/what-is-the-meaning-of-the-xubuntuy-string-in-ubuntu-package-names | |
- run: | | |
echo "SOFTWARE_VERSION=${git_tag:1}" >> $GITHUB_ENV | |
echo "DEBIAN_PACKAGE_REV=0" >> $GITHUB_ENV | |
echo "PACKAGE_REV=0" >> $GITHUB_ENV | |
echo "CHOCO_PACKAGE_REV=" >> $GITHUB_ENV | |
echo "VERBOSE=1" >> $GITHUB_ENV | |
shell: bash | |
- run: if [ -z "$CHOCO_PACKAGE_REV" ]; then echo "PACKAGE_VERSION=$SOFTWARE_VERSION" >> $GITHUB_ENV ; else echo "PACKAGE_VERSION=$SOFTWARE_VERSION.$CHOCO_PACKAGE_REV" >> $GITHUB_ENV ; fi | |
shell: bash | |
if: runner.os=='Windows' | |
- run: echo "PACKAGE_VERSION=$SOFTWARE_VERSION-${DEBIAN_PACKAGE_REV}${{ matrix.cfg.runtime }}$PACKAGE_REV" >> $GITHUB_ENV | |
shell: bash | |
if: runner.os=='Linux' | |
- run: choco install -y -r --no-progress mingw --version=7.3.0 --force ${{ matrix.cfg.choco_flags }} | |
if: (runner.os=='Windows')&&(matrix.cfg.runtime=='mingw7') | |
- run: choco install -y -r --no-progress mingw --version=8.1.0 --force ${{ matrix.cfg.choco_flags }} | |
if: (runner.os=='Windows')&&(matrix.cfg.runtime=='mingw8')&&(matrix.cfg.arch=='x86') | |
- run: choco install -y -r --no-progress mingw --version=11.2.0.07112021 --force ${{ matrix.cfg.choco_flags }} | |
if: (runner.os=='Windows')&&(matrix.cfg.runtime=='mingw11')&&(matrix.cfg.arch=='x86') | |
- run: echo C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw32\bin>>%GITHUB_PATH% | |
if: startsWith(matrix.cfg.runtime, 'mingw')&&(matrix.cfg.arch=='x86') | |
- run: echo C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\bin>>%GITHUB_PATH% | |
if: startsWith(matrix.cfg.runtime, 'mingw')&&(matrix.cfg.arch=='x64') | |
- run: | | |
choco install -y -r --no-progress checksum wget zip | |
choco install -y -r --no-progress eigen --version=3.4.0 ${{ matrix.cfg.choco_flags }} | |
wget https://github.com/lebarsfa/ibex-lib/releases/download/ibex-2.8.9.20230510/ibex.2.8.9.20230510.nupkg --no-check-certificate -nv | |
choco install -y -r --no-progress --ignore-dependencies -s . ibex --version=2.8.9.20230510 ${{ matrix.cfg.choco_flags }} --params "'/url:https://github.com/lebarsfa/ibex-lib/releases/download/ibex-2.8.9.20230510/ibex_${{ matrix.cfg.arch }}_${{ matrix.cfg.runtime }}.zip'" | |
del /f /q ibex.2.8.9.20230510.nupkg | |
if: runner.os=='Windows' | |
- run: | | |
# Replace these 2 lines by the next ones to test a specific binary package of IBEX. | |
#sudo sh -c 'echo "deb [trusted=yes] https://packages.ensta-bretagne.fr/`lsb_release --id -s | tr [:upper:] [:lower:]`/`lsb_release -cs` ./" > /etc/apt/sources.list.d/ensta-bretagne.list' | |
#sudo apt-get -q update ; sudo apt-get -y install libibex-dev libeigen3-dev dpkg-dev || true | |
sudo apt-get -q update ; sudo apt-get -y install libeigen3-dev dpkg-dev || true | |
wget https://github.com/lebarsfa/ibex-lib/releases/download/ibex-2.8.9.20230510/libibex-dev-2.8.9.20230510-0${{ matrix.cfg.runtime }}0_${{ matrix.cfg.arch }}.deb --no-check-certificate -nv | |
sudo dpkg -i libibex-dev-2.8.9.20230510-0${{ matrix.cfg.runtime }}0_${{ matrix.cfg.arch }}.deb | |
rm -Rf libibex-dev-2.8.9.20230510-0${{ matrix.cfg.runtime }}0_${{ matrix.cfg.arch }}.deb | |
shell: bash | |
if: runner.os=='Linux' | |
- run: | | |
brew install eigen | |
wget https://github.com/lebarsfa/ibex-lib/releases/download/ibex-2.8.9.20230510/ibex_${{ matrix.cfg.arch }}_${{ matrix.cfg.runtime }}.zip --no-check-certificate -nv | |
unzip -q ibex_${{ matrix.cfg.arch }}_${{ matrix.cfg.runtime }}.zip | |
rm -Rf ibex_${{ matrix.cfg.arch }}_${{ matrix.cfg.runtime }}.zip | |
sudo cp -Rf ibex/* /usr/local/ | |
if: runner.os=='macOS' | |
# - run: git clone --depth 1 -b master https://github.com/lebarsfa/ibex-lib.git ; cd ibex-lib ; mkdir build ; cd build ; cmake -E env CXXFLAGS="${{ matrix.cfg.cmake_flags }}" CFLAGS="${{ matrix.cfg.cmake_flags }}" cmake ${{ matrix.cfg.cmake_params }} -D CMAKE_INSTALL_PREFIX="../../ibex" .. ; cmake --build . --config Release --target install ; cd ../.. | |
# shell: bash | |
- run: | | |
mkdir build ; cd build | |
cmake -E env CXXFLAGS="${{ matrix.cfg.cmake_flags }}" CFLAGS="${{ matrix.cfg.cmake_flags }}" cmake ${{ matrix.cfg.cmake_params }} -D CMAKE_INSTALL_PREFIX="../codac" .. | |
cmake --build . --config Debug --target install | |
cd .. | |
sed_param=s/PATH_SUFFIXES\ /PATHS\ \$\{CMAKE_CURRENT_LIST_FILE\}\\/..\\/..\\/..\\/..\\/\ PATH_SUFFIXES\ / | |
if [ ${{ runner.os }} = Windows ]; then sed -i "$sed_param" codac/share/codac/cmake/*.cmake ; fi | |
zip -q -r codac_${{ matrix.cfg.arch }}_${{ matrix.cfg.runtime }}.zip codac | |
shell: bash | |
- run: | | |
mkdir -p codac_standalone/example ; cd codac_standalone | |
wget https://community.chocolatey.org/api/v2/package/eigen/3.4.0 --no-check-certificate -nv ; unzip -q 3.4.0 -d eigen ; rm -Rf 3.4.0 eigen/*.xml eigen/*.nuspec eigen/_* eigen/package eigen/tools ; cd eigen/share/cmake ; if [ ${{ runner.os }} = macOS ]; then sed -i "" "s/\\/..\\/../\\/..\\/..\\/../" *.cmake ; else sed -i "s/\\/..\\/../\\/..\\/..\\/../" *.cmake ; fi ; cd .. ; mkdir eigen3 ; mv cmake eigen3/ ; cd ../.. | |
if [ ${{ runner.os }} = Windows ]; then cp -Rf /C/ProgramData/chocolatey/lib/ibex . ; rm -Rf ibex/tools ibex/ibex.* | |
elif [ ${{ runner.os }} = Linux ]; then mkdir -p ibex/include ; mkdir -p ibex/lib ; mkdir -p ibex/share ; mkdir -p ibex/bin ; cp -Rf /usr/include/ibex* ibex/include/ ; cp -Rf /usr/lib/*ibex* ibex/lib/ ; cp -Rf /usr/share/*ibex* ibex/share/ ; cp -Rf /usr/share/pkgconfig ibex/share/ ; cp -Rf /usr/bin/ibex* ibex/bin/ | |
elif [ ${{ runner.os }} = macOS ]; then cp -Rf ../ibex . | |
fi | |
cp -Rf ../codac . ; cp -Rf ../tests/test_codac/* ./example/ ; cd .. ; zip -q -r codac_standalone_${{ matrix.cfg.arch }}_${{ matrix.cfg.runtime }}.zip codac_standalone | |
shell: bash | |
- run: | | |
cd codac_standalone/example | |
cmake ${{ matrix.cfg.cmake_params }} . | |
cmake --build . --config Release | |
file ./${{ matrix.cfg.test_config }}my_project | |
./${{ matrix.cfg.test_config }}my_project | |
cd ../.. | |
shell: bash | |
if: (runner.os!='macOS')||(matrix.cfg.arch=='x86_64') | |
- run: | | |
cd packages/choco | |
sed_param=s/\<version\>1\<\\/version\>/\<version\>${PACKAGE_VERSION}\<\\/version\>/ | |
sed -i "$sed_param" codac/codac.nuspec | |
sed_param=s/download\\/v1\\/codac/download\\/v${PACKAGE_VERSION}\\/codac/ | |
sed -i "$sed_param" codac/codac.nuspec | |
sed -i "$sed_param" codac/tools/chocolateyinstall.ps1 | |
mv -f codac codac.$PACKAGE_VERSION | |
cd codac.$PACKAGE_VERSION | |
choco pack | |
mv -f codac.$PACKAGE_VERSION.nupkg ../../../ | |
cd ../../.. | |
checksum -f=codac.$PACKAGE_VERSION.nupkg -t=sha256 | |
choco install -y -r --no-progress --ignore-dependencies -s . codac --params "'/url:./codac_${{ matrix.cfg.arch }}_${{ matrix.cfg.runtime }}.zip'" | |
if [ ${{ matrix.cfg.runtime }} != mingw11 ] || [ ${{ matrix.cfg.arch }} != x64 ]; then rm -Rf codac.$PACKAGE_VERSION.nupkg ; fi # To avoid upload conflicts of the same file... | |
checksum -f=codac_${{ matrix.cfg.arch }}_${{ matrix.cfg.runtime }}.zip -t=sha256 | |
shell: bash | |
if: runner.os=='Windows' | |
- run: | | |
cd packages | |
chmod +x ./genlibcodac-dev.sh | |
./genlibcodac-dev.sh ubuntu ${{ matrix.cfg.runtime }} ${{ matrix.cfg.arch }} $SOFTWARE_VERSION $DEBIAN_PACKAGE_REV $PACKAGE_REV | |
cd .. | |
sudo dpkg -i libcodac-dev-$PACKAGE_VERSION\_${{ matrix.cfg.arch }}.deb | |
shell: bash | |
if: runner.os=='Linux' | |
- run: | | |
cp -Rf codac/* /usr/local/ | |
shell: bash | |
if: (runner.os=='macOS')&&(matrix.cfg.arch=='x86_64') | |
- run: | | |
rm -Rf codac | |
cd tests/test_codac | |
cmake ${{ matrix.cfg.cmake_params }} . | |
cmake --build . --config Release | |
file ./${{ matrix.cfg.test_config }}my_project | |
./${{ matrix.cfg.test_config }}my_project | |
cd ../.. | |
shell: bash | |
if: (runner.os!='macOS')||(matrix.cfg.arch=='x86_64') | |
- uses: xresloader/upload-to-github-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
file: "*.zip;*.nupkg;*.deb" | |
overwrite: true | |
tag_name: autotagname-${{ github.sha }} | |
if: (github.event_name != 'pull_request')&&(github.ref_name == 'master') |