From b199870d7ef797c9b6e0569ef32627ba41bb11fc Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 28 Aug 2022 18:29:11 +0200 Subject: [PATCH] Fixed CI --- .gitlab-ci.yml | 58 +++++++++++++++++++ backend/CMakeLists.txt | 10 ++-- old_backend/.gitlab-ci.yml | 114 ------------------------------------- 3 files changed, 63 insertions(+), 119 deletions(-) create mode 100644 .gitlab-ci.yml delete mode 100644 old_backend/.gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..846a1dd --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,58 @@ +image: ubuntu:latest + +stages: + - build + - package + +build_backend: + stage: build + script: + - apt-get update + - apt-get install g++ gcc make cmake git curl zip unzip tar python3 pkg-config -y + - SRC="$PWD" + - TMP=$(mktemp -d) + - cd $TMP + - git clone https://github.com/Microsoft/vcpkg.git . + - ./bootstrap-vcpkg.sh -disableMetrics + - cd $SRC + - cmake -B build -S backend -DCMAKE_TOOLCHAIN_FILE=$TMP/scripts/buildsystems/vcpkg.cmake -DCMAKE_BUILD_TYPE=Release + - cmake --build build + - cp build/backend server + artifacts: + paths: + - backend + expire_in: 1h + +test_and_build_frontend: + image: node:latest + stage: build + cache: + paths: + - frontend/.yarn + - frontend/node_modules + script: + - cd frontend + - yarn install --cache-folder .yarn --frozen-lockfile + - yarn lint + - yarn build + artifacts: + paths: + - frontend/dist/ + expire_in: 1h + +package_server: + stage: package + cache: [] + before_script: [] + needs: + - job: build_backend + artifacts: true + - job: test_and_build_frontend + artifacts: true + script: + - mkdir static + - mv frontend/dist/* static/ + artifacts: + paths: + - server + - static/ diff --git a/backend/CMakeLists.txt b/backend/CMakeLists.txt index a6d05ce..ad20563 100644 --- a/backend/CMakeLists.txt +++ b/backend/CMakeLists.txt @@ -24,19 +24,17 @@ add_executable(backend src/controllers/admin.cpp src/controllers/fs.cpp src/controllers/user.cpp + src/controllers/auth/auth_common.cpp src/controllers/auth/auth_basic.cpp src/controllers/auth/auth_2fa.cpp + src/controllers/auth/auth_gitlab.cpp src/filters/filters.h src/filters/filters.cpp - src/controllers/auth/auth_gitlab.cpp) +) -if (MINGW) - target_link_libraries(backend -static-libgcc -static-libstdc++) -endif (MINGW) - find_package(Drogon CONFIG REQUIRED) find_package(CURL CONFIG REQUIRED) @@ -64,6 +62,8 @@ target_link_libraries(backend ${QR_LIBRARY} ) +install(TARGETS backend) + target_compile_options(backend PRIVATE $<$:-g -Wall -Wno-unknown-pragmas> $<$:-O3> diff --git a/old_backend/.gitlab-ci.yml b/old_backend/.gitlab-ci.yml deleted file mode 100644 index 80ab095..0000000 --- a/old_backend/.gitlab-ci.yml +++ /dev/null @@ -1,114 +0,0 @@ -image: node:latest - -stages: - - setup - - test - - build - - package - -cache: &global_cache - paths: - - .yarn - - node_modules - - frontend/.yarn - - frontend/node_modules - policy: pull - -before_script: - - yarn install --cache-folder .yarn --frozen-lockfile - - cd frontend - - yarn install --cache-folder .yarn --frozen-lockfile - - cd .. - -.dto_artifacts_need: &dto_artifacts_need - job: test_build_dto - artifacts: true - -test_build_dto: - stage: setup - cache: - <<: *global_cache - policy: pull-push - before_script: [] - script: - - cd dto - - yarn install --frozen-lockfile - - yarn lint - - yarn build - - cd .. - - yarn install --cache-folder .yarn --frozen-lockfile - - yarn add ./dto - - cd frontend - - yarn install --cache-folder .yarn --frozen-lockfile - - yarn add ../dto - artifacts: - paths: - - dto/lib/ - - -test_backend: - needs: - - *dto_artifacts_need - stage: test - script: - - yarn lint - -test_frontend: - needs: - - *dto_artifacts_need - stage: test - script: - - cd frontend - - yarn lint - -build_backend: - stage: build - needs: - - *dto_artifacts_need - - job: test_backend - artifacts: false - script: - - echo This has to work till I rewrite the backend - - false && echo - - yarn webpack - artifacts: - paths: - - dist/ - expire_in: 1h - -build_frontend: - stage: build - needs: - - *dto_artifacts_need - - job: test_frontend - artifacts: false - script: - - cd frontend - - yarn build - artifacts: - paths: - - frontend/dist/ - expire_in: 1h - -package_server: - stage: package - cache: [] - before_script: [] - needs: - - job: build_backend - artifacts: true - - job: build_frontend - artifacts: true - script: - - TMP=$(mktemp -d) - - mv dist/* "$TMP" - - mkdir "$TMP/frontend" - - mv frontend/dist/* "$TMP/frontend" - - rm -r * - - rm -r .* || true - - mv "$TMP/"* . - artifacts: - paths: - - package.json - - server.js - - frontend/