From 4374bc6d49f2eb1ac8d5f9349677cd7d03c84ad7 Mon Sep 17 00:00:00 2001 From: Ivan Gagis Date: Thu, 9 Jan 2025 16:57:32 +0200 Subject: [PATCH] add ci --- .github/workflows/ci.yml | 161 +++++++++++++++++++++++++++++++++++++++ .vscode/launch.json | 28 +++++++ .vscode/tasks.json | 86 +++++++++++++++++++++ 3 files changed, 275 insertions(+) create mode 100644 .github/workflows/ci.yml create mode 100644 .vscode/launch.json create mode 100644 .vscode/tasks.json diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..19515a1 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,161 @@ +name: ci +on: + push: {branches-ignore: [latest], tags: ['*']} + pull_request: +env: + PACKAGE_NAME: ${{ github.event.repository.name }} + PACKAGE_VERSION: ${{ github.sha }} +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: } + - {os: debian, codename: bookworm, image_owner: , labels: [arm32,docker]} + - {os: debian, codename: bookworm, image_owner: , 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 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 locales git + - 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: install ci tools + run: | + apt --quiet 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: bullseye, image_owner: } + # - {os: debian, codename: bullseye, image_owner: , labels: [i386,docker]} + # - {os: debian, codename: bullseye, image_owner: , labels: [arm32,docker]} + # - {os: debian, codename: bullseye, image_owner: , labels: [arm64,docker]} + - {os: debian, codename: bookworm, image_owner: } + - {os: debian, codename: bookworm, image_owner: , labels: [arm32,docker]} + - {os: debian, codename: bookworm, image_owner: , labels: [arm64,docker]} + # - {os: ubuntu, codename: focal, image_owner: } + - {os: ubuntu, codename: jammy, image_owner: } + - {os: ubuntu, codename: noble, image_owner: } + # - {os: raspbian, codename: buster, image_owner: igagis/, labels: [arm32,docker]} + # - {os: raspbian, codename: bullseye, image_owner: igagis/, labels: [arm32,docker]} + - {os: raspbian, codename: bookworm, image_owner: igagis/, 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 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 locales git devscripts equivs nodejs + - 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: 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 + mv ../*.*deb . + - name: upload deb packages to artifacts + uses: actions/upload-artifact@v4 + with: + name: ${{ matrix.os }}_${{ matrix.codename }}_${{ matrix.labels[0] }}_debs + path: "*.*deb" + - 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 gagistech/${{ matrix.os }} --distro ${{ matrix.codename }} --component main *_${PACKAGE_VERSION}_*.*deb + if: startsWith(github.ref, 'refs/tags/') diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..3eb03f0 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,28 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "(gdb) app", + "type": "cppdbg", + "request": "launch", + "program": "${workspaceFolder}/src/out/dbg/thermostat-opengles-xorg", + "args": ["--window", "--res-path=res"], + "stopAtEntry": false, + "cwd": "${workspaceFolder}", + "environment": [], + "externalConsole": false, + "MIMode": "gdb", + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + } + ], + "preLaunchTask": "build_dbg" + }, + ] +} diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..8a52a12 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,86 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "build", + "type": "shell", + "command": "make", + "problemMatcher": [ + "$gcc" + ], + "group": "build" + }, + { + "label": "build_dbg", + "type": "shell", + "command": "make config=dbg", + "problemMatcher": [ + "$gcc" + ], + "group": "build" + }, + { + "label": "clean-all", + "type": "shell", + "command": "make clean-all", + "problemMatcher": [], + "group": "build" + }, + { + "label": "clean_dbg", + "type": "shell", + "command": "make clean config=dbg", + "problemMatcher": [], + "group": "build" + }, + { + "label": "run-app-opengles-xorg", + "type": "shell", + "command": "make run-app-opengles-xorg", + "problemMatcher": [], + "group": "build" + }, + { + "label": "run-app-opengles-xorg_dbg", + "type": "shell", + "command": "make run-app-opengles-xorg config=dbg", + "problemMatcher": [], + "group": "build" + }, + { + "label": "run-app-opengles-wayland", + "type": "shell", + "command": "make run-app-opengles-wayland", + "problemMatcher": [], + "group": "build" + }, + { + "label": "run-app-opengles-wayland_dbg", + "type": "shell", + "command": "make run-app-opengles-wayland config=dbg", + "problemMatcher": [], + "group": "build" + }, + { + "label": "test_", + "type": "shell", + "command": "make test", + "problemMatcher": [], + "group": "build" + }, + { + "label": "test_dbg", + "type": "shell", + "command": "make test config=dbg", + "problemMatcher": [], + "group": "build" + }, + { + "label": "format", + "type": "shell", + "command": "make format", + "problemMatcher": [], + "group": "build" + } + ] +} \ No newline at end of file