New year, new gitlab-ci; thanks Rye!~

This commit is contained in:
Liru Færs
2021-02-14 13:51:07 -05:00
parent 246db973b4
commit 8d2bdd4a18

View File

@@ -1,168 +1,279 @@
stages: stages:
- build - build
- deploy - upload
default:
interruptible: true
timeout: 4h
variables: variables:
AUTOBUILD_BUILD_ID: $CI_PIPELINE_ID
AUTOBUILD_INSTALLABLE_CACHE: "$CI_PROJECT_DIR/.cache/autobuild"
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
VIEWER_USE_CRASHPAD: "TRUE" VIEWER_USE_CRASHPAD: "TRUE"
VIEWER_CRASHPAD_URL: $SENTRY_DSN VIEWER_CRASHPAD_URL: $SENTRY_DSN
.win_build: &win_build .win_build:
stage: build stage: build
tags: tags:
- autobuild - autobuild
- windows - windows
cache:
key:
files:
- autobuild.xml
prefix: ${CI_JOB_NAME}
paths:
- .cache/autobuild
- .cache/pip
- .venv/
when: 'always'
before_script: before_script:
- pipenv install - 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
script: script:
- If ($env:VIEWER_CHANNEL_TYPE -eq 'Project') - |
{ autobuild configure -c Release -- -DUSE_FMODSTUDIO=ON -DUSE_NVAPI=ON -DUSE_LTO=ON -DVS_DISABLE_FATAL_WARNINGS=ON -DREVISION_FROM_VCS=FALSE
$env:VIEWER_CHANNEL_CODENAME = $env:CI_COMMIT_REF_NAME[8..100] -join '' autobuild build -c Release --no-configure
}
- pipenv run autobuild configure -c Release -- -DUSE_FMODSTUDIO=ON -DUSE_NVAPI=ON -DUSE_LTO=ON -DVS_DISABLE_FATAL_WARNINGS=ON
- pipenv run autobuild build -c Release --no-configure
- If ($env:VIEWER_USE_CRASHPAD -eq 'TRUE') {
- Push-Location .\build-vc-*\newview\Release\
- sentry-cli upload-dif --include-sources singularity-bin.exe singularity-bin.pdb crashpad_handler.exe crashpad_handler.pdb 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 libhunspell.dll libhunspell.pdb glod.dll
- Pop-Location }
artifacts: artifacts:
name: "$env:CI_COMMIT_REF_NAME-$env:CI_COMMIT_SHORT_SHA" name: "$env:CI_COMMIT_REF_NAME-$env:CI_COMMIT_SHORT_SHA"
expire_in: 2 week expire_in: 1 week
paths: paths:
- build-vc-*/newview/Release/build_data.json - build-vc-*/newview/Release/build_data.json
- build-vc-*/newview/Release/singularity-bin.pdb - build-vc-*/newview/Release/singularity-bin.exe
- build-vc-*/newview/Release/*.pdb
- build-vc-*/newview/Release/*.dll
- build-vc-*/newview/Release/Singularity_*_Setup.exe - build-vc-*/newview/Release/Singularity_*_Setup.exe
.beta_rules: &beta_rules .linux_build:
only: stage: build
- /^.*-beta$/ image: r.alchemyviewer.org/singularity/infrastructure/debian-build-image:latest
except: tags:
- branches - linux
- docker
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
script:
- |
autobuild configure -c Release -- -DUSE_FMODSTUDIO=ON -DUSE_NVAPI=ON -DUSE_LTO=ON -DUNIX_DISABLE_FATAL_WARNINGS=ON -DREVISION_FROM_VCS=FALSE
autobuild build -c Release --no-configure
artifacts:
name: "$env:CI_COMMIT_REF_NAME-$env:CI_COMMIT_SHORT_SHA"
expire_in: 1 week
paths:
- build-linux-*/build_data.json
- build-linux-*/newview/Singularity_*.tar.xz
.release_rules: &release_rules .win32_build:
only: extends: .win_build
- /^.*-release$/ variables:
except: AUTOBUILD_ADDRSIZE: 32
- branches VIEWER_USE_CRASHPAD: "FALSE"
cache:
key:
prefix: windows32
.win64_build:
extends: .win_build
variables:
AUTOBUILD_ADDRSIZE: 64
cache:
key:
prefix: windows64
.linux32_build:
extends: .linux_build
variables:
AUTOBUILD_ADDRSIZE: 32
cache:
key:
prefix: linux32
.linux64_build:
extends: .linux_build
variables:
AUTOBUILD_ADDRSIZE: 64
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"'
#- if: '$CI_COMMIT_BRANCH == "master" && $CI_PIPELINE_SOURCE == "push"'
# when: delayed
# start_in: '12 hours'
variables:
VIEWER_CHANNEL_TYPE: Test
VIEWER_USE_CRASHPAD: "FALSE"
.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
.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
.release_rules:
rules:
- if: '$BUILD_CHANNEL == "Release" && ($CI_PIPELINE_SOURCE == "web" || $CI_PIPELINE_SOURCE == "schedule")'
- if: '$CI_COMMIT_TAG =~ /.*-release/'
variables:
VIEWER_CHANNEL_TYPE: Release
.build:master:linux64:
extends:
- .linux64_build
- .master_rules
build:master:windows32: build:master:windows32:
<<: *win_build extends:
interruptible: true - .win32_build
variables: - .master_rules
AUTOBUILD_ADDRSIZE: 32
VIEWER_CHANNEL_TYPE: Test
VIEWER_USE_CRASHPAD: "FALSE"
only:
- schedules
- web
build:master:windows64: build:master:windows64:
<<: *win_build extends:
interruptible: true - .win64_build
variables: - .master_rules
AUTOBUILD_ADDRSIZE: 64
VIEWER_CHANNEL_TYPE: Test .build:project:linux64:
VIEWER_USE_CRASHPAD: "FALSE" extends:
only: - .linux64_build
- schedules - .project_rules
- web
build:project:windows32: build:project:windows32:
<<: *win_build extends:
interruptible: true - .win32_build
variables: - .project_rules
AUTOBUILD_ADDRSIZE: 32
VIEWER_CHANNEL_TYPE: Project
VIEWER_USE_CRASHPAD: "FALSE"
only:
- /^project-.*$/
build:project:windows64: build:project:windows64:
<<: *win_build extends:
interruptible: true - .win64_build
variables: - .project_rules
AUTOBUILD_ADDRSIZE: 64
VIEWER_CHANNEL_TYPE: Project .build:beta:linux64:
only: extends:
- /^project-.*$/ - .linux64_build
- .beta_rules
build:beta:windows32: build:beta:windows32:
<<: *win_build extends:
variables: - .win32_build
AUTOBUILD_ADDRSIZE: 32 - .beta_rules
VIEWER_CHANNEL_TYPE: Beta
VIEWER_USE_CRASHPAD: "FALSE"
<<: *beta_rules
build:beta:windows64: build:beta:windows64:
<<: *win_build extends:
variables: - .win64_build
AUTOBUILD_ADDRSIZE: 64 - .beta_rules
VIEWER_CHANNEL_TYPE: Beta
<<: *beta_rules .build:release:linux64:
extends:
- .linux64_build
- .release_rules
build:release:windows32: build:release:windows32:
<<: *win_build extends:
variables: - .win32_build
AUTOBUILD_ADDRSIZE: 32 - .release_rules
VIEWER_CHANNEL_TYPE: Release
VIEWER_USE_CRASHPAD: "FALSE"
<<: *release_rules
build:release:windows64: build:release:windows64:
<<: *win_build extends:
variables: - .win64_build
AUTOBUILD_ADDRSIZE: 64 - .release_rules
VIEWER_CHANNEL_TYPE: Release
<<: *release_rules
.deploy_template: &deploy_template .upload_template:
stage: deploy stage: upload
tags: tags:
- autobuild - autobuild
- windows - windows
allow_failure: false
script: script:
- $BuildData = Get-Content .\build-vc-64\newview\Release\build_data.json | ConvertFrom-Json - |
- $BuildChannelVersion = $BuildData."Channel" + ' ' + $BuildData."Version" $BuildData = Get-Content .\build-vc-64\newview\Release\build_data.json | ConvertFrom-Json
- $UploadDestViewerDir = $BuildChannelVersion.ToLower().Replace(" ", "/") $BuildChannelVersion = $BuildData."Channel" + ' ' + $BuildData."Version"
- $UploadDestURL = "https://pkg.alchemyviewer.org/repository/viewer/${UploadDestViewerDir}" $UploadDestViewerDir = $BuildChannelVersion.ToLower().Replace(" ", "/")
$UploadDestURL = "https://pkg.alchemyviewer.org/repository/viewer/${UploadDestViewerDir}"
- $UploadParams = @{ UseBasicParsing = $true; $UploadParams = @{ UseBasicParsing = $true;
Method = "PUT"; Method = "PUT";
Headers = @{ Headers = @{
ContentType = "application/x-executable"; ContentType = "application/x-executable";
Authorization = "Basic $([System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes("$env:AUTOBUILD_HTTP_USER`:$env:AUTOBUILD_HTTP_PASS")))"; }; Authorization = "Basic $([System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes("$env:AUTOBUILD_HTTP_USER`:$env:AUTOBUILD_HTTP_PASS")))"; };
Verbose = $true; }; Verbose = $true; };
- Push-Location .\build-vc-32\newview\Release\ Push-Location .\build-linux-64\newview\
- $FileNameWin32 = Get-ChildItem -Path . -Name -Include Singularity_*_Setup.exe $FileNameLnx64 = Get-ChildItem -Path . -Name -Include Singularity_*.tar.xz
- Invoke-WebRequest @UploadParams -InFile .\$FileNameWin32 -Uri "${UploadDestURL}/${FileNameWin32}" Invoke-WebRequest @UploadParams -InFile .\$FileNameLnx64 -Uri "${UploadDestURL}/${FileNameLnx64}"
- Pop-Location Pop-Location
- Push-Location .\build-vc-64\newview\Release\ Push-Location .\build-vc-64\newview\Release\
- $FileNameWin64 = Get-ChildItem -Path . -Name -Include Singularity_*_Setup.exe $FileNameWin64 = Get-ChildItem -Path . -Name -Include Singularity_*_Setup.exe
- Invoke-WebRequest @UploadParams -InFile .\$FileNameWin64 -Uri "${UploadDestURL}/${FileNameWin64}" Invoke-WebRequest @UploadParams -InFile .\$FileNameWin64 -Uri "${UploadDestURL}/${FileNameWin64}"
- Pop-Location
- sentry-cli releases new $BuildChannelVersion If ($env:VIEWER_USE_CRASHPAD -eq 'TRUE')
- sentry-cli releases set-commits --auto $BuildChannelVersion {
- sentry-cli releases finalize $BuildChannelVersion sentry-cli upload-dif --include-sources singularity-bin.exe singularity-bin.pdb crashpad_handler.exe crashpad_handler.pdb 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 libhunspell.dll libhunspell.pdb glod.dll
when: manual }
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
}
deploy_project: upload:project:
<<: *deploy_template 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
environment: environment:
name: qa name: qa
only:
- /^project-.*$/
deploy_beta: upload:beta:
<<: *deploy_template 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
environment: environment:
name: staging name: beta
<<: *beta_rules
deploy_release: upload:release:
<<: *deploy_template 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
environment: environment:
name: production name: release
<<: *release_rules