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

Build on Ubuntu 22.04 #85

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 11 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@ on:
- pull_request

jobs:
ubuntu-22-04:
name: ubuntu-22-04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- name: test
env:
DOCKER_IMAGE: ubuntu:22.04
CI: 1
run: make
ubuntu-20-04:
name: ubuntu-20-04
runs-on: ubuntu-latest
Expand Down Expand Up @@ -64,4 +74,4 @@ jobs:
env:
DOCKER_IMAGE: debian:jessie
CI: 1
run: make
run: make
2 changes: 1 addition & 1 deletion auto
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ if [[ "$AUTO_DEBUG" == "1" ]]; then
fi

export PROJECT_ROOT=$(pushd $(dirname $0) > /dev/null; echo $PWD; popd > /dev/null)
export DOCKER_IMAGE
export DOCKER_IMAGE="${DOCKER_IMAGE:=ubuntu:22.04}"
export CI=${CI:=0}
export CC=/usr/bin/gcc

Expand Down
2 changes: 1 addition & 1 deletion autolib/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ autolib_build() {
pushd ${lib}/build > /dev/null || return $?
autolib_output_banner "${lib}: CMake Build Stage"
# YOU MUST set TEST to 1 in order to build the tests
TEST=$build_test cmake -v .. || {
TEST=$build_test cmake .. || {
autolib_output_error "${lib}: CMake Failure"
return 1
}
Expand Down
26 changes: 26 additions & 0 deletions autolib/docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,25 @@ source "${lib}/output.sh"

PROJECT_ROOT=$(pushd "$(dirname ${BASH_SOURCE[0]})/.." > /dev/null; echo $PWD; popd > /dev/null)

autolib_new_ubuntu_22_04_template() {
cat <<'EOF'
FROM __DOCKER_IMAGE__

RUN apt-get update -y
RUN apt-get install -y apt-utils software-properties-common clang-format git tar curl build-essential pkg-config gdb valgrind gcc libmicrohttpd-dev doxygen graphviz cmake golang
RUN go install github.com/prometheus/prom2json/cmd/prom2json@v1.3.3
RUN go install github.com/git-chglog/git-chglog/cmd/git-chglog@latest
RUN printf "export PATH="${PATH}:$(go env GOPATH)/bin"" >> /root/.bash_profile
RUN printf '#!/usr/bin/env bash\nsource /root/.bash_profile\nexec /bin/bash $@\n' > /entrypoint
RUN chmod +x /entrypoint
RUN rm -rf /var/lib/apt/lists/*

WORKDIR /code
ENTRYPOINT ["/entrypoint"]

EOF
}

autolib_new_debian_template(){
cat <<'EOF'
FROM __DOCKER_IMAGE__
Expand Down Expand Up @@ -102,6 +121,13 @@ autolib_write_dockerfile(){
local docker_image="$1"
local r
case "$docker_image" in
( ubuntu:22.04 ) {
autolib_new_ubuntu_22_04_template | sed "s/__DOCKER_IMAGE__/$docker_image/g" > ${PROJECT_ROOT}/docker/Dockerfile || {
r=$?
autolib_output_error "failed to generate dockerfile"
return $r
}
} ;;
( ubuntu:20.04 | ubuntu:18.04 ) {
autolib_new_debian_template | sed "s/__DOCKER_IMAGE__/$docker_image/g" > ${PROJECT_ROOT}/docker/Dockerfile || {
r=$?
Expand Down
9 changes: 9 additions & 0 deletions promhttp/include/promhttp.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,15 @@
*/
void promhttp_set_active_collector_registry(prom_collector_registry_t *active_registry);

#if MHD_VERSION >= 0x00097002
#define PROM_MHD_RESULT enum MHD_Result
#else
#define PROM_MHD_RESULT int
#endif

PROM_MHD_RESULT promhttp_handler(void *cls, struct MHD_Connection *connection, const char *url, const char *method,
const char *version, const char *upload_data, size_t *upload_data_size, void **con_cls);

/**
* @brief Starts a daemon in the background and returns a pointer to an HMD_Daemon.
*
Expand Down
3 changes: 2 additions & 1 deletion promhttp/src/promhttp.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

#include "microhttpd.h"
#include "prom.h"
#include "promhttp.h"

prom_collector_registry_t *PROM_ACTIVE_REGISTRY;

Expand All @@ -29,7 +30,7 @@ void promhttp_set_active_collector_registry(prom_collector_registry_t *active_re
}
}

int promhttp_handler(void *cls, struct MHD_Connection *connection, const char *url, const char *method,
PROM_MHD_RESULT promhttp_handler(void *cls, struct MHD_Connection *connection, const char *url, const char *method,
const char *version, const char *upload_data, size_t *upload_data_size, void **con_cls) {
if (strcmp(method, "GET") != 0) {
char *buf = "Invalid HTTP Method\n";
Expand Down