Skip to content
Snippets Groups Projects
.gitlab-ci.yml 8.89 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:
  AUTOBUILD_BUILD_ID: $CI_PIPELINE_ID
Rye Mutt's avatar
Rye Mutt committed
  AUTOBUILD_INSTALLABLE_CACHE: "$CI_PROJECT_DIR/.cache/autobuild"
  PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
  VIEWER_USE_CRASHPAD: "FALSE"
Rye Mutt's avatar
Rye Mutt committed
  VIEWER_CRASHPAD_URL: $SENTRY_DSN

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
      - .venv/
    when: 'always'
  before_script:
Rye Mutt's avatar
Rye Mutt committed
    - virtualenv .venv
    - .\.venv\Scripts\activate.ps1
    - pip install --upgrade autobuild -i https://pkg.alchemyviewer.org/repository/autobuild/simple --extra-index-url https://pypi.org/simple
        autobuild configure -c ReleaseOS -- -DUSE_FMODSTUDIO=ON -DUSE_NVAPI=ON -DUSE_LTO=ON -DDISABLE_FATAL_WARNINGS=ON -DREVISION_FROM_VCS=FALSE
Rye Mutt's avatar
Rye Mutt committed
        autobuild build -c ReleaseOS --no-configure
  artifacts:
    name: "$env:CI_COMMIT_REF_NAME-$env:CI_COMMIT_SHORT_SHA"
Rye Mutt's avatar
Rye Mutt committed
    expire_in: 1 week
    paths:
      - build-vc-*/newview/Release/build_data.json
      - build-vc-*/newview/Release/alchemy-bin.exe
      - build-vc-*/newview/Release/*.pdb
      - build-vc-*/newview/Release/*.dll
      - build-vc-*/newview/Release/Alchemy_*_Setup.exe
Rye Mutt's avatar
Rye Mutt committed
.mac_build:
  stage: build
  tags:
    - mac
  cache:
    key:
      files:
        - autobuild.xml
      prefix: ${CI_JOB_NAME}
    paths:
      - .cache/autobuild
      - .cache/pip
      - .venv
    when: 'always'
  before_script:
    - virtualenv .venv -p python2
    - source .venv/bin/activate
    - pip install --upgrade autobuild dmgbuild -i https://pkg.alchemyviewer.org/repository/autobuild/simple --extra-index-url https://pypi.org/simple
Rye Mutt's avatar
Rye Mutt committed
  script:
    - |
        autobuild configure -c ReleaseOS -- -DUSE_FMODSTUDIO=ON -DUSE_NVAPI=ON -DUSE_LTO=ON -DDISABLE_FATAL_WARNINGS=ON -DREVISION_FROM_VCS=FALSE
        autobuild build -c ReleaseOS --no-configure
  artifacts:
    name: "$env:CI_COMMIT_REF_NAME-$env:CI_COMMIT_SHORT_SHA"
    expire_in: 1 week
    paths:
      - build-darwin-*/build_data.json
      - build-darwin-*/newview/Alchemy_*.dmg

Rye Mutt's avatar
Rye Mutt committed
.linux_build:
Rye Mutt's avatar
Rye Mutt committed
  stage: build
Rye Mutt's avatar
Rye Mutt committed
  image: r.alchemyviewer.org/alchemy/infrastructure/debian-build-image:latest
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
      - .venv
    when: 'always'
  before_script:
    - virtualenv .venv -p python2
    - source .venv/bin/activate
    - pip install --upgrade autobuild -i https://pkg.alchemyviewer.org/repository/autobuild/simple --extra-index-url https://pypi.org/simple
Rye Mutt's avatar
Rye Mutt committed
  script:
        autobuild configure -c ReleaseOS -- -DUSE_FMODSTUDIO=ON -DUSE_NVAPI=ON -DUSE_LTO=ON -DDISABLE_FATAL_WARNINGS=ON -DREVISION_FROM_VCS=FALSE
Rye Mutt's avatar
Rye Mutt committed
        autobuild build -c ReleaseOS --no-configure
