Skip to content
Snippets Groups Projects
.gitlab-ci.yml 14.5 KiB
Newer Older
Rye Mutt's avatar
Rye Mutt committed
stages:
  - build
Rye Mutt's avatar
Rye Mutt committed
  - upload
 
default:
  interruptible: true
Rye Mutt's avatar
Rye Mutt committed
  timeout: 4h
Rye Mutt's avatar
Rye Mutt committed
variables:
Rye Mutt's avatar
Rye Mutt committed
  BUILD_CHANNEL:
    value: "Test"
    options:
      - "Release"
      - "Beta"
      - "Project"
      - "Test"
    description: "The deployment channel target. Set to 'Test' by default."
  PUBLIC_BUILD:
    value: "FALSE"
    options:
      - "FALSE"
      - "TRUE"
    description: "Are package registry uploads public?. Set to 'TRUE' by default"
  USE_SENTRY:
    value: "TRUE"
    options:
      - "FALSE"
      - "TRUE"
    description: "Enable sentry crash reporting module. Set to 'TRUE' by default."
  AUTOBUILD_BUILD_ID: $CI_PIPELINE_ID
Rye Mutt's avatar
Rye Mutt committed
  AUTOBUILD_GITLAB_TOKEN: $CI_JOB_TOKEN
Rye Mutt's avatar
Rye Mutt committed
  AUTOBUILD_INSTALLABLE_CACHE: "$CI_PROJECT_DIR/.cache/autobuild"
  PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
Rye Mutt's avatar
Rye Mutt committed

Rye Mutt's avatar
Rye Mutt committed
.win_build:
  stage: build
  tags:
    - autobuild
    - windows
Rye Mutt's avatar
Rye Mutt committed
  cache:
    key:
      files:
        - autobuild.xml
      prefix: ${CI_JOB_NAME}
    paths:
      - .cache/autobuild
      - .cache/pip
    when: 'always'
  before_script:
    - python -m venv .venv
    - .\.venv\Scripts\Activate.ps1
    - pip install --upgrade llbase autobuild certifi
    - autobuild configure -c Release -- -DUSE_LTO=ON -DDISABLE_FATAL_WARNINGS=ON -DREVISION_FROM_VCS=FALSE
    - autobuild build -c Release --no-configure
    - autobuild graph -c Release --graph-file alchemy-windows${AUTOBUILD_ADDRSIZE}-dependencies.svg build-vc-64/autobuild-package.xml
    - $AlchemyPdbPath = Resolve-Path build-vc-*/newview/Release/alchemy-bin.pdb
    - If ($env:USE_SENTRY -eq 'TRUE') { sentry-cli difutil bundle-sources $AlchemyPdbPath }
  artifacts:
    name: "$env:CI_COMMIT_REF_NAME-$env:CI_COMMIT_SHORT_SHA"
Rye Mutt's avatar
Rye Mutt committed
    expire_in: 1 week
Rye Mutt's avatar
Rye Mutt committed
      - build-vc-*/packages/lib/release/discord_game_sdk.dll
      - build-vc-*/packages/lib/release/alut*.dll
      - build-vc-*/packages/lib/release/fmod*.dll
      - build-vc-*/packages/lib/release/libapr*.dll
      - build-vc-*/packages/lib/release/libexpat*.dll
      - build-vc-*/packages/lib/release/libhunspell*.dll
      - build-vc-*/packages/lib/release/libogg*.dll
      - build-vc-*/packages/lib/release/libvorbis*.dll
      - build-vc-*/packages/lib/release/OpenAL32*.dll
      - build-vc-*/packages/lib/release/openjp2*.dll
      - build-vc-*/packages/lib/release/sentry.dll
      - build-vc-*/packages/lib/release/xmlrpc-epi*.dll
      - build-vc-*/packages/lib/release/*.pdb
      - build-vc-*/newview/Release/build_data.json
      - build-vc-*/newview/Release/alchemy-bin.exe
      - build-vc-*/newview/Release/alchemy-bin.pdb
      - build-vc-*/newview/Release/alchemy-bin.src.zip
      - build-vc-*/newview/Release/Alchemy_*_Setup.exe
      - alchemy-*-dependencies.svg
