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:
- build
- deploy
- upload
default:
interruptible: true
timeout: 4h
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_CRASHPAD_URL: $SENTRY_DSN
.win_build: &win_build
.win_build:
stage: build
tags:
- autobuild
- windows
cache:
key:
files:
- autobuild.xml
prefix: ${CI_JOB_NAME}
paths:
- .cache/autobuild
- .cache/pip
- .venv/
when: 'always'
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:
- If ($env:VIEWER_CHANNEL_TYPE -eq 'Project')
{
$env:VIEWER_CHANNEL_CODENAME = $env:CI_COMMIT_REF_NAME[8..100] -join ''
}
- 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 }
- |
autobuild configure -c Release -- -DUSE_FMODSTUDIO=ON -DUSE_NVAPI=ON -DUSE_LTO=ON -DVS_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: 2 week
expire_in: 1 week
paths:
- 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
.beta_rules: &beta_rules
only:
- /^.*-beta$/
except:
- branches
.linux_build:
stage: build
image: r.alchemyviewer.org/singularity/infrastructure/debian-build-image:latest
tags:
- 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
only:
- /^.*-release$/
except:
- branches
.win32_build:
extends: .win_build
variables:
AUTOBUILD_ADDRSIZE: 32
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:
<<: *win_build
interruptible: true
variables:
AUTOBUILD_ADDRSIZE: 32
VIEWER_CHANNEL_TYPE: Test
VIEWER_USE_CRASHPAD: "FALSE"
only:
- schedules
- web
extends:
- .win32_build
- .master_rules
build:master:windows64:
<<: *win_build
interruptible: true
variables:
AUTOBUILD_ADDRSIZE: 64
VIEWER_CHANNEL_TYPE: Test
VIEWER_USE_CRASHPAD: "FALSE"
only:
- schedules
- web
extends:
- .win64_build
- .master_rules
.build:project:linux64:
extends:
- .linux64_build
- .project_rules
build:project:windows32:
<<: *win_build
interruptible: true
variables:
AUTOBUILD_ADDRSIZE: 32
VIEWER_CHANNEL_TYPE: Project
VIEWER_USE_CRASHPAD: "FALSE"
only:
- /^project-.*$/
extends:
- .win32_build
- .project_rules
build:project:windows64:
<<: *win_build
interruptible: true
variables:
AUTOBUILD_ADDRSIZE: 64
VIEWER_CHANNEL_TYPE: Project
only:
- /^project-.*$/
extends:
- .win64_build
- .project_rules
.build:beta:linux64:
extends:
- .linux64_build
- .beta_rules
build:beta:windows32:
<<: *win_build
variables:
AUTOBUILD_ADDRSIZE: 32
VIEWER_CHANNEL_TYPE: Beta
VIEWER_USE_CRASHPAD: "FALSE"
<<: *beta_rules
extends:
- .win32_build
- .beta_rules
build:beta:windows64:
<<: *win_build
variables:
AUTOBUILD_ADDRSIZE: 64
VIEWER_CHANNEL_TYPE: Beta
<<: *beta_rules
extends:
- .win64_build
- .beta_rules
.build:release:linux64:
extends:
- .linux64_build
- .release_rules
build:release:windows32:
<<: *win_build
variables:
AUTOBUILD_ADDRSIZE: 32
VIEWER_CHANNEL_TYPE: Release
VIEWER_USE_CRASHPAD: "FALSE"
<<: *release_rules
extends:
- .win32_build
- .release_rules
build:release:windows64:
<<: *win_build
variables:
AUTOBUILD_ADDRSIZE: 64
VIEWER_CHANNEL_TYPE: Release
<<: *release_rules
extends:
- .win64_build
- .release_rules
.deploy_template: &deploy_template
stage: deploy
.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}"
- |
$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; };
$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-vc-32\newview\Release\
- $FileNameWin32 = Get-ChildItem -Path . -Name -Include Singularity_*_Setup.exe
- Invoke-WebRequest @UploadParams -InFile .\$FileNameWin32 -Uri "${UploadDestURL}/${FileNameWin32}"
- Pop-Location
Push-Location .\build-linux-64\newview\
$FileNameLnx64 = Get-ChildItem -Path . -Name -Include Singularity_*.tar.xz
Invoke-WebRequest @UploadParams -InFile .\$FileNameLnx64 -Uri "${UploadDestURL}/${FileNameLnx64}"
Pop-Location
- Push-Location .\build-vc-64\newview\Release\
- $FileNameWin64 = Get-ChildItem -Path . -Name -Include Singularity_*_Setup.exe
- Invoke-WebRequest @UploadParams -InFile .\$FileNameWin64 -Uri "${UploadDestURL}/${FileNameWin64}"
- Pop-Location
Push-Location .\build-vc-64\newview\Release\
$FileNameWin64 = Get-ChildItem -Path . -Name -Include Singularity_*_Setup.exe
Invoke-WebRequest @UploadParams -InFile .\$FileNameWin64 -Uri "${UploadDestURL}/${FileNameWin64}"
- sentry-cli releases new $BuildChannelVersion
- sentry-cli releases set-commits --auto $BuildChannelVersion
- sentry-cli releases finalize $BuildChannelVersion
when: manual
If ($env:VIEWER_USE_CRASHPAD -eq 'TRUE')
{
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
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:
<<: *deploy_template
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
environment:
name: qa
only:
- /^project-.*$/
deploy_beta:
<<: *deploy_template
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
environment:
name: staging
<<: *beta_rules
name: beta
deploy_release:
<<: *deploy_template
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
environment:
name: production
<<: *release_rules
name: release