fileserver/.gitlab-ci.yml

132 lines
4.0 KiB
YAML
Raw Normal View History

2022-08-28 16:29:11 +00:00
stages:
- build
- package
2022-09-04 09:52:32 +00:00
- release
2022-08-28 16:29:11 +00:00
2022-09-04 10:04:00 +00:00
build_backend_glibc:
2022-08-28 16:29:11 +00:00
stage: build
2022-09-04 10:04:00 +00:00
image: reg.gitlab.mattv.de/root/docker-images/ubuntu_build_base:latest
cache:
key: backend_glibc
paths:
- vcpkg_cache
2022-08-28 16:29:11 +00:00
script:
- SRC="$PWD"
- TMP=$(mktemp -d)
- cd $TMP
- git clone https://github.com/Microsoft/vcpkg.git .
- ./bootstrap-vcpkg.sh -disableMetrics
- cd $SRC
2022-08-31 12:55:44 +00:00
- mkdir -p vcpkg_cache
2022-08-31 12:41:55 +00:00
- VCPKG_DEFAULT_BINARY_CACHE=$SRC/vcpkg_cache cmake -B build -S backend -DCMAKE_TOOLCHAIN_FILE=$TMP/scripts/buildsystems/vcpkg.cmake -DCMAKE_BUILD_TYPE=Release
2022-08-28 16:29:11 +00:00
- cmake --build build
- cp build/backend server
2022-09-04 10:04:00 +00:00
artifacts:
paths:
- server
2022-09-04 09:52:32 +00:00
build_backend_muslc:
2022-09-04 10:04:00 +00:00
stage: build
2022-09-04 09:52:32 +00:00
image: reg.gitlab.mattv.de/root/docker-images/alpine_build_base:latest
cache:
key: backend_muslc
paths:
- vcpkg_cache
2022-09-04 10:04:00 +00:00
script:
- SRC="$PWD"
- TMP=$(mktemp -d)
- cd $TMP
- git clone https://github.com/Microsoft/vcpkg.git .
- ./bootstrap-vcpkg.sh -disableMetrics
- cd $SRC
- mkdir -p vcpkg_cache
- VCPKG_FORCE_SYSTEM_BINARIES=1 VCPKG_DEFAULT_BINARY_CACHE=$SRC/vcpkg_cache 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:
- server
2022-09-04 09:52:32 +00:00
2022-08-28 16:29:11 +00:00
test_and_build_frontend:
image: node:latest
stage: build
cache:
2022-08-31 12:55:44 +00:00
key: frontend
2022-08-28 16:29:11 +00:00
paths:
- frontend/.yarn
- frontend/node_modules
script:
- cd frontend
- yarn install --cache-folder .yarn --frozen-lockfile
- yarn lint
- yarn build
artifacts:
paths:
- frontend/dist/
2022-09-04 09:52:32 +00:00
.package_server:
2022-09-04 09:29:49 +00:00
image: alpine:latest
2022-08-28 16:29:11 +00:00
stage: package
2022-09-04 09:52:32 +00:00
artifacts:
paths:
- '*.tar'
package_server_glibc:
extends: .package_server
2022-08-28 16:29:11 +00:00
needs:
2022-09-04 09:52:32 +00:00
- job: build_backend_glibc
2022-08-28 16:29:11 +00:00
artifacts: true
- job: test_and_build_frontend
artifacts: true
script:
- mkdir static
- mv frontend/dist/* static/
2022-09-04 09:52:32 +00:00
- tar -cvf linux-x64-glibc.tar server static
package_server_muslc:
extends: .package_server
needs:
- job: build_backend_muslc
artifacts: true
- job: test_and_build_frontend
artifacts: true
script:
- mkdir static
- mv frontend/dist/* static/
- tar -cvf linux-x64-muslc.tar server static
upload_assets:
stage: release
image: curlimages/curl:latest
needs:
- job: package_server_glibc
artifacts: true
- job: package_server_muslc
artifacts: true
rules:
- if: $CI_COMMIT_TAG
script:
2022-09-04 11:26:38 +00:00
- 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file linux-x64-glibc.tar "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/linux-x64-glibc/$CI_COMMIT_TAG/linux-x64-glibc.tar"'
- 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file linux-x64-muslc.tar "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/linux-x64-muslc/$CI_COMMIT_TAG/linux-x64-muslc.tar"'
2022-09-04 09:52:32 +00:00
create_release:
stage: release
image: registry.gitlab.com/gitlab-org/release-cli:latest
needs:
- upload_assets
rules:
- if: $CI_COMMIT_TAG
script:
- echo "running release_job"
release: # See https://docs.gitlab.com/ee/ci/yaml/#release for available properties
tag_name: '$CI_COMMIT_TAG'
description: 'Release $CI_COMMIT_TAG'
assets:
links:
- name: 'linux-x64-glibc.tar'
url: ''${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/linux-x64-glibc/$CI_COMMIT_TAG/linux-x64-glibc.tar'
link_type: package
- name: 'linux-x64-muslc.tar'
url: ''${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/linux-x64-muslc/$CI_COMMIT_TAG/linux-x64-muslc.tar'
link_type: package