Rye Mutt's avatar
Rye Mutt committed
.mac_build:
  stage: build
  tags:
    - mac
Rye Mutt's avatar
Rye Mutt committed
    - bash
Rye Mutt's avatar
Rye Mutt committed
  cache:
    key:
      files:
        - autobuild.xml
      prefix: ${CI_JOB_NAME}
    paths:
      - .cache/autobuild
      - .cache/pip
    when: 'always'
Rye Mutt's avatar
Rye Mutt committed
  variables:
    VIEWER_SIGNING_IDENTITY: $APPLE_SIGNATURE
Rye Mutt's avatar
Rye Mutt committed
  before_script:
    - python3 -m venv .venv
Rye Mutt's avatar
Rye Mutt committed
    - source .venv/bin/activate
Rye Mutt's avatar
Rye Mutt committed
    - pip3 install --upgrade llbase autobuild dmgbuild
Rye Mutt's avatar
Rye Mutt committed
  script:
Rye Mutt's avatar
Rye Mutt committed
    - autobuild configure -c Release -- -DENABLE_SIGNING=ON -DUSE_LTO=ON -DDISABLE_FATAL_WARNINGS=ON -DREVISION_FROM_VCS=FALSE
    - autobuild build -c Release --no-configure
    - autobuild graph -c Release --graph-file alchemy-darwin${AUTOBUILD_ADDRSIZE}-dependencies.svg build-darwin-64/autobuild-package.xml
    - if [ "$USE_SENTRY" = "TRUE" ]; then sentry-cli difutil bundle-sources build-darwin-*/newview/Release/*.app.dSYM/Contents/Resources/DWARF/*; fi
Rye Mutt's avatar
Rye Mutt committed
  artifacts:
    name: "$CI_COMMIT_REF_NAME-$CI_COMMIT_SHORT_SHA"
Rye Mutt's avatar
Rye Mutt committed
    expire_in: 1 week
    paths:
      - build-darwin-*/build_data.json
Rye Mutt's avatar
Rye Mutt committed
      - build-darwin-*/packages/lib/release/discord_game_sdk.dylib
      - build-darwin-*/packages/lib/release/libalut*.dylib
      - build-darwin-*/packages/lib/release/libfmod*.dylib
      - build-darwin-*/packages/lib/release/libndofdev*.dylib
      - build-darwin-*/packages/lib/release/libopenal*.dylib
      - build-darwin-*/packages/lib/release/Sentry.framework
      - build-darwin-*/packages/lib/release/*.dSYM
Rye Mutt's avatar
Rye Mutt committed
      - build-darwin-*/newview/Alchemy_*.dmg
      - build-darwin-*/newview/Release/*.app/Contents/MacOS/*
      - build-darwin-*/newview/Release/*.dSYM
      - build-darwin-*/newview/Release/*.src.zip
      - alchemy-*-dependencies.svg
Rye Mutt's avatar
Rye Mutt committed

Rye Mutt's avatar
Rye Mutt committed
.linux_build:
Rye Mutt's avatar
Rye Mutt committed
  stage: build
  image: r.alchemyviewer.org/alchemy/infrastructure/ubuntu-build-image:latest-llvm
Rye Mutt's avatar
Rye Mutt committed
  tags:
Rye Mutt's avatar
Rye Mutt committed
    - linux
    - docker
Rye Mutt's avatar
Rye Mutt committed
  cache:
    key:
      files:
        - autobuild.xml
      prefix: ${CI_JOB_NAME}
    paths:
      - .cache/autobuild
      - .cache/pip
    when: 'always'
  before_script:
    - python -m venv .venv
Rye Mutt's avatar
Rye Mutt committed
    - source .venv/bin/activate
Rye Mutt's avatar
Rye Mutt committed
    - pip3 install --upgrade llbase autobuild
Rye Mutt's avatar
Rye Mutt committed
  script:
    - autobuild configure -c Release -- -DUSE_LTO=ON -DDISABLE_FATAL_WARNINGS=ON -DREVISION_FROM_VCS=FALSE
    - autobuild build -c Release --no-configure
    - autobuild graph -c Release --graph-file alchemy-linuxs${AUTOBUILD_ADDRSIZE}-dependencies.svg build-linux-${AUTOBUILD_ADDRSIZE}/autobuild-package.xml
    - if [ "$USE_SENTRY" = "TRUE" ]; then sentry-cli difutil bundle-sources build-linux-*/newview/alchemy-bin.debug; fi
