Clean up the YML for our Unix based builds (#8543)

* Make cibuild.sh consistent with CIBuild.cmd

The razor repo was inconsistent with how it handled CI build files. On Windows there was a custom build file, `eng/CBuild.cmd`, which implicitly passed along `-ci` only and required all other args to be explicity. On Unix we used `eng/common/cibuild.sh` which implicitly passed along `--restore --build --test --pack --publish --ci`.

This makes our YML file much harder to read and maintain becuase it has very different arguments across the platforms. This change addresses this by adding `eng/cibuild.sh` which effectively mirrors `eng/CIBuild.cmd` updates the YML file accordingly.

* Move to single build step

Instead of having two build steps that were `{{ if ... }`` on official builds have a single build step. This matches our behavior on Windows based builds.

* Break into restore, bulid and test phases

This matches our setup in Windows

* Use -nobl option

The --excludeCIBinaryLog option does not work on Unix due to a casing
bug. Using -nobl instead across all OS

https://github.com/dotnet/arcade/pull/12998

* fixup

* Revert the breakup into three steps

* Must restore
This commit is contained in:
Jared Parsons 2023-03-30 13:02:14 -07:00 коммит произвёл GitHub
Родитель 97ddc233a3
Коммит 0653fb8900
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 68 добавлений и 49 удалений

Просмотреть файл

@ -206,7 +206,7 @@ stages:
-msbuildEngine vs
-prepareMachine
-restore
-excludeCIBinarylog
-nobl
name: Restore
displayName: Restore
condition: succeeded()
@ -233,6 +233,7 @@ stages:
-configuration $(_BuildConfig)
-prepareMachine
-test
-nobl
name: Run_Unit_Tests
displayName: Run Unit Tests
condition: succeeded()
@ -305,6 +306,14 @@ stages:
matrix:
release:
_BuildConfig: Release
variables:
- _BuildArgs: ''
# Variables for internal Official builds
- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
- _BuildArgs: /p:DotNetPublishUsingPipelines=true
/p:OfficialBuildId=$(Build.BuildNumber)
steps:
- task: NodeTool@0
displayName: Install Node 10.x
@ -318,28 +327,21 @@ stages:
arguments: $(Build.SourcesDirectory)/NuGet.config $Token
env:
Token: $(dn-bot-dnceng-artifact-feeds-rw)
- ${{ if ne(variables['System.TeamProject'], 'public') }}:
- script: eng/common/cibuild.sh
--restore
--build
--pack
--publish
--configuration $(_BuildConfig)
--prepareMachine
/p:DotNetPublishUsingPipelines=true
/p:OfficialBuildId=$(Build.BuildNumber)
$(_InternalRuntimeDownloadArgs)
name: Build
displayName: Build
condition: succeeded()
- ${{ if eq(variables['System.TeamProject'], 'public') }}:
- script: eng/common/cibuild.sh
--configuration $(_BuildConfig)
--prepareMachine
$(_InternalRuntimeDownloadArgs)
name: Build
displayName: Build
condition: succeeded()
- script: eng/cibuild.sh
--restore
--build
--pack
--publish
--configuration $(_BuildConfig)
--prepareMachine
--test
$(_BuildArgs)
$(_InternalRuntimeDownloadArgs)
name: Build
displayName: Restore, Build and Test
condition: succeeded()
- publish: artifacts/TestResults/$(_BuildConfig)
artifact: $(Agent.Os)_$(Agent.JobName) Attempt $(System.JobAttempt) TestResults
displayName: Publish Test Results
@ -356,10 +358,6 @@ stages:
name: $(DncEngInternalBuildPool)
demands: ImageOverride -equals Build.Ubuntu.1804.Amd64
variables:
- LC_ALL: 'en_US.UTF-8'
- LANG: 'en_US.UTF-8'
- LANGUAGE: 'en_US.UTF-8'
strategy:
${{ if eq(variables['System.TeamProject'], 'public') }}:
matrix:
@ -371,6 +369,18 @@ stages:
matrix:
release:
_BuildConfig: Release
variables:
- LC_ALL: 'en_US.UTF-8'
- LANG: 'en_US.UTF-8'
- LANGUAGE: 'en_US.UTF-8'
- _BuildArgs: ''
# Variables for internal Official builds
- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
- _BuildArgs: /p:DotNetPublishUsingPipelines=true
/p:OfficialBuildId=$(Build.BuildNumber)
steps:
- task: NodeTool@0
displayName: Install Node 10.x
@ -384,28 +394,21 @@ stages:
arguments: $(Build.SourcesDirectory)/NuGet.config $Token
env:
Token: $(dn-bot-dnceng-artifact-feeds-rw)
- ${{ if ne(variables['System.TeamProject'], 'public') }}:
- script: eng/common/cibuild.sh
--restore
--build
--pack
--publish
--configuration $(_BuildConfig)
--prepareMachine
/p:DotNetPublishUsingPipelines=true
/p:OfficialBuildId=$(Build.BuildNumber)
$(_InternalRuntimeDownloadArgs)
name: Build
displayName: Build
condition: succeeded()
- ${{ if eq(variables['System.TeamProject'], 'public') }}:
- script: eng/common/cibuild.sh
--configuration $(_BuildConfig)
--prepareMachine
$(_InternalRuntimeDownloadArgs)
name: Build
displayName: Build
condition: succeeded()
- script: eng/cibuild.sh
--restore
--build
--pack
--publish
--configuration $(_BuildConfig)
--prepareMachine
--test
$(_BuildArgs)
$(_InternalRuntimeDownloadArgs)
name: Build
displayName: Restore, Build and Test
condition: succeeded()
- publish: artifacts/TestResults/$(_BuildConfig)/
artifact: $(Agent.Os)_$(Agent.JobName) Attempt $(System.JobAttempt) TestResults
displayName: Publish Test Results

16
eng/cibuild.sh Executable file
Просмотреть файл

@ -0,0 +1,16 @@
#!/usr/bin/env bash
source="${BASH_SOURCE[0]}"
# resolve $SOURCE until the file is no longer a symlink
while [[ -h $source ]]; do
scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"
source="$(readlink "$source")"
# if $source was a relative symlink, we need to resolve it relative to the path where
# the symlink file was located
[[ $source != /* ]] && source="$scriptroot/$source"
done
scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"
. "$scriptroot/common/build.sh" --ci $@