Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update to 0.52.4 #2

Merged
merged 51 commits into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
641cab6
add gitlab ci pipeline
friedz Feb 21, 2024
1d3b8c5
Handle ci environment correctly
friedz Feb 21, 2024
a80cd25
update code coverage dependecy graph for gitlab ci
friedz Feb 21, 2024
95ece57
Fix documentation build
friedz Feb 21, 2024
87a8afb
Enable documentation build in ci
friedz Feb 21, 2024
e153399
Fix versions for documentation build
friedz Feb 21, 2024
ce0d2be
move variables from gitlab-ci.yml to pipline configuration
friedz Feb 22, 2024
f186c2c
Add empty rules to hopefully trick GitLab into accepting
friedz Feb 22, 2024
4137f1c
elos: Update to 0.52.0
gehwolf Feb 26, 2024
60e1c88
Merge branch 'task/#21331-add-gitlab-ci' into 'integration'
gehwolf Feb 26, 2024
5c02abc
add commmon_names.sh to collect variables used in different places
friedz Feb 27, 2024
6c85f09
use common_names.sh in docker-run.sh
friedz Feb 27, 2024
b55fccf
use common_names in build.sh
friedz Feb 27, 2024
0db6806
use common_names.sh in run_utest.sh
friedz Feb 27, 2024
c647648
add common CMAKE_BUILD_DIR variable
friedz Feb 27, 2024
a241e02
install capstone and tabview with proper version
friedz Feb 27, 2024
6b901b6
use common_names to create coverage
friedz Feb 27, 2024
8e304bc
use common_names.sh in checklicense.sh
friedz Feb 27, 2024
6560a6f
update clean.sh
friedz Feb 27, 2024
17d5198
update package.sh with common_names.sh
friedz Feb 27, 2024
2c6c766
update publish_kpis.sh with common_names.sh
friedz Feb 27, 2024
61faea0
update build_doc.sh
friedz Feb 27, 2024
5c47321
remove tapview
friedz Mar 5, 2024
34a1c39
enable overriding of build type for run_asmcov
gehwolf Mar 5, 2024
1818e37
Update to 0.52.1
gehwolf Mar 6, 2024
27c5ebc
Merge branch 'task/#21338-refactor-common-variables-and-path-names-in…
gehwolf Mar 6, 2024
4b749f4
add install_deps.py and configurations to install dependencies
friedz Feb 29, 2024
b08ff5d
Remove fetch_content from cmake script
friedz Feb 29, 2024
3908b8e
add separete job for dependency build to ci
friedz Feb 29, 2024
3ee9065
update dependency install for Jenkins
friedz Feb 29, 2024
407606c
update CONFIG.ini to reflect variables used
friedz Mar 5, 2024
613149f
switch dependency build to be stored as artifacts
friedz Mar 5, 2024
97ab261
Sort environment variables for easier readability
friedz Mar 5, 2024
0ac84a9
Add documentation for ci
friedz Mar 12, 2024
f0e1071
Completely disable code coverage and kpis publish step in ci
friedz Mar 12, 2024
ca05e3d
elos: Update to 0.52.2
gehwolf Mar 12, 2024
76f0261
Merge branch 'task/#21333-refactor-fetch_content-out-of-cmake' into '…
gehwolf Mar 12, 2024
ab0cab9
Add cmake option for mock lib and default build
friedz Mar 6, 2024
93cf2a0
add option to ci/clean to keep installed dependencies
friedz Mar 6, 2024
f862320
Automatically generate documentation for cmake options
friedz Mar 13, 2024
81ca3f6
Update to 0.52.3
gehwolf Mar 13, 2024
df5eb75
Merge branch 'task/#21337-add-cmake-options-to-enable-or-disable-sepa…
gehwolf Mar 13, 2024
b9e5f1c
add github action to build documentation
friedz Mar 6, 2024
b3fece5
add github action to build safu
friedz Mar 6, 2024
e608a5a
fix test report result dir
friedz Mar 6, 2024
531fe86
add unit tests to github actions
friedz Mar 6, 2024
aec2ac5
update upload artefact action
friedz Mar 6, 2024
6d2483a
update deploy-pages version
friedz Mar 6, 2024
5a5e7dc
Add documentation for github actions
friedz Mar 13, 2024
0625a72
Update to 0.52.4
gehwolf Mar 13, 2024
7e54e7f
Merge branch 'task/#21677-add-github-actions' into 'integration'
gehwolf Mar 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions .github/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@

# CI with GitHub Actions

## Intentions in using GitHub Actions

We want to test all PRs before mergeing by:
- [x] build test
- [ ] code linting
- [ ] license check
- [x] unit-tests
- [ ] creating a test coverage report
- [ ] smoke tests
- [ ] integration tests
- [ ] running benchmarks
- [ ] automatic upload of new releases

## How to develop GitHub Actions