Rye Mutt's avatar
Rye Mutt committed
  artifacts:
    name: "$CI_COMMIT_REF_NAME-$CI_COMMIT_SHORT_SHA"
Rye Mutt's avatar
Rye Mutt committed
    expire_in: 1 week
Rye Mutt's avatar
Rye Mutt committed
    paths:
      - build-linux-*/build_data.json
Rye Mutt's avatar
Rye Mutt committed
      - build-linux-*/packages/lib/release/discord_game_sdk.so*
      - build-linux-*/packages/lib/release/libalut.so*
      - build-linux-*/packages/lib/release/libapr-1.so*
      - build-linux-*/packages/lib/release/libaprutil-1.so*
      - build-linux-*/packages/lib/release/libexpat*.so*
      - build-linux-*/packages/lib/release/libfmod*.so*
      - build-linux-*/packages/lib/release/libjpeg.so*
      - build-linux-*/packages/lib/release/libopenal.so*
      - build-linux-*/packages/lib/release/libopenjp2.so*
      - build-linux-*/packages/lib/release/libSDL2*.so*
      - build-linux-*/newview/Alchemy_*.tar.*
Rye Mutt's avatar
Rye Mutt committed
      - build-linux-*/newview/alchemy-bin
      - build-linux-*/newview/alchemy-bin.debug
      - build-linux-*/newview/alchemy-bin.src.zip
      - alchemy-*-dependencies.svg
Rye Mutt's avatar
Rye Mutt committed

Rye Mutt's avatar
Rye Mutt committed
coverity_scan:
  stage: build
Rye Mutt's avatar
Rye Mutt committed
  image: r.alchemyviewer.org/alchemy/infrastructure/ubuntu-build-image:latest-llvm-coverity
Rye Mutt's avatar
Rye Mutt committed
  tags:
    - linux
    - docker
  rules:
    - if: '$CI_COMMIT_BRANCH == "coverity"'
  cache:
    key:
      files:
        - autobuild.xml
      prefix: ${CI_JOB_NAME}
    paths:
      - .cache/autobuild
      - .cache/pip
    when: 'always'
  variables:
Rye Mutt's avatar
Rye Mutt committed
    AUTOBUILD_ADDRSIZE: 64
Rye Mutt's avatar
Rye Mutt committed
  before_script:
    - python -m venv .venv
Rye Mutt's avatar
Rye Mutt committed
    - source .venv/bin/activate
Rye Mutt's avatar
Rye Mutt committed
    - pip3 install --upgrade autobuild
Rye Mutt's avatar
Rye Mutt committed
  script:
Rye Mutt's avatar
Rye Mutt committed
    - cov-configure --template --comptype clangcc --compiler clang-12
    - cov-configure --template --comptype clangcxx --compiler clang++-12
    - autobuild configure -c Coverity -- -DLL_TESTS=OFF -DUSE_FMODSTUDIO=ON -DUSE_NVAPI=ON -DUSE_LTO=OFF -DDISABLE_FATAL_WARNINGS=ON -DREVISION_FROM_VCS=FALSE -DUSE_PRECOMPILED_HEADERS=OFF
    - autobuild build -c Coverity --no-configure
    - pushd "build-linux-64"
    -   tar caf alchemyviewer.xz cov-int
    -   curl --header "JOB-TOKEN:$CI_JOB_TOKEN" --upload-file alchemyviewer.xz "${CI_API_V4_URL}/projects/165/packages/generic/coverity/0.0.$CI_PIPELINE_ID/alchemyviewer.xz"
    - popd