Rye Mutt's avatar
Rye Mutt committed
  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
    paths:
      - build-linux-*/build_data.json
      - build-linux-*/newview/Alchemy_*.tar.xz
Rye Mutt's avatar
Rye Mutt committed

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

.master_rules:
  rules:
    - if: $BUILD_CHANNEL || $CI_COMMIT_TAG
      when: never
    - if: '$CI_PIPELINE_SOURCE == "web"'
    - if: '$CI_PIPELINE_SOURCE == "schedule"'
Rye Mutt's avatar
Rye Mutt committed
    #- if: '$CI_COMMIT_BRANCH == "master" && $CI_PIPELINE_SOURCE == "push"'
    #  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:master:linux64:
  extends: 
    - .linux64_build 
    - .master_rules

Rye Mutt's avatar
Rye Mutt committed
build:master:mac64:
  extends: 
    - .mac64_build
    - .master_rules

Rye Mutt's avatar
Rye Mutt committed
.build:master:windows32:
  extends: 
    - .win32_build
    - .master_rules

build:master:windows64:
  extends: 
    - .win64_build
    - .master_rules

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
  tags:
    - autobuild
    - windows
  allow_failure: false
  script:
    - |
        $BuildData = Get-Content .\build-vc-64\newview\Release\build_data.json | ConvertFrom-Json
        $BuildChannelVersion = $BuildData."Channel" + ' ' + $BuildData."Version"
        $UploadDestViewerDir = $BuildChannelVersion.ToLower().Replace(" ", "/")
        $UploadDestURL = "https://pkg.alchemyviewer.org/repository/viewer/${UploadDestViewerDir}"

        $UploadParams = @{ UseBasicParsing = $true;
         Method = "PUT";
         Headers = @{
           ContentType = "application/x-executable";
           Authorization = "Basic $([System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes("$env:AUTOBUILD_HTTP_USER`:$env:AUTOBUILD_HTTP_PASS")))"; };
         Verbose = $true; };

        Push-Location .\build-linux-64\newview\
          $FileNameLnx64 = Get-ChildItem -Path . -Name -Include Alchemy_*.tar.xz
          Invoke-WebRequest @UploadParams -InFile .\$FileNameLnx64 -Uri "${UploadDestURL}/${FileNameLnx64}"
Rye Mutt's avatar
Rye Mutt committed
        Push-Location .\build-darwin-64\newview\
          $FileNameMac64 = Get-ChildItem -Path . -Name -Include Alchemy_*.dmg
          Invoke-WebRequest @UploadParams -InFile .\$FileNameMac64 -Uri "${UploadDestURL}/${FileNameMac64}"
        Pop-Location

        Push-Location .\build-vc-64\newview\Release\
          $FileNameWin64 = Get-ChildItem -Path . -Name -Include Alchemy_*_Setup.exe
          Invoke-WebRequest @UploadParams -InFile .\$FileNameWin64 -Uri "${UploadDestURL}/${FileNameWin64}"

          If ($env:VIEWER_USE_CRASHPAD -eq 'TRUE') 
          {
            sentry-cli upload-dif --include-sources alchemy-bin.exe alchemy-bin.pdb crashpad_handler.exe crashpad_handler.pdb openjpeg.pdb openjpeg.dll fmod.dll libcrypto-1_1.dll libcrypto-1_1.pdb libssl-1_1.dll libssl-1_1.pdb libcrypto-1_1-x64.dll libcrypto-1_1-x64.pdb libssl-1_1-x64.dll libssl-1_1-x64.pdb vcruntime140.dll msvcp140.dll nghttp2.dll glod.dll
          }
        Pop-Location
        If ($env:VIEWER_USE_CRASHPAD -eq 'TRUE') 
        {
          sentry-cli releases new $BuildChannelVersion
          sentry-cli releases set-commits --auto $BuildChannelVersion
          sentry-cli releases finalize $BuildChannelVersion
        }
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:
Rye Mutt's avatar
Rye Mutt committed
    name: release