Selecting conda container for all build steps.
Some checks failed
ydeng/props/pipeline/head There was a failure building this commit

This commit is contained in:
Harrison Deng 2024-07-19 06:20:02 +00:00
parent d332dbaacd
commit d3f9791f68
2 changed files with 18 additions and 39 deletions

55
Jenkinsfile vendored
View File

@ -1,50 +1,33 @@
pipeline { pipeline {
agent any agent {
kubernetes {
defaultContainer 'conda'
}
}
stages { stages {
stage("Install") { stage("Install") {
steps { steps {
sh '''#!/bin/bash sh 'conda env update -n base --file environment.yml'
# Installing .NET environment sh 'dotnet restore Props/Props.csproj'
# According to https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-install-script#examples sh 'dotnet restore Props.Tests/Props.Tests.csproj'
# and https://learn.microsoft.com/en-us/dotnet/core/install/linux-scripted-manual#scripted-install sh 'dotnet restore Props.Shop/Props.Shop.sln'
curl -L -o- https://dot.net/v1/dotnet-install.sh | bash -s -- --channel 8.0 sh 'npm install --prefix ./Props'
echo export DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1 >> ~/.bashrc
echo 'export DOTNET_ROOT=$HOME/.dotnet' >> ~/.bashrc
echo 'export PATH=$PATH:$DOTNET_ROOT:$DOTNET_ROOT/tools' >> ~/.bashrc
# Installing Node Version Manager
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
'''
sh '''#!/bin/bash
nvm install 20.15.1
nvm use default
# Restore all projects
dotnet restore Props/Props.csproj
dotnet restore Props.Tests/Props.Tests.csproj
dotnet restore Props.Shop/Props.Shop.sln
npm install --prefix ./Props
'''
} }
} }
stage("Props.Shop") { stage("Props.Shop") {
stages { stages {
stage("Test") { stage("Test") {
steps { steps {
sh '''#!/bin/bash sh 'dotnet test --logger xunit --no-restore Props.Shop/Adafruit.Tests/Props.Shop.Adafruit.Tests.csproj'
dotnet test --logger xunit --no-restore Props.Shop/Adafruit.Tests/Props.Shop.Adafruit.Tests.csproj
'''
xunit([xUnitDotNet(excludesPattern: '', pattern: 'Props.Shop/*.Tests/TestResults/*.xml', stopProcessingIfError: true)]) xunit([xUnitDotNet(excludesPattern: '', pattern: 'Props.Shop/*.Tests/TestResults/*.xml', stopProcessingIfError: true)])
} }
} }
stage("Publish") { stage("Publish") {
steps { steps {
sh '''#!/bin/bash sh 'dotnet publish --configuration Release --output output/shop-modules Props.Shop/Props.Shop.sln'
dotnet publish --configuration Release --output output/shop-modules Props.Shop/Props.Shop.sln
'''
fingerprint 'output/shop-modules/**/Props.Shop.*' fingerprint 'output/shop-modules/**/Props.Shop.*'
sh '''#!/bin/bash sh 'cp ./Props.Shop/output/shop-modules/**/*.dll ./Props.Shop/output/shop-modules/**/*.deps.json ./Props/shops/.'
cp ./Props.Shop/output/shop-modules/**/*.dll ./Props.Shop/output/shop-modules/**/*.deps.json ./Props/shops/.
'''
} }
} }
} }
@ -53,18 +36,14 @@ pipeline {
stages { stages {
stage("Test") { stage("Test") {
steps { steps {
sh '''#!/bin/bash sh 'dotnet test --logger xunit --no-restore Props.Tests'
dotnet test --logger xunit --no-restore Props.Tests
'''
xunit([xUnitDotNet(excludesPattern: '', pattern: 'Props.Tests/TestResults/*.xml', stopProcessingIfError: true)]) xunit([xUnitDotNet(excludesPattern: '', pattern: 'Props.Tests/TestResults/*.xml', stopProcessingIfError: true)])
} }
} }
stage("Publish") { stage("Publish") {
steps { steps {
sh '''#!/bin/bash sh 'dotnet publish --configuration Release --output output/props/props-linux-x64 --runtime linux-x64 --self-contained Props'
dotnet publish --configuration Release --output output/props/props-linux-x64 --runtime linux-x64 --self-contained Props sh 'dotnet publish --configuration Release --output output/props/props-win-x64 --runtime win-x64 --self-contained Props'
dotnet publish --configuration Release --output output/props/props-win-x64 --runtime win-x64 --self-contained Props
'''
fingerprint 'output/props/**/Props*' fingerprint 'output/props/**/Props*'
tar file: "output/props-linux-x64.tar.gz", archive: true, compress: true, dir: "output/props/props-linux-x64" tar file: "output/props-linux-x64.tar.gz", archive: true, compress: true, dir: "output/props/props-linux-x64"
zip zipFile: "output/props-win-x64.zip", archive: true, dir: "output/props/props-win-x64" zip zipFile: "output/props-win-x64.zip", archive: true, dir: "output/props/props-win-x64"

View File

@ -2,5 +2,5 @@ name: props
channels: channels:
- conda-forge - conda-forge
dependencies: dependencies:
- dotnet-sdk=7.0.* - dotnet-sdk=8.0.*
- nodejs=18.12.* - nodejs=18.12.*