Rye Mutt's avatar
Rye Mutt committed
.win32_build:
  extends: .win_build
  variables:
    AUTOBUILD_ADDRSIZE: 32
  cache:
    key:
      prefix: windows32
Rye Mutt's avatar
Rye Mutt committed
.win64_build:
  extends: .win_build
Rye Mutt's avatar
Rye Mutt committed
  variables:
    AUTOBUILD_ADDRSIZE: 64
Rye Mutt's avatar
Rye Mutt committed
  cache:
    key:
      prefix: windows64
Rye Mutt's avatar
Rye Mutt committed
.mac64_build:
  extends: .mac_build
  variables:
    AUTOBUILD_ADDRSIZE: 64
  cache:
    key:
      prefix: darwin64

Rye Mutt's avatar
Rye Mutt committed
.linux32_build:
  extends: .linux_build
  variables:
    AUTOBUILD_ADDRSIZE: 32
  cache:
    key:
      prefix: linux32
Rye Mutt's avatar
Rye Mutt committed
.linux64_build:
  extends: .linux_build
  variables:
    AUTOBUILD_ADDRSIZE: 64
Rye Mutt's avatar
Rye Mutt committed
  cache:
    key:
      prefix: linux64

.dev_rules:
Rye Mutt's avatar
Rye Mutt committed
  rules:
    - if: $BUILD_CHANNEL != "Test" || $CI_COMMIT_TAG
Rye Mutt's avatar
Rye Mutt committed
      when: never
    - if: '$CI_PIPELINE_SOURCE == "web"'
    - if: '$CI_PIPELINE_SOURCE == "schedule"'
    #- if: '$CI_COMMIT_BRANCH == "main" && $CI_PIPELINE_SOURCE == "push"'
Rye Mutt's avatar
Rye Mutt committed
    #  when: delayed
    #  start_in: '12 hours'
Rye Mutt's avatar
Rye Mutt committed
  variables:
    VIEWER_CHANNEL_TYPE: Test
    VIEWER_USE_CRASHPAD: "FALSE"

Rye Mutt's avatar
Rye Mutt committed
.project_rules:
  rules:
    - if: '$BUILD_CHANNEL == "Project" && ($CI_PIPELINE_SOURCE == "web" || $CI_PIPELINE_SOURCE == "schedule")'
    - if: '$CI_COMMIT_TAG =~ /.*-project/'
  variables:
    VIEWER_CHANNEL_TYPE: Project

Rye Mutt's avatar
Rye Mutt committed
.beta_rules:
  rules:
    - if: '$BUILD_CHANNEL == "Beta" && ($CI_PIPELINE_SOURCE == "web" || $CI_PIPELINE_SOURCE == "schedule")'
    - if: '$CI_COMMIT_TAG =~ /.*-beta/'
  variables:
    VIEWER_CHANNEL_TYPE: Beta
Rye Mutt's avatar
Rye Mutt committed
.release_rules:
  rules:
    - if: '$BUILD_CHANNEL == "Release" && ($CI_PIPELINE_SOURCE == "web" || $CI_PIPELINE_SOURCE == "schedule")'
    - if: '$CI_COMMIT_TAG =~ /.*-release/'
  variables:
Rye Mutt's avatar
Rye Mutt committed
    VIEWER_CHANNEL_TYPE: Release

build:dev:linux64:
Rye Mutt's avatar
Rye Mutt committed
  extends: 
    - .linux64_build 
    - .dev_rules
build:dev:mac64:
Rye Mutt's avatar
Rye Mutt committed
  extends: 
    - .mac64_build
    - .dev_rules
Rye Mutt's avatar
Rye Mutt committed

.build:dev:windows32:
Rye Mutt's avatar
Rye Mutt committed
  extends: 
    - .win32_build
    - .dev_rules
build:dev:windows64:
Rye Mutt's avatar
Rye Mutt committed
  extends: 
    - .win64_build
    - .dev_rules
Rye Mutt's avatar
Rye Mutt committed

build:project:linux64:
  extends: 
    - .linux64_build
    - .project_rules

