props/Jenkinsfile

82 lines
3.8 KiB
Plaintext
Raw Normal View History

pipeline {
2024-07-17 21:45:16 +00:00
agent any
stages {
stage("Install") {
2022-04-25 08:56:41 +00:00
steps {
2024-07-17 21:43:46 +00:00
sh '''#!/bin/bash
# Installing .NET environment
# According to https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-install-script#examples
# and https://learn.microsoft.com/en-us/dotnet/core/install/linux-scripted-manual#scripted-install
curl -L -o- https://dot.net/v1/dotnet-install.sh | bash -s -- --channel 8.0
echo \'export DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1\' >> ~/.profile
2024-07-17 21:43:46 +00:00
echo \'export DOTNET_ROOT=$HOME/.dotnet\' >> ~/.profile
echo \'export PATH=$PATH:$DOTNET_ROOT:$DOTNET_ROOT/tools\' >> ~/.profile
# Installing Node Version Manager
# According to https://github.com/nvm-sh/nvm?tab=readme-ov-file#installing-and-updating
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
'''
sh '''#!/bin/bash
source ~/.profile
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
'''
2022-04-25 08:56:41 +00:00
}
}
stage("Props.Shop") {
stages {
stage("Test") {
steps {
2024-07-17 21:43:46 +00:00
sh '''#!/bin/bash
source ~/.profile
2024-07-17 21:43:46 +00:00
dotnet test --logger xunit --no-restore Props.Shop/Props.Shop.sln
'''
2022-04-25 07:44:05 +00:00
xunit([xUnitDotNet(excludesPattern: '', pattern: 'Props.Shop/*.Tests/TestResults/*.xml', stopProcessingIfError: true)])
}
}
stage("Publish") {
steps {
2024-07-17 21:43:46 +00:00
sh '''#!/bin/bash
source ~/.profile
2024-07-17 21:43:46 +00:00
dotnet publish --configuration Release --output output/shop-modules Props.Shop/Props.Shop.sln
'''
fingerprint 'output/shop-modules/**/Props.Shop.*'
2024-07-18 02:58:13 +00:00
sh '''#!/bin/bash
source ~/.profile
2024-07-18 02:58:13 +00:00
cp ./Props.Shop/output/shop-modules/**/*.dll ./Props.Shop/output/shop-modules/**/*.deps.json ./Props/shops/.
'''
}
}
}
}
stage("Props") {
stages {
stage("Test") {
steps {
2024-07-17 21:43:46 +00:00
sh '''#!/bin/bash
source ~/.profile
2024-07-17 21:43:46 +00:00
dotnet test --logger xunit --no-restore Props.Tests
'''
2022-04-25 07:44:05 +00:00
xunit([xUnitDotNet(excludesPattern: '', pattern: 'Props.Tests/TestResults/*.xml', stopProcessingIfError: true)])
}
}
stage("Publish") {
steps {
2024-07-17 21:43:46 +00:00
sh '''#!/bin/bash
source ~/.profile
2024-07-17 21:43:46 +00:00
dotnet publish --configuration Release --output output/props/props-linux-x64 --runtime linux-x64 --self-contained Props
dotnet publish --configuration Release --output output/props/props-win-x64 --runtime win-x64 --self-contained Props
'''
fingerprint 'output/props/**/Props*'
2022-04-26 08:48:05 +00:00
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"
}
}
}
}
}
}