From 3b7a7690215c64ce5d53903ed8341074e701f0b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juanjo=20Guti=C3=A9rrez?= Date: Mon, 31 Jan 2022 12:56:07 +0100 Subject: [PATCH] Build for new platform (arm) and notifications --- .dockerignore | 2 ++ .drone.yml | 75 +++++++++++++++++++++++++++++++++++++++---- .travis.yml | 37 --------------------- CMakeLists.txt | 6 ++-- Dockerfile | 24 ++++++++++++++ Jenkinsfile | 28 ---------------- build-deps/Dockerfile | 2 -- 7 files changed, 97 insertions(+), 77 deletions(-) create mode 100644 .dockerignore delete mode 100644 .travis.yml create mode 100644 Dockerfile delete mode 100644 Jenkinsfile delete mode 100644 build-deps/Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..827c85c --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +build_dir/ +build/ diff --git a/.drone.yml b/.drone.yml index c31b3d0..f2a51bb 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,15 +1,76 @@ --- kind: pipeline type: docker -name: default +name: amd64 + +platform: + os: linux + arch: amd64 steps: -- name: build +- name: prepare workspace + image: alpine + commands: + - rm -fr build_dir +- name: build hermes image: alpine commands: - - rm -fr build - - mkdir build - - cd build - apk add -t hermes-build-deps --no-cache perl graphviz doxygen gcc make openssl-dev libspf2-dev cmake g++ sqlite-dev gettext-dev - - cmake .. - - make -j4 + - cmake -B build_dir + - cmake --build build_dir +- name: docker image build + image: plugins/docker + settings: + tags: + - latest + repo: docker.gutierrezdequevedo.com/ps/hermes +--- +kind: pipeline +type: docker +name: arm64 + +platform: + os: linux + arch: arm64 + +steps: +- name: prepare workspace + image: alpine + commands: + - rm -fr build_dir +- name: build hermes + image: alpine + commands: + - apk add -t hermes-build-deps --no-cache perl graphviz doxygen gcc make openssl-dev libspf2-dev cmake g++ sqlite-dev gettext-dev + - cmake -B build_dir + - cmake --build build_dir +- name: docker image build + image: plugins/docker + settings: + tags: + - latest-arm64 + repo: docker.gutierrezdequevedo.com/ps/hermes + +--- +kind: pipeline +type: docker +name: notification + +depends_on: +- amd64 +- arm64 +steps: +- name: notify matrix + image: spotlightkid/drone-matrixchat-notify + settings: + homeserver: 'https://grava.work' + roomid: '!wMVeFx6jwwF0TWA18h:grava.work' + userid: '@juanjo:grava.work' + deviceid: 'drone CI' + accesstoken: G66FRa3fG7qNfM4KKoW5wx6TWophvvtF + markdown: 'yes' + template: | + `${DRONE_REPO}` build #${DRONE_BUILD_NUMBER} status: **${DRONE_BUILD_STATUS}** + + [${DRONE_BUILD_LINK}] + diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 2d63824..0000000 --- a/.travis.yml +++ /dev/null @@ -1,37 +0,0 @@ -language: c++ -jobs: - include: - - compiler: gcc - os: linux - dist: bionic - - compiler: clang - os: linux - dist: bionic - - compiler: gcc - os: linux - dist: xenial - - compiler: clang - os: linux - dist: xenial - -addons: - apt: - packages: - - libspf2-dev - - doxygen - - graphviz - homebrew: - packages: - - libintl - - gettext - - openssl - - doxygen - - graphviz - -script: - - mkdir build - - pushd build - - cmake .. -DCMAKE_INSTALL_PREFIX=$PWD/install-dir - - make install - - find $PWD/install-dir - - popd diff --git a/CMakeLists.txt b/CMakeLists.txt index b730632..c9d814d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -63,7 +63,7 @@ if(DOXYGEN_FOUND) WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/docs) install( DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/docs/html - DESTINATION usr/share/doc/hermes/html) + TYPE DOC) endif() target_link_libraries(hermes @@ -76,11 +76,11 @@ install(TARGETS hermes RUNTIME DESTINATION bin) install(FILES dists/hermesrc.example - DESTINATION etc) + TYPE SYSCONF) install(FILES dists/hermesrc.example docs/gpl.txt docs/installing-hermes.txt docs/hermes-options.html - DESTINATION usr/share/doc/hermes) + TYPE DOC) diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..1233d47 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,24 @@ +FROM alpine +WORKDIR / +ADD . /hermes +WORKDIR /hermes +RUN apk add -t hermes-build-deps --no-cache perl graphviz doxygen gcc make openssl-dev libspf2-dev cmake g++ sqlite-dev gettext-dev +RUN cmake -B build +RUN cmake --build build +RUN mkdir /hermes-installation +RUN cmake --install build --prefix /hermes-installation + +FROM alpine +EXPOSE 25 +COPY --from=0 /hermes-installation / +WORKDIR / +RUN apk add --no-cache openssl libspf2 sqlite-libs libstdc++ libgcc && \ + mkdir /etc/hermes && \ + apk add --no-cache openssl libspf2 sqlite-libs libstdc++ libgcc && \ + openssl genrsa 1024 > /etc/hermes/hermes.key && \ + openssl req -new -x509 -nodes -sha1 -days 365 -subj /C=SE/ST=State/L=Location/O=Organization/OU=Unit/CN=commonname.com -key /etc/hermes/hermes.key > /etc/hermes/hermes.cert +COPY --from=0 /hermes/dists/hermesrc.example /etc/hermes/hermesrc +RUN sed -e "s#background = true#background = false#" -i /etc/hermes/hermesrc && \ + mkdir /var/hermes && \ + chown nobody:nobody -R /var/hermes +CMD ["hermes", "/etc/hermes/hermesrc"] diff --git a/Jenkinsfile b/Jenkinsfile deleted file mode 100644 index b449651..0000000 --- a/Jenkinsfile +++ /dev/null @@ -1,28 +0,0 @@ -pipeline { - - environment { - DOCKER_HOST='docker.hem:2376' - } - - agent any; - - stages { - stage('Build') { - agent { - dockerfile { dir 'build-deps' } - } - - steps { - dir('build') { - sh 'cmake ..' - sh 'make -j4' - } - } - } - } - - triggers { - pollSCM('H */4 * * 1-5') - } -} - diff --git a/build-deps/Dockerfile b/build-deps/Dockerfile deleted file mode 100644 index 7158dda..0000000 --- a/build-deps/Dockerfile +++ /dev/null @@ -1,2 +0,0 @@ -FROM alpine:3.13 -RUN /sbin/apk add -t hermes-build-deps --no-cache gcc g++ make cmake openssl-dev libspf2-dev sqlite-dev gettext-dev doxygen graphviz perl