Rye Mutt's avatar
Rye Mutt committed
build:project:mac64:
  extends: 
    - .mac64_build
    - .project_rules

Rye Mutt's avatar
Rye Mutt committed
.build:project:windows64:
  extends: 
    - .win32_build
    - .project_rules

build:project:windows64:
  extends: 
    - .win64_build
    - .project_rules

build:beta:linux64:
Rye Mutt's avatar
Rye Mutt committed
  extends: 
    - .linux64_build
    - .beta_rules
Rye Mutt's avatar
Rye Mutt committed
build:beta:mac64:
  extends: 
    - .mac64_build
    - .beta_rules

Rye Mutt's avatar
Rye Mutt committed
.build:beta:windows32:
  extends: 
    - .win32_build
    - .beta_rules

build:beta:windows64:
Rye Mutt's avatar
Rye Mutt committed
  extends: 
    - .win64_build
    - .beta_rules

build:release:linux64:
Rye Mutt's avatar
Rye Mutt committed
  extends: 
    - .linux64_build
    - .release_rules
Rye Mutt's avatar
Rye Mutt committed
build:release:mac64:
  extends: 
    - .mac64_build
    - .release_rules

Rye Mutt's avatar
Rye Mutt committed
.build:release:windows32:
  extends: 
    - .win32_build
    - .release_rules

build:release:windows64:
Rye Mutt's avatar
Rye Mutt committed
  extends: 
    - .win64_build
    - .release_rules
Rye Mutt's avatar
Rye Mutt committed
.upload_template:
  stage: upload
Rye Mutt's avatar
Rye Mutt committed
  image: r.alchemyviewer.org/alchemy/infrastructure/viewer-deploy-image:latest
Rye Mutt's avatar
Rye Mutt committed
    - pwsh
    - docker
  allow_failure: false
  script:
    - $BuildData = Get-Content ./build-vc-64/newview/Release/build_data.json | ConvertFrom-Json
    - $BuildChannelVersion = $BuildData.Channel + ' ' + $BuildData.Version
    - $PkgName = $BuildData.Channel.Replace(" ", "_")
    - $PkgVer = $BuildData.Version
    - $UploadDestURL = "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/${PkgName}/${PkgVer}"
    - >
        $UploadParams = @{
         Method = "PUT";
         Headers = @{
           "JOB-TOKEN" = "${CI_JOB_TOKEN}"; };
         Verbose = $true;
        };

    - If ($env:USE_SENTRY -eq 'TRUE') { sentry-cli releases new $BuildChannelVersion && sentry-cli releases set-commits --auto $BuildChannelVersion }

    - $DestStatus = "?select=package_file&status=default"
Rye Mutt's avatar
Rye Mutt committed
    - If ($env:PUBLIC_BUILD -eq 'FALSE') { $DestStatus = "?select=package_file&status=hidden" }

    - Push-Location ./build-linux-64/
    -   Push-Location ./newview/
    -     $LnxFileName = Get-ChildItem -Path . -Name -Include Alchemy_*.tar.*
    -     $LnxFileHash = (Get-FileHash .\$LnxFileName -a sha256).Hash
Rye Mutt's avatar
Rye Mutt committed
    -     $LnxPackageUrl = "${UploadDestURL}/${LnxFileName}"
    -     $LnxUploadResult = Invoke-WebRequest -HttpVersion 2.0 @UploadParams -InFile ./$LnxFileName -Uri "${LnxPackageUrl}${DestStatus}" | ConvertFrom-Json
    -     If ($LnxFileHash -ne $LnxUploadResult.file_sha256) { Write-Output "Upload hash mismatch. expected $Hash actual $($LnxUploadResult.file_sha256)" && Exit 1 }
    -   Pop-Location
    -   If ($env:USE_SENTRY -eq 'TRUE') { sentry-cli upload-dif newview/alchemy-bin newview/alchemy-bin.debug newview/alchemy-bin.src.zip packages/ }
    - Pop-Location

    - Push-Location ./build-darwin-64/
    -   Push-Location ./newview/
    -     $MacFileName = Get-ChildItem -Path . -Name -Include Alchemy_*.dmg
    -     $MacFileHash = (Get-FileHash .\$MacFileName -a sha256).Hash