Find a detailed documentation [here](https://docs.github.com/de/actions)

### Adding Badges with CI status

Paste a link in the form of `![badge](https://github.com/Elektrobit/safu/actions/workflows/build-and-test.yml/badge.svg)` where you want to integrate the badge for the `build-and-test` workflow.

Find an explanation [here](https://docs.github.com/de/actions/monitoring-and-troubleshooting-workflows/adding-a-workflow-status-badge)

### Running GitHub Actions locally

To run the GitHub Actions locally [act](https://github.com/nektos/act) can be used.

The way the Actions are written right now they need an ubuntu image with passwordless sudo.
With that image build under the tag `ubuntu-sudo` the command can be run:

```bash
act -P ubuntu-latest=ubuntu-sudo --pull=false --artifact-server-path=/tmp/artifacts
```
which leaves the build artefacts under `/tmp/artifacts`


### known issues

- job artefacts lose their permissions so executables are no longer set as executable when downloaded in a different job
- a possibility to fix that ist to run `chmod` on all files needing specific permissions.
for example to make all utests in the Release build folder executable:
```bash
for test in $(find build/Release/cmake/ -name "*_utest"); do
chmod +x $test
done
```
- uploading and downloading artefacts with `actions/upload-artifact` & `actions/download-artifact` takes a very long time, especially with artefacts containing a lot of (small) files.
56 changes: 56 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@

name: Build and Test
on: [ push, workflow_dispatch, pull_request ]

jobs:
build-and-test:
runs-on: ubuntu-latest
strategy:
matrix:
build_type: [Debug, Release]
steps:
- uses: actions/checkout@v4
- name: Install Build Dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
build-essential \
cmake \
curl \
git \
libcmocka-dev \
libcurl4-openssl-dev \
libesmtp-dev \
libjson-c-dev \
liblog4c-dev \
libmnl-dev \
libsqlite3-0 \
libsqlite3-dev \
libssl-dev \
ninja-build \
pkg-config \
python-is-python3 \
python3-pip \
python3-venv \
sqlite3
- name: checkout and build dependecies
run: ci/install_deps.py -G
- name: Build ${{ matrix.build_type }}
env:
DESTDIR: ${{ github.workspace }}/build/${{ matrix.build_type }}/dist
run: |
cmake -B ./build/${{ matrix.build_type }}/cmake . -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
make -C ./build/${{ matrix.build_type }}/cmake all install
- name: save build artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.build_type }}-build
path: build/${{ matrix.build_type}}/dist
- name: run unit tests (${{ matrix.build_type }})
run: ci/run_utest.sh ${{ matrix.build_type }}
- name: save ${{ matrix.build_type }} unit test report
uses: actions/upload-artifact@v4
if: always()
with:
name: ${{ matrix.build_type }}-test-report
path: build/${{ matrix.build_type }}/result/unit_test/
88 changes: 88 additions & 0 deletions .github/workflows/build-documentation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@

name: Build Documentation
on: [ push, workflow_dispatch, pull_request ]

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
documentation:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Build Dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
curl \
expat \
git \
locales \
net-tools \
netcat \
nodejs \
pandoc \
plantuml \
python-is-python3 \
python3-pip \
python3-venv \
wget \
- name: setup python Virtual env
run: |
python -m venv ${{ github.workspace }}/.venv
. ${{ github.workspace }}/.venv/bin/activate
python -m pip install \
beautifulsoup4==4.12.2 \
clang==16.0.1.1 \
sphinx==7.2.6 \
sphinx-c-autodoc==1.3.0 \
sphinx-copybutton==0.5.2 \
sphinx-favicon==1.0.1 \
sphinxcontrib-programoutput==0.17
- name: install libcland 16 for sphinx c autodoc
# needet as long as libclang 16 isn't packaged in ubuntu-latest
run: |
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc
echo "" | sudo tee -a /etc/apt/sources.list
echo "# for llvm 16 packages" | sudo tee -a /etc/apt/sources.list
echo "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-16 main" | sudo tee -a /etc/apt/sources.list
echo "deb-src http://apt.llvm.org/jammy/ llvm-toolchain-jammy-16 main" | sudo tee -a /etc/apt/sources.list
cat /etc/apt/sources.list
sudo apt-get update
sudo apt-get install -y libclang1-16
sudo ln -s /usr/lib/x86_64-linux-gnu/libclang-16.so.1 /usr/lib/libclang-16.so
- name: Build Documentation
run: ci/build_doc.sh
env:
SPHINX_VENV: "${{ github.workspace }}/.venv"
- name: pack documentation for GitHub pages
run: |
tar \
--dereference --hard-dereference \
--directory "${{ github.workspace }}/build/doc/" \
-cvf "$RUNNER_TEMP/artifact.tar" \
.
- name: save documentation
uses: actions/upload-artifact@v4
with:
name: github-pages
path: ${{ runner.temp }}/artifact.tar
if-no-files-found: error

publish-gh-pages:
runs-on: ubuntu-latest
if: ${{ github.ref_name == 'main' }}
needs: documentation
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
121 changes: 121 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@

stages:
- build
- test

default:
image: docker:24-dind
services:
- name: docker:24-dind
alias: docker
tags:
- "shell"

before_script:
- 'command -v ssh-agent >/dev/null || ( apt-get update -y && apt-get install openssh-client -y )'
- docker info
- ip a
- ss -antup
- env | sort

build-dependencies:
stage: build
needs: []
script:
- ci/docker-run.sh ci/install_deps.py -c ci/dependencies_emlix.json
artifacts:
paths:
- build/deps/lib/
- build/deps/include/

build-release:
stage: build
needs: [build-dependencies]
script:
- ci/docker-run.sh ci/build.sh --ci Release
artifacts:
paths:
- build/Release/dist/
- build/Release/cmake/

build-debug:
stage: build
needs: [build-dependencies]
script:
- ci/docker-run.sh ci/build.sh --ci Debug
artifacts:
paths:
- build/Debug/dist/
- build/Debug/cmake/

unit-test-release:
stage: test
needs:
- build-release
- build-dependencies
script:
- ci/docker-run.sh ci/run_utest.sh Release
artifacts:
when: always
paths:
- build/Release/result/unit_test/
reports:
junit: build/Release/result/unit_test/junit.xml

unit-test-debug:
stage: test
needs:
- build-debug
- build-dependencies
script:
- ci/docker-run.sh ci/run_utest.sh Debug
artifacts:
when: always
paths:
- build/Debug/result/unit_test/
reports:
junit: build/Debug/result/unit_test/junit.xml

code-lint:
stage: test
needs:
- build-release
- build-dependencies
script:
- ci/docker-run.sh ci/code_lint.py --ci
- ci/docker-run.sh ci/checklicense.sh
artifacts:
when: always
paths:
- build/Release/cmake/lint_results/

code-coverage:
rules:
- when: never
allow_failure: true
stage: test
needs:
- build-release
- build-dependencies
script:
- ci/docker-run.sh ci/create_coverage.sh
artifacts:
when: always
paths:
- build/Release/result/coverage_results/

publish-kpis:
rules:
- when: never
allow_failure: true
needs: [code-coverage]
script:
- ci/publish_pkis.sh

documentation:
stage: build
script:
- ci/docker-run.sh ci/build_doc.sh
artifacts:
paths:
- build/doc/
16 changes: 4 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# SPDX-License-Identifier: MIT
cmake_minimum_required(VERSION 3.21)

include(cmake/ConfigureLibrary.cmake)
include(cmake/project.cmake)

project(
Expand All @@ -19,19 +18,12 @@ project_add_documentation_target(
MARKDOWN
${CMAKE_SOURCE_DIR}/documentation/documentation.md
)

list(APPEND CMAKE_PREFIX_PATH "${INSTALL_DIR}/usr/local/lib/cmake")

if(UNIT_TESTS)
configureLibrary(cmocka_extensions "${CMOCKA_EXTENSIONS_URI}" "${CMOCKA_EXTENSIONS_REF}")
configureLibrary(cmocka_mocks "${CMOCKA_MOCKS_URI}" "${CMOCKA_MOCKS_REF}")
endif()
if (UNIT_TESTS)
enable_testing()
endif (UNIT_TESTS)

add_subdirectory(src)
if(UNIT_TESTS)
enable_testing()
add_subdirectory(test/utest)
endif(UNIT_TESTS)
add_subdirectory(test/utest)

if(PACKAGING)
include(cmake/Packing.cmake)
Expand Down
37 changes: 0 additions & 37 deletions CONFIG.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
unset SOURCES_URI
unset CMOCKA_EXTENSIONS_REPO_NAME
unset CMOCKA_EXTENSIONS_REPO_PATH
unset CMOCKA_EXTENSIONS_REPO_REF

###################################################
#
Expand All @@ -16,37 +13,3 @@ unset CMOCKA_EXTENSIONS_REPO_REF
# uncomment and edit for common remote repository base URI, containing all
# project dependencies
# export SOURCES_URI="https://${GIT_USER_TOKEN}@gitlabintern.emlix.com/elektrobit/base-os/"

# define repository names of project dependencies
# local
#export CMOCKA_EXTENSIONS_REPO_NAME="cmocka_extensions"
#export CMOCKA_MOCKS_REPO_NAME="cmocka_mocks"
# or
# remote
# export CMOCKA_EXTENSIONS_REPO_NAME="cmocka_extensions.git"
# export CMOCKA_MOCKS_REPO_NAME="cmocka_mocks.git"


#################################################################
#
# Define repository location for each project dependency separately
#
#################################################################

# uncomment and edit to use a local repository
#export CMOCKA_EXTENSIONS_REPO_PATH="../cmocka_extensions"
# or
# uncomment and edit to use a remote repository
#export CMOCKA_EXTENSIONS_REPO_PATH="https://${GIT_USER_TOKEN}@gitlabintern.emlix.com/elektrobit/base-os/cmocka_extensions.git"
#export CMOCKA_MOCKS_REPO_PATH="https://${GIT_USER_TOKEN}@gitlabintern.emlix.com/elektrobit/base-os/cmocka_mocks.git"


###########################################################
#
# uncomment and edit to set a specific target branch or tag
#
###########################################################

#export CMOCKA_EXTENSIONS_REPO_REF="cobos-tools-last-release"
#export CMOCKA_MOCKS_REPO_REF="cobos-tools-last-release"

Loading