Skip to content
This repository has been archived by the owner on Sep 9, 2021. It is now read-only.

Товпеко Кирилл, 3530901/70201 #2

Closed
wants to merge 7 commits into from
Closed
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
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[submodule "ekutils"]
path = ktlo/lab1/subprojects/ekutils
url = https://github.com/handtruth/ekutils.git
[submodule "paket-cpp"]
path = ktlo/lab1/subprojects/paket-cpp
url = https://github.com/handtruth/paket-cpp.git
7 changes: 7 additions & 0 deletions ktlo/lab1/.devcontainer/.bashrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash

PS1='${debian_chroot:+($debian_chroot)}\[\033[01;91m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
umask 022
export LS_OPTIONS='--color=auto'
eval "`dircolors`"
alias ls='ls $LS_OPTIONS'
9 changes: 9 additions & 0 deletions ktlo/lab1/.devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM debian:buster

RUN apt update && apt install -y build-essential crossbuild-essential-amd64 crossbuild-essential-armhf mingw-w64 \
python3 python3-pip python3-setuptools python3-wheel ninja-build \
wget cmake xxd valgrind gcovr lcov git cppcheck gdb \
&& pip3 install meson

COPY meson /usr/local/share/meson
COPY .bashrc /root/.bashrc
18 changes: 18 additions & 0 deletions ktlo/lab1/.devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "C++",
"dockerFile": "Dockerfile",

"runArgs": [
"--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined"
],

"settings": {
"terminal.integrated.shell.linux": "/bin/bash"
},

"extensions": [
"ms-vscode.cpptools",
"yzhang.markdown-all-in-one",
"asabil.meson"
]
}
11 changes: 11 additions & 0 deletions ktlo/lab1/.devcontainer/meson/cross/arm-linux-gnueabihf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[binaries]
c = 'arm-linux-gnueabihf-gcc'
cpp = 'arm-linux-gnueabihf-g++'
ar = 'arm-linux-gnueabihf-ar'
strip = 'arm-linux-gnueabihf-strip'

[host_machine]
system = 'linux'
cpu_family = 'arm'
cpu = 'armv7'
endian = 'little'
12 changes: 12 additions & 0 deletions ktlo/lab1/.devcontainer/meson/cross/x86_64
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[binaries]
c = 'x86_64-linux-gnu-gcc'
cpp = 'x86_64-linux-gnu-g++'
ar = 'x86_64-linux-gnu-ar'
strip = 'x86_64-linux-gnu-strip'
pkgconfig = 'x86_64-linux-gnu-pkg-config'

[host_machine]
system = 'linux'
cpu_family = 'x86_64'
cpu = 'x86_64'
endian = 'little'
11 changes: 11 additions & 0 deletions ktlo/lab1/.devcontainer/meson/cross/x86_64-alpine-linux-musl
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[binaries]
c = '/usr/bin/x86_64-alpine-linux-musl-gcc'
cpp = '/usr/bin/x86_64-alpine-linux-musl-g++'
ar = '/usr/bin/x86_64-alpine-linux-musl-gcc-ar'
strip = '/usr/bin/x86_64-alpine-linux-musl-strip'

[host_machine]
system = 'linux'
cpu_family = 'x86_64'
cpu = 'x86_64'
endian = 'little'
12 changes: 12 additions & 0 deletions ktlo/lab1/.devcontainer/meson/cross/x86_64-linux-gnu
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[binaries]
c = 'x86_64-linux-gnu-gcc'
cpp = 'x86_64-linux-gnu-g++'
ar = 'x86_64-linux-gnu-ar'
strip = 'x86_64-linux-gnu-strip'
pkgconfig = 'x86_64-linux-gnu-pkg-config'

[host_machine]
system = 'linux'
cpu_family = 'x86_64'
cpu = 'x86_64'
endian = 'little'
13 changes: 13 additions & 0 deletions ktlo/lab1/.devcontainer/meson/cross/x86_64-w64-mingw32
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[binaries]
c = 'x86_64-w64-mingw32-gcc'
cpp = 'x86_64-w64-mingw32-g++'
ar = 'x86_64-w64-mingw32-ar'
strip = 'x86_64-w64-mingw32-strip'
pkgconfig = 'x86_64-w64-mingw32-pkg-config'
windres = 'x86_64-w64-mingw32-windres'

[host_machine]
system = 'windows'
cpu_family = 'x86_64'
cpu = 'x86_64'
endian = 'little'
5 changes: 5 additions & 0 deletions ktlo/lab1/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/.dockerignore
/*.Dockerfile
/build
/.devcontainer
/.vscode
2 changes: 2 additions & 0 deletions ktlo/lab1/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/build
/cross
229 changes: 229 additions & 0 deletions ktlo/lab1/.gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,229 @@
image: reg.handtruth.com/roots/cpp-meson/build:debian

stages:
- setup
- build
- test
- analysis
- package
- image
- deploy

variables:
GIT_SUBMODULE_STRATEGY: normal

Restore:x86_64-linux-gnu: &restore
stage: setup
variables:
TARGET: x86_64-linux-gnu
script:
- meson -Db_coverage=true build/$TARGET --cross-file=$TARGET
tags: ["default"]
artifacts:
paths:
- build
expire_in: 2 hrs

Restore:arm-linux-gnueabihf:
<<: *restore
variables:
TARGET: arm-linux-gnueabihf

Restore:x86_64-alpine-linux-musl:
<<: *restore
image: reg.handtruth.com/roots/cpp-meson/build:alpine
variables:
TARGET: x86_64-alpine-linux-musl

Build:x86_64-linux-gnu: &build
stage: build
variables:
TARGET: x86_64-linux-gnu
script:
- cd build/$TARGET
- ninja
tags: ["default"]
artifacts:
paths:
- build
expire_in: 2 hrs
dependencies:
- Restore:x86_64-linux-gnu

Build:arm-linux-gnueabihf:
<<: *build
variables:
TARGET: arm-linux-gnueabihf
dependencies:
- Restore:arm-linux-gnueabihf

Build:x86_64-alpine-linux-musl:
<<: *build
image: reg.handtruth.com/roots/cpp-meson/build:alpine
variables:
TARGET: x86_64-alpine-linux-musl
dependencies:
- Restore:x86_64-alpine-linux-musl

Test:x86_64-linux-gnu: &test
stage: test
variables:
TARGET: x86_64-linux-gnu
MESON_TESTTHREADS: 1
script:
- cd build/$TARGET
- meson test --print-errorlogs --suite regular --wrap='valgrind --error-exitcode=1 --leak-check=full --tool=memcheck --track-origins=yes'
- cat meson-logs/testlog-valgrind.txt
tags: ["default"]
artifacts:
paths:
- build
expire_in: 2 hrs
dependencies:
- Restore:x86_64-linux-gnu
- Build:x86_64-linux-gnu

Test:arm-linux-gnueabihf:
<<: *test
image: reg.handtruth.com/roots/cpp-meson/build:debian-armhf
variables:
TARGET: arm-linux-gnueabihf
tags: ["armhf"]
dependencies:
- Restore:arm-linux-gnueabihf
- Build:arm-linux-gnueabihf
when: manual

Test:x86_64-alpine-linux-musl:
<<: *test
image: reg.handtruth.com/roots/cpp-meson/build:alpine
variables:
TARGET: x86_64-alpine-linux-musl
dependencies:
- Restore:x86_64-alpine-linux-musl
- Build:x86_64-alpine-linux-musl

Coverage: &coverage
stage: analysis
variables:
TARGET: x86_64-linux-gnu
script:
- cd build/$TARGET
- ninja coverage-text
- cat meson-logs/coverage.txt
coverage: '/^TOTAL\s+\S+\s+\S+\s+(\d+\.?\d+)%/'
tags: ["default"]
artifacts:
paths:
- build
expire_in: 2 hrs
dependencies:
- Restore:x86_64-linux-gnu
- Build:x86_64-linux-gnu
- Test:x86_64-linux-gnu

Check:
stage: analysis
variables:
TARGET: x86_64-linux-gnu
script:
- cd build/$TARGET
- ninja cppcheck
coverage: '/^TOTAL\s+\S+\s+\S+\s+(\d+\.?\d+)%/'
tags: ["default"]
artifacts:
paths:
- build/x86_64-linux-gnu/cppcheck.log
expire_in: 1 week
dependencies:
- Restore:x86_64-linux-gnu

Package:x86_64-linux-gnu: &package
stage: package
variables:
TARGET: x86_64-linux-gnu
script:
- meson -Dprefix=`pwd`/dist/$TARGET -Ddefault_library=static -Dbuildtype=release -Doptimization=3 --cross-file=$TARGET package/$TARGET
- cd package/$TARGET
- ninja
- ninja install
tags: ["default"]
artifacts:
paths:
- dist
expire_in: 1 mos
dependencies: []

Package:arm-linux-gnueabihf:
<<: *package
variables:
TARGET: arm-linux-gnueabihf

Package:x86_64-alpine-linux-musl:
<<: *package
image: reg.handtruth.com/roots/cpp-meson/build:alpine
variables:
TARGET: x86_64-alpine-linux-musl

ImageAmd64:
stage: image
image: docker:stable
variables:
DOCKER_HOST: tcp://docker:2375/
LATEST_TAG: $CI_REGISTRY_IMAGE/amd64:latest
IMAGE_TAG: $CI_REGISTRY_IMAGE/amd64:$CI_COMMIT_TAG
services:
- name: docker:dind
entrypoint: ["dockerd", "--host=tcp://0.0.0.0:2375"]
script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- docker build -t $IMAGE_TAG -f Dockerfile .
- docker tag $IMAGE_TAG $LATEST_TAG
- docker push $IMAGE_TAG
- docker push $LATEST_TAG
tags: ["docker"]
only: ["tags"]
cache:
paths: []
dependencies: []

ImageArmhf:
stage: image
image: arm32v7/docker:stable
variables:
DOCKER_HOST: tcp://docker:2375/
LATEST_TAG: $CI_REGISTRY_IMAGE/armhf:latest
IMAGE_TAG: $CI_REGISTRY_IMAGE/armhf:$CI_COMMIT_TAG
services:
- name: arm32v7/docker:dind
alias: docker
entrypoint: ["dockerd", "--host=tcp://0.0.0.0:2375"]
script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- docker build -t $IMAGE_TAG -f armhf.Dockerfile .
- docker tag $IMAGE_TAG $LATEST_TAG
- docker push $IMAGE_TAG
- docker push $LATEST_TAG
tags: ["docker-armhf"]
only: ["tags"]
cache:
paths: []
dependencies: []

Deploy:
stage: deploy
image: arm32v7/docker:stable
variables:
DOCKER_HOST: unix:///var/run/docker.sock
IMAGE_TAG: $CI_REGISTRY_IMAGE/armhf:$CI_COMMIT_TAG
GIT_STRATEGY: none
script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- docker pull $IMAGE_TAG
- docker stop net-chat && docker rm net-chat || true
- docker run -d --name net-chat -p 1338:1338 $IMAGE_TAG server --address=0.0.0.0 --verb=verbose
tags: ["kuiper"]
only: ["tags"]
cache:
paths: []
dependencies: []
6 changes: 6 additions & 0 deletions ktlo/lab1/.gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[submodule "ekutils"]
path = subprojects/ekutils
url = ../../handtruth/ekutils.git
[submodule "paket-cpp"]
path = subprojects/paket-cpp
url = ../../handtruth/paket-cpp.git
17 changes: 17 additions & 0 deletions ktlo/lab1/.vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [],
"compilerPath": "/usr/bin/gcc",
"cStandard": "c11",
"cppStandard": "c++17",
"intelliSenseMode": "gcc-x64",
"compileCommands": "${workspaceFolder}/build/compile_commands.json"
}
],
"version": 4
}
Loading