Rye Mutt's avatar
Rye Mutt committed
    -     $MacPackageUrl = "${UploadDestURL}/${MacFileName}"
    -     $MacUploadResult = Invoke-WebRequest -HttpVersion 2.0 @UploadParams -InFile ./$MacFileName -Uri "${MacPackageUrl}${DestStatus}" | ConvertFrom-Json
    -     If ($MacFileHash -ne $MacUploadResult.file_sha256)  { Write-Output "Upload hash mismatch. expected $Hash actual $($MacUploadResult.file_sha256)" && Exit 1 }
    -   Pop-Location
    -   If ($env:USE_SENTRY -eq 'TRUE') { sentry-cli upload-dif newview/Release/ packages/ }
    - Pop-Location

    - Push-Location ./build-vc-64/
    -   Push-Location ./newview/Release/
    -     $WinFileName = Get-ChildItem -Path . -Name -Include Alchemy_*_Setup.exe
    -     $WinFileHash = (Get-FileHash .\$WinFileName -a sha256).Hash
Rye Mutt's avatar
Rye Mutt committed
    -     $WinPackageUrl = "${UploadDestURL}/${WinFileName}"
    -     $WinUploadResult = Invoke-WebRequest -HttpVersion 2.0 @UploadParams -InFile ./$WinFileName -Uri "${WinPackageUrl}${DestStatus}" | ConvertFrom-Json
    -     If ($WinFileHash -ne $WinUploadResult.file_sha256) { Write-Output "Upload hash mismatch. expected $Hash actual $($WinUploadResult.file_sha256)" && Exit 1 }
    -   Pop-Location
    -   $AlchemyBinPath = Resolve-Path newview/Release/alchemy-bin.*
    -   If ($env:USE_SENTRY -eq 'TRUE') { sentry-cli upload-dif $AlchemyBinPath packages/ }
    - Pop-Location
    - If ($env:USE_SENTRY -eq 'TRUE') { sentry-cli releases finalize $BuildChannelVersion }
Rye Mutt's avatar
Rye Mutt committed
    - Write-Output "Deploy Success!"
    - Write-Output "Package Listing > https://git.alchemyviewer.org/alchemy/alchemy-next/-/packages/$($WinUploadResult.package_id)"
    - Write-Output "Windows Package > ${WinPackageUrl}"
    - Write-Output "macOS Package   > ${MacPackageUrl}"
    - Write-Output "Linux Package   > ${LnxPackageUrl}"
Rye Mutt's avatar
Rye Mutt committed
upload:project:
  extends:
    - .upload_template
  rules:
    - if: '$BUILD_CHANNEL == "Project" && ($CI_PIPELINE_SOURCE == "web" || $CI_PIPELINE_SOURCE == "schedule")'
      when: manual
    - if: '$CI_COMMIT_TAG =~ /.*-project/'
      when: manual
Rye Mutt's avatar
Rye Mutt committed
  environment:
    name: qa
Rye Mutt's avatar
Rye Mutt committed
upload:beta:
  extends:
    - .upload_template
  rules:
    - if: '$BUILD_CHANNEL == "Beta" && ($CI_PIPELINE_SOURCE == "web" || $CI_PIPELINE_SOURCE == "schedule")'
      when: manual
    - if: '$CI_COMMIT_TAG =~ /.*-beta/'
      when: manual
Rye Mutt's avatar
Rye Mutt committed
  environment:
    name: beta
Rye Mutt's avatar
Rye Mutt committed
upload:release:
  extends:
    - .upload_template
  rules:
    - if: '$BUILD_CHANNEL == "Release" && ($CI_PIPELINE_SOURCE == "web" || $CI_PIPELINE_SOURCE == "schedule")'
      when: manual
    - if: '$CI_COMMIT_TAG =~ /.*-release/'
      when: manual
Rye Mutt's avatar
Rye Mutt committed
  environment: