From 85f4d61ff0a33343a1f6679f8f9ed036f26e1aa7 Mon Sep 17 00:00:00 2001 From: Harrison Deng Date: Thu, 1 Dec 2022 04:48:54 +0000 Subject: [PATCH] Update Jenkinsfile and added Conda environment. --- Jenkinsfile | 29 +++++++++++++++++------------ environment.yml | 6 ++++++ 2 files changed, 23 insertions(+), 12 deletions(-) create mode 100644 environment.yml diff --git a/Jenkinsfile b/Jenkinsfile index 6d098fa..157bcf2 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,31 +1,31 @@ pipeline { agent any stages { - stage("cleanup") { + stage("Install") { steps { - pwsh ''' - rm **/bin/Release - rm output/** - ''' + sh 'mamba env update --file environment.yml' + sh 'echo "mamba activate props" >> ~/.bashrc' + sh 'node --version && npm --version' + sh 'npm install' } } stage("Props.Shop") { stages { stage("Restore") { steps { - dotnetRestore project: "Props.Shop/Props.Shop.sln" - dotnetRestore project: "Props.Shop/Props.Shop.Tests.sln" + sh 'dotnet restore Props.Shop/Props.Shop.sln' + sh 'dotnet restore Props.Shop/Props.Shop.Tests.sln' } } stage("Test") { steps { - dotnetTest logger: 'xunit', noRestore: true, project: 'Props.Shop/Props.Shop.Tests.sln', unstableIfErrors: true, unstableIfWarnings: true + sh 'dotnet test --logger xunit --no-restore Props.Shop/Props.Shop.Tests.sln' xunit([xUnitDotNet(excludesPattern: '', pattern: 'Props.Shop/*.Tests/TestResults/*.xml', stopProcessingIfError: true)]) } } stage("Publish") { steps { - dotnetPublish configuration: 'Release', outputDirectory: 'output/shop-modules', noRestore: true, project: 'Props.Shop/Props.Shop.sln', selfContained: false, unstableIfWarnings: true + sh 'dotnet publish --configuration Release --output output/shop-modules Props.Shop/Props.Shop.sln' fingerprint 'output/shop-modules/**/Props.Shop.*' sh "python3 scripts/load_shop_modules.py" } @@ -34,16 +34,21 @@ pipeline { } stage("Props") { stages { + stage("Restore") { + steps { + sh 'dotnet restore Props.Tests' + } + } stage("Test") { steps { - dotnetTest logger: 'xunit', project: 'Props.Tests', unstableIfErrors: true, unstableIfWarnings: true + sh 'dotnet test --logger xunit --no-restore Props.Tests' xunit([xUnitDotNet(excludesPattern: '', pattern: 'Props.Tests/TestResults/*.xml', stopProcessingIfError: true)]) } } stage("Publish") { steps { - dotnetPublish configuration: 'Release', outputDirectory: 'output/props/props-linux-x64', project: 'Props', runtime: 'linux-x64', selfContained: true - dotnetPublish configuration: 'Release', outputDirectory: 'output/props/props-win-x64', project: 'Props', runtime: 'win-x64', selfContained: true + sh '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' fingerprint 'output/props/**/Props*' 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" diff --git a/environment.yml b/environment.yml new file mode 100644 index 0000000..1371b4b --- /dev/null +++ b/environment.yml @@ -0,0 +1,6 @@ +name: props +channels: + - javascript +dependencies: + - dotnet-sdk=6.0.* + - dotnet-runtime=6.0.* \ No newline at end of file