Attempts to simplify branches future updates #12
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 checks that the lib runs on ARM | |
on: | |
push: | |
branches: | |
- codac1 | |
- codac2 | |
# The following is implied by above selection... | |
#branches-ignore: | |
#- codac2_codac4matlab | |
tags: '' # Restrict to blank tags | |
pull_request: | |
branches-ignore: | |
- codac2_codac4matlab | |
jobs: | |
dockermatrix: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: ${{ matrix.cfg.shell }} | |
strategy: | |
fail-fast: false | |
matrix: | |
cfg: | |
- { img: 'lebarsfa/manylinux2014_x86_64-for-codac', shell: bash, arch: x86_64, bitness: 64, runtime: manylinux2014, cmake_flags: '-fPIC', desc: 'CentOS manylinux2014 x86_64' } | |
- { img: 'lebarsfa/manylinux2014_aarch64-for-codac', shell: bash, arch: aarch64, bitness: 64, runtime: manylinux2014, cmake_flags: '-fPIC', docker_flags: '--platform linux/arm64', desc: 'CentOS manylinux2014 aarch64' } | |
- { img: 'lebarsfa/pi-64:noble-for-codac', shell: bash, arch: arm64, bitness: 64, runtime: noble, cmake_flags: '-fPIC', deb: true, desc: 'Ubuntu 24.04 arm64' } | |
- { img: 'lebarsfa/pi-64:jammy-for-codac', shell: bash, arch: arm64, bitness: 64, runtime: jammy, cmake_flags: '-fPIC', deb: true, desc: 'Ubuntu 22.04 arm64' } | |
- { img: 'lebarsfa/pi-64:focal-for-codac', shell: bash, arch: arm64, bitness: 64, runtime: focal, cmake_flags: '-fPIC', deb: true, desc: 'Ubuntu 20.04 arm64' } | |
- { img: 'lebarsfa/amd64:bookworm-for-codac', shell: bash, arch: amd64, bitness: 64, runtime: bookworm, cmake_flags: '-fPIC', deb: true, desc: 'Debian Bookworm amd64' } | |
- { img: 'lebarsfa/pi-64:bookworm-for-codac', shell: bash, arch: arm64, bitness: 64, runtime: bookworm, cmake_flags: '-fPIC', deb: true, desc: 'Debian Bookworm arm64' } | |
- { img: 'lebarsfa/pi:bookworm-for-codac', shell: bash, arch: armhf, bitness: 32, runtime: bookworm, cmake_flags: '-fPIC', deb: true, desc: 'Raspbian Bookworm armv6hf' } | |
- { img: 'lebarsfa/amd64:bullseye-for-codac', shell: bash, arch: amd64, bitness: 64, runtime: bullseye, cmake_flags: '-fPIC', deb: true, desc: 'Debian Bullseye amd64' } | |
- { img: 'lebarsfa/pi-64:bullseye-for-codac', shell: bash, arch: arm64, bitness: 64, runtime: bullseye, cmake_flags: '-fPIC', deb: true, desc: 'Debian Bullseye arm64' } | |
- { img: 'lebarsfa/pi:bullseye-for-codac', shell: bash, arch: armhf, bitness: 32, runtime: bullseye, cmake_flags: '-fPIC', deb: true, desc: 'Raspbian Bullseye armv6hf' } | |
- { img: 'lebarsfa/amd64:buster-for-codac', shell: bash, arch: amd64, bitness: 64, runtime: buster, cmake_flags: '-fPIC', deb: true, desc: 'Debian Buster amd64' } | |
- { img: 'lebarsfa/pi-64:buster-for-codac', shell: bash, arch: arm64, bitness: 64, runtime: buster, cmake_flags: '-fPIC', deb: true, desc: 'Debian Buster arm64' } | |
- { img: 'lebarsfa/pi:buster-for-codac', shell: bash, arch: armhf, bitness: 32, runtime: buster, cmake_flags: '-fPIC', deb: true, desc: 'Raspbian Buster armv6hf' } | |
name: ${{ matrix.cfg.desc }} | |
steps: | |
- uses: actions/checkout@v4 | |
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: echo "PACKAGE_VERSION=$SOFTWARE_VERSION-${DEBIAN_PACKAGE_REV}${{ matrix.cfg.runtime }}$PACKAGE_REV" >> $GITHUB_ENV | |
shell: bash | |
if: matrix.cfg.deb==true | |
- run: | | |
sudo apt-get -y install qemu binfmt-support qemu-user-static || true | |
#docker run --rm --privileged multiarch/qemu-user-static:register --reset | |
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes | |
if: (matrix.cfg.arch!='amd64')&&(matrix.cfg.arch!='x86_64')&&(matrix.cfg.arch!='i386') | |
- run: | | |
docker run ${{ matrix.cfg.docker_flags }} -i -v "${PWD}/..:${PWD}/.." ${{ matrix.cfg.img }} /bin/bash -c "uname -a ; cat /etc/os-release ; lsb_release -a ; cd ${PWD} && pwd && \ | |
git config --global --add safe.directory ${PWD} && \ | |
if [ ${{ matrix.cfg.deb }} = true ]; then \ | |
#sudo sh -c 'echo \"deb [trusted=yes] https://packages.ensta-bretagne.fr/\$(if [ -z \"\$(. /etc/os-release && echo \$UBUNTU_CODENAME)\" ]; then echo debian/\$(. /etc/os-release && echo \$VERSION_CODENAME); else echo ubuntu/\$(. /etc/os-release && echo \$UBUNTU_CODENAME); fi) ./\" > /etc/apt/sources.list.d/ensta-bretagne.list' && \\ | |
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.20240417/libibex-dev-2.8.9.20240417-0${{ matrix.cfg.runtime }}0_\$(dpkg --print-architecture).deb --no-check-certificate -nv && \ | |
sudo dpkg -i libibex-dev-2.8.9.20240417-0${{ matrix.cfg.runtime }}0_\$(dpkg --print-architecture).deb && \ | |
rm -Rf libibex-dev-2.8.9.20240417-0${{ matrix.cfg.runtime }}0_\$(dpkg --print-architecture).deb ; \ | |
else \ | |
wget https://github.com/lebarsfa/ibex-lib/releases/download/ibex-2.8.9.20240417/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/ ; \ | |
fi && \ | |
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 . -j 4 --config Debug --target install && \ | |
cd .. && \ | |
zip -q -r codac_${{ matrix.cfg.arch }}_${{ matrix.cfg.runtime }}.zip codac && \ | |
mkdir -p codac_standalone/example ; cd codac_standalone && \ | |
if [ ${{ matrix.cfg.deb }} = true ]; 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/ ; \ | |
else 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 && \ | |
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 ../.. && \ | |
if [ ${{ matrix.cfg.deb }} = true ]; then \ | |
cd packages && \ | |
chmod +x ./genlibcodac-dev.sh && \ | |
./genlibcodac-dev.sh \$(if [ -z \"\$(. /etc/os-release && echo \$UBUNTU_CODENAME)\" ]; then echo debian; else echo ubuntu; fi) ${{ matrix.cfg.runtime }} \$(dpkg --print-architecture) $SOFTWARE_VERSION $DEBIAN_PACKAGE_REV $PACKAGE_REV && \ | |
cd .. && \ | |
sudo dpkg -i libcodac-dev-$PACKAGE_VERSION\_\$(dpkg --print-architecture).deb ; \ | |
else \ | |
sudo cp -Rf codac/* /usr/local/ ; \ | |
fi && \ | |
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 ../.." | |
- uses: xresloader/upload-to-github-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
file: "*.zip;*.deb" | |
overwrite: true | |
tag_name: autotagname-${{ github.sha }} | |
if: (github.event_name!='pull_request')&&((github.ref_name=='codac1')||(github.ref_name=='codac2')||(github.ref_name=='codac2_codac4matlab')) |