refactoring #1262
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
name: ci | |
on: | |
push: {branches-ignore: [latest], tags: ['*']} | |
pull_request: | |
env: | |
PACKAGE_NAME: ${{ github.event.repository.name }} | |
PACKAGE_VERSION: ${{ github.sha }} | |
MYCI_NEXUS_USERNAME: cppfw | |
MYCI_NEXUS_PASSWORD: ${{ secrets.MYCI_NEXUS_PASSWORD }} | |
MYCI_GIT_USERNAME: igagis | |
MYCI_GIT_PASSWORD: ${{ secrets.MYCI_GIT_ACCESS_TOKEN }} | |
jobs: | |
##### coverage ##### | |
coverage: | |
runs-on: ubuntu-latest | |
container: debian:bookworm | |
name: coverage - measure | |
env: | |
linux_distro: debian | |
linux_release: bookworm | |
steps: | |
- name: add cppfw deb repo | |
uses: myci-actions/add-deb-repo@master | |
with: | |
repo: deb https://gagis.hopto.org/repo/cppfw/${{ env.linux_distro }} ${{ env.linux_release }} main | |
repo-name: cppfw | |
keys-asc: https://gagis.hopto.org/repo/cppfw/pubkey.gpg | |
install: myci locales git pipx | |
- name: add llvm repo (for clang-format) | |
uses: myci-actions/add-deb-repo@master | |
with: | |
repo: deb https://apt.llvm.org/${{ env.linux_release }} llvm-toolchain-${{ env.linux_release }} main | |
repo-name: llvm | |
keys-asc: https://apt.llvm.org/llvm-snapshot.gpg.key | |
- name: git clone | |
uses: myci-actions/checkout@master | |
- name: prepare debian package | |
run: myci-deb-prepare.sh | |
- name: install deps | |
run: myci-deb-install-build-deps.sh | |
- name: build | |
run: make config=gcov | |
- name: test | |
run: make config=gcov test | |
- name: generate coverage report | |
run: pipx run gcovr --exclude-throw-branches --filter src/ --cobertura > cobertura.xml | |
- name: upload coverage report to artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: cobertura.xml | |
path: cobertura.xml | |
- name: upload coverage data to codecov.io | |
uses: codecov/codecov-action@v4 | |
if: always() # even if previous steps fail, this one needs to be run | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
# do not search for coverage files automatically, upload only specified files | |
disable_search: true | |
files: cobertura.xml | |
# flags: unittests # optional | |
name: codecov-umbrella # optional | |
fail_ci_if_error: true # optional (default = false) | |
verbose: true # optional (default = false) | |
##### sanitizer ##### | |
sanitizer: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- {os: debian, codename: bookworm, image_owner: , package_type: deb} | |
- {os: debian, codename: bookworm, image_owner: , package_type: deb, labels: [arm32,docker]} | |
- {os: debian, codename: bookworm, image_owner: , package_type: deb, labels: [arm64,docker]} | |
runs-on: ${{ (matrix.labels == '' && 'ubuntu-latest') || matrix.labels }} | |
container: ${{ matrix.image_owner }}${{ matrix.os }}:${{ matrix.codename }} | |
name: sanitizer - ${{ matrix.image_owner }}${{ matrix.os }}:${{ matrix.codename }} - ${{ matrix.labels[0] }} | |
steps: | |
- name: add llvm repo (for clang-format) | |
uses: myci-actions/add-deb-repo@master | |
with: | |
repo: deb https://apt.llvm.org/${{ matrix.codename }} llvm-toolchain-${{ matrix.codename }} main | |
repo-name: llvm | |
keys-asc: https://apt.llvm.org/llvm-snapshot.gpg.key | |
- name: add cppfw deb repo | |
uses: myci-actions/add-deb-repo@master | |
with: | |
repo: deb https://gagis.hopto.org/repo/cppfw/${{ matrix.os }} ${{ matrix.codename }} main | |
repo-name: cppfw | |
keys-asc: https://gagis.hopto.org/repo/cppfw/pubkey.gpg | |
install: myci git | |
- name: install ci tools | |
run: | | |
apt install --assume-yes devscripts equivs | |
- name: git clone | |
uses: myci-actions/checkout@master | |
- name: prepare debian package | |
run: myci-deb-prepare.sh | |
- name: install deps | |
run: myci-deb-install-build-deps.sh | |
- name: build | |
run: make config=asan | |
- name: test | |
run: make config=asan test | |
##### deb linux ##### | |
deb: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
# - {os: debian, codename: buster, image_owner: , package_type: deb} | |
# - {os: debian, codename: buster, image_owner: i386/, package_type: deb, labels: [i386,docker]} | |
# - {os: debian, codename: buster, image_owner: arm32v7/, package_type: deb, labels: [arm32,docker]} | |
# - {os: debian, codename: bullseye, image_owner: , package_type: deb} | |
# - {os: debian, codename: bullseye, image_owner: , package_type: deb, labels: [i386,docker]} | |
# - {os: debian, codename: bullseye, image_owner: , package_type: deb, labels: [arm32,docker]} | |
# - {os: debian, codename: bullseye, image_owner: , package_type: deb, labels: [arm64,docker]} | |
- {os: debian, codename: bookworm, image_owner: , package_type: deb} | |
# - {os: debian, codename: bookworm, image_owner: , package_type: deb, labels: [i386,docker]} | |
- {os: debian, codename: bookworm, image_owner: , package_type: deb, labels: [arm32,docker]} | |
- {os: debian, codename: bookworm, image_owner: , package_type: deb, labels: [arm64,docker]} | |
# - {os: ubuntu, codename: focal, image_owner: , package_type: deb} | |
- {os: ubuntu, codename: jammy, image_owner: , package_type: deb} | |
- {os: ubuntu, codename: noble, image_owner: , package_type: deb} | |
# - {os: raspbian, codename: buster, image_owner: igagis/, package_type: deb, labels: [arm32,docker]} | |
# - {os: raspbian, codename: bullseye, image_owner: igagis/, package_type: deb, labels: [arm32,docker]} | |
- {os: raspbian, codename: bookworm, image_owner: igagis/, package_type: deb, labels: [arm32,docker]} | |
runs-on: ${{ (matrix.labels == '' && 'ubuntu-latest') || matrix.labels }} | |
container: ${{ matrix.image_owner }}${{ matrix.os }}:${{ matrix.codename }} | |
name: linux - ${{ matrix.image_owner }}${{ matrix.os }}:${{ matrix.codename }} - ${{ matrix.labels[0] }} | |
steps: | |
# - name: set TZ for ubuntu:focal | |
# run: | | |
# # configure timezone to avoid 'tzdata' package to require user interaction during installation (needed for ubuntu:focal) | |
# TZ=Europe/Helsinki ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone | |
- name: add llvm repo (for clang-format) | |
uses: myci-actions/add-deb-repo@master | |
with: | |
repo: deb https://apt.llvm.org/${{ matrix.codename }} llvm-toolchain-${{ matrix.codename }} main | |
repo-name: llvm | |
keys-asc: https://apt.llvm.org/llvm-snapshot.gpg.key | |
- name: add cppfw deb repo | |
uses: myci-actions/add-deb-repo@master | |
with: | |
repo: deb https://gagis.hopto.org/repo/cppfw/${{ matrix.os }} ${{ matrix.codename }} main | |
repo-name: cppfw | |
keys-asc: https://gagis.hopto.org/repo/cppfw/pubkey.gpg | |
install: myci git devscripts equivs | |
- name: git clone | |
uses: myci-actions/checkout@master | |
- name: set PACKAGE_VERSION | |
uses: myci-actions/export-env-var@master | |
with: {name: PACKAGE_VERSION, value: $(myci-deb-version.sh debian/changelog)} | |
- name: prepare debian package | |
run: myci-deb-prepare.sh | |
- name: install deps | |
run: myci-deb-install-build-deps.sh | |
- name: build | |
run: dpkg-buildpackage --unsigned-source --unsigned-changes | |
- name: deploy deb packages | |
run: | | |
echo "${{ secrets.MYCI_REPO_SSH_KEY }}" > repo_key_rsa && chmod 600 repo_key_rsa | |
myci-deploy-apt-ssh.sh --key repo_key_rsa --server gagis.hopto.org --repo cppfw/${{ matrix.os }} --distro ${{ matrix.codename }} --component main ../lib${PACKAGE_NAME}*_${PACKAGE_VERSION}_*.*deb | |
if: matrix.package_type == 'deb' && startsWith(github.ref, 'refs/tags/') | |
##### macosx ##### | |
macosx: | |
runs-on: macos-latest | |
steps: | |
- name: workaround python2 and python3 issue when upgrading python | |
run : | | |
rm -rf /usr/local/bin/2to3* | |
rm -rf /usr/local/bin/idle3* | |
rm -rf /usr/local/bin/pydoc3* | |
rm -rf /usr/local/bin/python3 | |
rm -rf /usr/local/bin/python3-config | |
rm -rf /usr/local/bin/python3* | |
rm -rf /usr/local/bin/python3*-config | |
- name: git clone | |
uses: myci-actions/checkout@master | |
- name: install clang-tidy and clang-format | |
run: | | |
brew install llvm | |
ln -s "$(brew --prefix llvm)/bin/clang-format" "/usr/local/bin/clang-format" | |
ln -s "$(brew --prefix llvm)/bin/clang-tidy" "/usr/local/bin/clang-tidy" | |
ln -s "$(brew --prefix llvm)/bin/clang-apply-replacements" "/usr/local/bin/clang-apply-replacements" | |
- name: add cppfw tap | |
run: | | |
brew tap cppfw/tap | |
brew update | |
- name: install ci tools | |
run: brew install myci make | |
- name: set PATH to use latest make | |
uses: myci-actions/export-env-var@master | |
with: {name: PATH, value: "$HOMEBREW_PREFIX/opt/make/libexec/gnubin:$PATH"} | |
- name: set CFLAGS | |
uses: myci-actions/export-env-var@master | |
with: {name: CFLAGS, value: "-isystem $HOMEBREW_PREFIX/include $CFLAGS"} | |
- name: set CXXFLAGS | |
uses: myci-actions/export-env-var@master | |
with: {name: CXXFLAGS, value: "-isystem $HOMEBREW_PREFIX/include $CXXFLAGS"} | |
- name: set LDFLAGS | |
uses: myci-actions/export-env-var@master | |
with: {name: LDFLAGS, value: "-L $HOMEBREW_PREFIX/lib $LDFLAGS"} | |
- name: install deps | |
run: myci-brew-install.sh `myci-list-deps-homebrew.sh` | |
- name: build | |
run: make --include-dir=$(brew --prefix)/include | |
- name: test | |
run: make --include-dir=$(brew --prefix)/include test | |
- name: deploy | |
run: myci-deploy-homebrew.sh --tap cppfw/tap | |
if: startsWith(github.ref, 'refs/tags/') | |
##### ios ##### | |
ios: | |
runs-on: macos-latest | |
steps: | |
- name: workaround python2 and python3 issue when upgrading python | |
run : | | |
rm -rf /usr/local/bin/2to3* | |
rm -rf /usr/local/bin/idle3* | |
rm -rf /usr/local/bin/pydoc3* | |
rm -rf /usr/local/bin/python3 | |
rm -rf /usr/local/bin/python3-config | |
rm -rf /usr/local/bin/python3* | |
rm -rf /usr/local/bin/python3*-config | |
- name: add cppfw tap | |
run: | | |
brew tap cppfw/tap | |
brew update | |
- name: install ci tools | |
run: brew install myci | |
- name: git clone | |
uses: myci-actions/checkout@master | |
- name: set PACKAGE_VERSION | |
uses: myci-actions/export-env-var@master | |
with: {name: PACKAGE_VERSION, value: $(myci-deb-version.sh debian/changelog)} | |
- name: add cocoapods repo | |
run: pod repo add --silent cppfw https://$MYCI_GIT_USERNAME@github.com/cppfw/cocoapods-repo.git | |
- name: install deps | |
run: pod install --project-directory=xcode | |
- name: add sources to xcode project | |
run: | | |
curl -L https://github.com/zackslash/Xcode-Proj-Adder/raw/master/bin/XcodeProjAdder -O | |
chmod +x XcodeProjAdder | |
cd xcode/$PACKAGE_NAME | |
../../XcodeProjAdder -XCP $PACKAGE_NAME.xcodeproj -SCSV `echo $(find ../../src -type f -name *.cpp) | sed -E -e 's/ /,/g'` | |
- name: build | |
run: | | |
xcodebuild CONFIGURATION_BUILD_DIR=../build_ios -sdk iphoneos -workspace xcode/$PACKAGE_NAME.xcworkspace -scheme $PACKAGE_NAME -configuration Release | |
xcodebuild CONFIGURATION_BUILD_DIR=../build_iossim -sdk iphonesimulator -workspace xcode/$PACKAGE_NAME.xcworkspace -scheme $PACKAGE_NAME -configuration Release | |
xcodebuild -create-xcframework -framework "xcode/build_ios/$PACKAGE_NAME.framework" -framework "xcode/build_iossim/$PACKAGE_NAME.framework" -output "xcode/$PACKAGE_NAME.xcframework" | |
- name: create package | |
run: myci-create-zip-package.sh --headers-dir src --file res/ruis_res///res --file xcode/$PACKAGE_NAME.xcframework///lib/ios --file LICENSE $PACKAGE_NAME-$PACKAGE_VERSION.zip | |
- name: deploy | |
run: | | |
echo "${{ secrets.MYCI_REPO_SSH_KEY }}" > repo_key_rsa && chmod 600 repo_key_rsa | |
myci-deploy-cocoapods-ssh.sh --repo cppfw --version $PACKAGE_VERSION --server gagis.hopto.org --key repo_key_rsa --generic-repo cppfw/cocoapods --package $PACKAGE_NAME-$PACKAGE_VERSION.zip cocoapods/$PACKAGE_NAME.podspec.in | |
if: startsWith(github.ref, 'refs/tags/') | |
##### android ##### | |
android: | |
runs-on: ubuntu-latest | |
container: mingc/android-build-box:latest | |
steps: | |
- name: git clone | |
uses: myci-actions/checkout@master | |
- name: add cppfw deb repo | |
uses: myci-actions/add-deb-repo@master | |
with: | |
repo: deb https://gagis.hopto.org/repo/cppfw/$(lsb_release --id --short | tr '[:upper:]' '[:lower:]') $(lsb_release --codename --short) main | |
repo-name: cppfw | |
keys-asc: https://gagis.hopto.org/repo/cppfw/pubkey.gpg | |
install: myci ninja-build | |
- name: set PACKAGE_VERSION | |
uses: myci-actions/export-env-var@master | |
with: {name: PACKAGE_VERSION, value: $(myci-deb-version.sh debian/changelog)} | |
- name: build | |
run: | | |
cd android | |
./gradlew copy_aar --warning-mode all | |
myci-apply-version.sh --version $PACKAGE_VERSION *.pom.in | |
myci-apply-version.sh --version $PACKAGE_VERSION *.aar.in --filename-only | |
- name: deploy | |
run: myci-deploy-maven-nexus.sh --base-url https://gagis.hopto.org/nexus --repo android android/$PACKAGE_NAME-$PACKAGE_VERSION.aar | |
if: startsWith(github.ref, 'refs/tags/') | |
##### msys2 ##### | |
msys2: | |
runs-on: windows-latest | |
defaults: | |
run: | |
shell: msys2 {0} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- {arch: i686, repo: mingw32} | |
- {arch: x86_64, repo: mingw64} | |
name: msys2 - ${{ matrix.repo }} | |
steps: | |
- name: make msys2 to provide the default shell | |
uses: msys2/setup-msys2@v2 | |
with: | |
update: true | |
msystem: MSYS | |
install: >- | |
msys2-devel | |
mingw-w64-${{ matrix.arch }}-toolchain | |
- name: add cppfw pacman msys repo | |
uses: myci-actions/add-pacman-repo@master | |
with: | |
name: cppfw_msys | |
url: https://gagis.hopto.org/repo/cppfw/msys2/msys | |
shell: 'msys2 {0}' | |
key-server: https://gagis.hopto.org/repo/cppfw/pubkey.gpg | |
install: myci | |
- name: add cppfw pacman msys/mingw repo | |
uses: myci-actions/add-pacman-repo@master | |
with: | |
name: cppfw_${{ matrix.repo }} | |
url: https://gagis.hopto.org/repo/cppfw/msys2/${{ matrix.repo }} | |
shell: 'msys2 {0}' | |
key-server: https://gagis.hopto.org/repo/cppfw/pubkey.gpg | |
- name: git clone | |
uses: myci-actions/checkout@master | |
- name: prepare pacman package | |
run: myci-apply-version.sh --version $(myci-deb-version.sh debian/changelog) msys2/PKGBUILD.in | |
- name: build | |
# to make makepkg-mingw build only one architecture we need to set the MINGW_ARCH | |
env: {MINGW_ARCH: '${{ matrix.repo }}'} | |
run: | | |
cd msys2 | |
PKGEXT='.pkg.tar.xz' makepkg-mingw --syncdeps --noconfirm --skipinteg | |
- name: deploy | |
run: | | |
echo "${{ secrets.MYCI_REPO_SSH_KEY }}" > repo_key_rsa && chmod 600 repo_key_rsa | |
for f in $(find msys2 -name "mingw-w64-${{ matrix.arch }}-$PACKAGE_NAME-*-any.pkg.*"); do | |
myci-deploy-pacman-ssh.sh --server gagis.hopto.org --key repo_key_rsa --repo cppfw/msys2/${{ matrix.repo }} --database cppfw_${{ matrix.repo }} $f | |
done | |
if: startsWith(github.ref, 'refs/tags/') | |
##### msvs ##### | |
msvs: | |
runs-on: windows-latest | |
defaults: | |
run: | |
shell: powershell | |
steps: | |
- name: git clone | |
uses: actions/checkout@v4 | |
with: {submodules: true} | |
- name: install CoAPP tools | |
uses: myci-actions/install-coapp-tools@master | |
- name: nuget update | |
run: | | |
nuget restore msvs_solution/msvs_solution.sln | |
nuget update msvs_solution/msvs_solution.sln | |
- name: add msbuild to PATH | |
uses: microsoft/setup-msbuild@v2 | |
- name: build | |
run: .\nuget\build_nuget.ps1 | |
- name: correct structure of the bin dir inside nuget package | |
run: .\nuget\keep_bin_dir_structure.ps1 | |
- name: deploy | |
uses: myci-actions/publish-nuget@master | |
with: | |
filename: '.\nuget\*.nupkg' | |
api-key: ${{ secrets.NUGET_DOT_ORG_API_KEY }} | |
if: startsWith(github.ref, 'refs/tags/') | |