Merge branch '24-add-musl-builds' into 'main'
Resolve "Add musl builds" Closes #24 See merge request root/fileserver!11
This commit is contained in:
		| @@ -1,18 +1,12 @@ | |||||||
| image: ubuntu:latest |  | ||||||
|  |  | ||||||
| stages: | stages: | ||||||
|     - build |     - build | ||||||
|     - package |     - package | ||||||
|  |     - release | ||||||
|  |  | ||||||
| build_backend: | build_backend_glibc: | ||||||
|     stage: build |     stage: build | ||||||
|     cache: |     image: reg.gitlab.mattv.de/root/docker-images/ubuntu_build_base:latest | ||||||
|         key: backend |  | ||||||
|         paths: |  | ||||||
|             - vcpkg_cache |  | ||||||
|     script: |     script: | ||||||
|         - apt-get update |  | ||||||
|         - apt-get install g++ gcc make cmake git curl zip unzip tar python3 pkg-config -y |  | ||||||
|         - SRC="$PWD" |         - SRC="$PWD" | ||||||
|         - TMP=$(mktemp -d) |         - TMP=$(mktemp -d) | ||||||
|         - cd $TMP |         - cd $TMP | ||||||
| @@ -23,6 +17,32 @@ build_backend: | |||||||
|         - VCPKG_DEFAULT_BINARY_CACHE=$SRC/vcpkg_cache cmake -B build -S backend -DCMAKE_TOOLCHAIN_FILE=$TMP/scripts/buildsystems/vcpkg.cmake -DCMAKE_BUILD_TYPE=Release |         - 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 |         - cmake --build build | ||||||
|         - cp build/backend server |         - cp build/backend server | ||||||
|  |     cache: | ||||||
|  |         key: backend_glibc | ||||||
|  |         paths: | ||||||
|  |             - vcpkg_cache | ||||||
|  |     artifacts: | ||||||
|  |         paths: | ||||||
|  |             - server | ||||||
|  |  | ||||||
|  | build_backend_muslc: | ||||||
|  |     stage: build | ||||||
|  |     image: reg.gitlab.mattv.de/root/docker-images/alpine_build_base:latest | ||||||
|  |     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 | ||||||
|  |     cache: | ||||||
|  |         key: backend_muslc | ||||||
|  |         paths: | ||||||
|  |             - vcpkg_cache | ||||||
|     artifacts: |     artifacts: | ||||||
|         paths: |         paths: | ||||||
|             - server |             - server | ||||||
| @@ -44,18 +64,64 @@ test_and_build_frontend: | |||||||
|         paths: |         paths: | ||||||
|             - frontend/dist/ |             - frontend/dist/ | ||||||
|  |  | ||||||
| package_server: | .package_server: | ||||||
|  |     image: alpine:latest | ||||||
|     stage: package |     stage: package | ||||||
|     before_script: [] |     artifacts: | ||||||
|  |         paths: | ||||||
|  |             - '*.tar' | ||||||
|  |  | ||||||
|  | package_server_glibc: | ||||||
|  |     extends: .package_server | ||||||
|     needs: |     needs: | ||||||
|         - job: build_backend |         - job: build_backend_glibc | ||||||
|           artifacts: true |           artifacts: true | ||||||
|         - job: test_and_build_frontend |         - job: test_and_build_frontend | ||||||
|           artifacts: true |           artifacts: true | ||||||
|     script: |     script: | ||||||
|         - mkdir static |         - mkdir static | ||||||
|         - mv frontend/dist/* static/ |         - mv frontend/dist/* static/ | ||||||
|     artifacts: |         - tar -cvf linux-x64-glibc.tar server static | ||||||
|         paths: |  | ||||||
|             - server | package_server_muslc: | ||||||
|             - static/ |     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: | ||||||
|  |         - | | ||||||
|  |           curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file "linux-x64-glibc.tar" "${PACKAGE_REGISTRY_URL}/linux-x64-glibc.tar" | ||||||
|  |         - | | ||||||
|  |           curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file "linux-x64-muslc.tar" "${PACKAGE_REGISTRY_URL}/linux-x64-muslc.tar" | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | create_release: | ||||||
|  |     stage: release | ||||||
|  |     image: registry.gitlab.com/gitlab-org/release-cli:latest | ||||||
|  |     needs: | ||||||
|  |         - upload_assets | ||||||
|  |     rules: | ||||||
|  |         - if: $CI_COMMIT_TAG | ||||||
|  |     script: | ||||||
|  |         - | | ||||||
|  |             release-cli create --name "Release $CI_COMMIT_TAG" --tag-name $CI_COMMIT_TAG \ | ||||||
|  |               --assets-link "{\"name\":\"linux-x64-glibc.tar\",\"url\":\"${PACKAGE_REGISTRY_URL}/linux-x64-glibc.tar\"}" \ | ||||||
|  |               --assets-link "{\"name\":\"linux-x64-muslc.tar\",\"url\":\"${PACKAGE_REGISTRY_URL}/linux-x64-muslc.tar\"}" | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user