Skip to content

Commit

Permalink
Fixed / updated CI (#162)
Browse files Browse the repository at this point in the history
* Fixed deploy step in CI

* Update pipeline

* Reordered stages
  • Loading branch information
gfoidl authored May 19, 2020
1 parent 72fa51f commit 436b0bf
Show file tree
Hide file tree
Showing 9 changed files with 263 additions and 149 deletions.
38 changes: 23 additions & 15 deletions .azure/pipelines/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,26 +52,13 @@ stages:
name: mac
vmImage: 'macOS-10.15'

- stage: Demo
- stage: Code_Coverage
dependsOn:
- Build_Test_Windows
- Build_Test_Linux
- Build_Test_MacOS
jobs:
- template: jobs/demo.yml
parameters:
name: demo_windows
vmImage: 'windows-2019'

- template: jobs/demo.yml
parameters:
name: demo_linux
vmImage: 'ubuntu-18.04'

- template: jobs/demo.yml
parameters:
name: demo_mac
vmImage: 'macOS-10.15'
- template: jobs/coverage.yml

- stage: Build_Docs
dependsOn:
Expand Down Expand Up @@ -118,3 +105,24 @@ stages:
parameters:
name: benchmarks_net_full
vmImage: 'windows-2019'

- stage: Demo
dependsOn:
- Build_Test_Windows
- Build_Test_Linux
- Build_Test_MacOS
jobs:
- template: jobs/demo.yml
parameters:
name: demo_windows
vmImage: 'windows-2019'

- template: jobs/demo.yml
parameters:
name: demo_linux
vmImage: 'ubuntu-18.04'

- template: jobs/demo.yml
parameters:
name: demo_mac
vmImage: 'macOS-10.15'
74 changes: 39 additions & 35 deletions .azure/pipelines/jobs/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,54 +22,58 @@ jobs:
# includePreviewVersions: true

- bash: |
export PATH="$(pwd)/dotnet:$PATH"
echo 'installed sdks:'
dotnet --list-sdks
echo "-------------------------------------------------"
echo 'environment variables:'
env | sort
chmod u+x ./build.sh
./build.sh build
displayName: build
displayName: init
- bash: |
export PATH="$(pwd)/dotnet:$PATH"
echo 'installed sdks:'
dotnet --list-sdks
echo "-------------------------------------------------"
- bash: ./build.sh build
displayName: build

./build.sh test
- bash: ./build.sh test-coverage
displayName: test

- task: PublishTestResults@2
condition: always()
inputs:
testRunner: VSTest
testResultsFiles: '**/*.trx'

- bash: |
export PATH="$(pwd)/dotnet:$PATH"
echo 'installed sdks:'
dotnet --list-sdks
echo "-------------------------------------------------"
cd tests/Coverage
dotnet tool install -g coverlet.console
# Workaround
# https://github.com/Microsoft/azure-pipelines-tasks/issues/8291#issuecomment-441707116
export PATH="$PATH:$HOME/.dotnet/tools"
./build.sh coverage
displayName: code coverage
condition: and(succeeded(), variables['CODECOV_TOKEN'], ne(variables['Agent.OS'], 'Darwin'))
workDir="$(System.DefaultWorkingDirectory)"
- bash: |
echo 'installed sdks:'
dotnet --list-sdks
echo "-------------------------------------------------"
if [[ "$AGENT_OS" == "Windows_NT" ]]; then
# Windows needs special treetment for the substitution due the \
workDir="${workDir//\\/\\\\}\\\\"
else
workDir+="/"
fi
# Mac has a different sed, so special case it (hooray for standars ;-))
if [[ "$AGENT_OS" != "Darwin" ]]; then
sed -i 's|<source>[^<]*</source>|<source>/</source>|g' "Cobertura.xml"
sed -i "s|${workDir}||g" "Cobertura.xml"
else
sed -i '' 's|<source>[^<]+</source>|<source>/</source>|g' "Cobertura.xml"
sed -i '' "s|${workDir}||g" "Cobertura.xml"
fi
displayName: make Cobertura-paths relative
# shortcut for PublishPipelineArtifact
# Coverage report will be created later in a different stage
- publish: tests/Coverage/Cobertura.xml
artifact: 'Coverage-${{ parameters.name }}-$(BUILD_CONFIG)'

./build.sh pack
- bash: ./build.sh pack
displayName: pack
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'), eq(variables['BUILD_CONFIG'], 'Release'))

- task: PublishTestResults@2
inputs:
testRunner: VSTest
testResultsFiles: '**/*.trx'

- task: PublishBuildArtifacts@1
- publish: 'NuGet-Packed'
artifact: 'NuGet-Packed'
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'), eq(variables['BUILD_CONFIG'], 'Release'), ne(variables['Build.Reason'], 'PullRequest'))
inputs:
pathtoPublish: 'NuGet-Packed'
artifactName: 'NuGet-Packed'
64 changes: 33 additions & 31 deletions .azure/pipelines/jobs/build_and_test_intrinsics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,20 @@ jobs:

- bash: |
export PATH="$(pwd)/dotnet:$PATH"
echo 'installed sdks:'
dotnet --list-sdks
echo "-------------------------------------------------"
echo 'environment variables:'
env | sort
chmod u+x ./build.sh
./build.sh build
displayName: init
- bash: ./build.sh build
displayName: build

- bash: |
export PATH="$(pwd)/dotnet:$PATH"
echo 'installed sdks:'
dotnet --list-sdks
echo "-------------------------------------------------"
if [[ "$COMPLUS_ENABLEAVX" == "0" ]]; then
export COMPlus_EnableAVX=0
fi
Expand All @@ -45,33 +45,35 @@ jobs:
export COMPlus_EnableSSE=0
fi
./build.sh test
./build.sh test-coverage
displayName: test
- bash: |
export PATH="$(pwd)/dotnet:$PATH"
echo 'installed sdks:'
dotnet --list-sdks
echo "-------------------------------------------------"
dotnet tool install -g coverlet.console
# Workaround
# https://github.com/Microsoft/azure-pipelines-tasks/issues/8291#issuecomment-441707116
export PATH="$PATH:$HOME/.dotnet/tools"
if [[ "$COMPLUS_ENABLEAVX" == "0" ]]; then
export COMPlus_EnableAVX=0
fi
if [[ "$COMPLUS_ENABLESSE" == "0" ]]; then
export COMPlus_EnableSSE=0
fi
./build.sh coverage
displayName: code coverage
condition: and(succeeded(), variables['CODECOV_TOKEN'], ne(variables['Agent.OS'], 'Darwin'))
- task: PublishTestResults@2
condition: always()
inputs:
testRunner: VSTest
testResultsFiles: '**/*.trx'

- bash: |
cd tests/Coverage
workDir="$(System.DefaultWorkingDirectory)"
if [[ "$AGENT_OS" == "Windows_NT" ]]; then
# Windows needs special treetment for the substitution due the \
workDir="${workDir//\\/\\\\}\\\\"
else
workDir+="/"
fi
# Mac has a different sed, so special case it (hooray for standars ;-))
if [[ "$AGENT_OS" != "Darwin" ]]; then
sed -i 's|<source>[^<]*</source>|<source>/</source>|g' "Cobertura.xml"
sed -i "s|${workDir}||g" "Cobertura.xml"
else
sed -i '' 's|<source>[^<]+</source>|<source>/</source>|g' "Cobertura.xml"
sed -i '' "s|${workDir}||g" "Cobertura.xml"
fi
displayName: make Cobertura-paths relative
# shortcut for PublishPipelineArtifact
# Coverage report will be created later in a different stage
- publish: tests/Coverage/Cobertura.xml
artifact: 'Coverage-${{ parameters.name }}-AVX_$(COMPLUS_ENABLEAVX)'
28 changes: 28 additions & 0 deletions .azure/pipelines/jobs/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
jobs:
- job: coverage_report_quality
pool:
vmImage: 'ubuntu-18.04'
steps:
# checkout is needed for file-references
#- checkout: none

- task: DownloadPipelineArtifact@2
inputs:
targetPath: './coverage'

- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: 'coverage/**/Cobertura.xml'
pathToSources: $(System.DefaultWorkingDirectory)

# extension from Marketplace https://marketplace.visualstudio.com/acquisition?itemName=mspremier.BuildQualityChecks
- task: BuildQualityChecks@6
displayName: 'Check build quality'
inputs:
checkCoverage: true
coverageFailOption: 'build'
coverageType: 'lines'
allowCoverageVariance: true
coverageVariance: '0.5'
baseBranchRef: 'master'
67 changes: 35 additions & 32 deletions .azure/pipelines/jobs/deploy_nuget.yml
Original file line number Diff line number Diff line change
@@ -1,63 +1,66 @@
jobs:
- job: deploy_nuget
pool:
vmImage: 'windows-2019'
vmImage: 'ubuntu-18.04'
steps:
- task: DownloadBuildArtifacts@0
- checkout: none

- task: DownloadPipelineArtifact@2
inputs:
buildType: current
artifactName: 'NuGet-Packed'
downloadPath: .
targetPath: './'

# Hack for file not found when using ./build.sh deploy
# With ls -la the files are listed, but can't be found anyway.
# I tried quite a lot, relative and absolute path, nothing worked.
# This hack does the job.
- bash: |
chmod u+x ./build.sh
echo "-------------------------------------------------"
echo "Nuget-Packed:"
ls -la "NuGet-Packed"
echo "NuGet-Packed:"
ls -la .
if [[ "$TAG_NAME" =~ ^v([0-9]+)\.([0-9]+)\.([0-9]+)(-(preview-[0-9]+))$ ]]; then
mkdir deploy_myget
for package in NuGet-Packed/*.nupkg; do
mv $package deploy_myget
done
mkdir deploy_custom
for package in ./*.nupkg; do
mv $package deploy_custom
done
echo "##vso[task.setvariable variable=deploy_custom;]1"
elif [[ "$TAG_NAME" =~ ^v([0-9]+)\.([0-9]+)\.([0-9]+)$ ]]; then
mkdir deploy_nuget
mkdir deploy_nuget
for package in ./*.nupkg; do
mv $package deploy_nuget
done
for package in NuGet-Packed/*.nupkg; do
mv $package deploy_nuget
done
echo "##vso[task.setvariable variable=deploy_nuget;]1"
else
echo "no deploy, as $TAG_NAME does not match"
echo ##vso[task.complete result=Skipped;]tag does not match for deploy
echo "no deploy, as $TAG_NAME does not match"
echo ##vso[task.complete result=Skipped;]tag does not match for deploy
fi
echo "-------------------------------------------------"
echo "myget:"
ls -la deploy_myget
echo "custom:"
ls -la deploy_custom
echo "-------------------------------------------------"
echo "nuget:"
ls -la deploy_nuget
echo "-------------------------------------------------"
displayName: 'deploy to myget / nuget'
displayName: 'deploy to nuget / custom'
- task: NuGetAuthenticate@0
condition: eq(variables['deploy_custom'], '1')

- task: NuGetCommand@2
condition: eq(variables['deploy_custom'], '1')
inputs:
command: push
packagesToPush: deploy_myget/*.nupkg
nuGetFeedType: external
publishFeedCredentials: 'myget - gfoidl'
displayName: deploy_myget
packagesToPush: deploy_custom/*.nupkg
nuGetFeedType: 'internal'
publishVstsFeed: 'github-Projects/gfoidl-public'
displayName: deploy to custom feed

- task: NuGetCommand@2
condition: eq(variables['deploy_nuget'], '1')
inputs:
command: push
packagesToPush: deploy_nuget/*.nupkg
nuGetFeedType: external
publishFeedCredentials: 'nuget - gfoidl'
displayName: deploy_nuget
displayName: deploy to nuget
Loading

0 comments on commit 436b0bf

Please sign in to comment.