1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-21 12:05:42 +01:00

move to powershell for appveyor

This commit is contained in:
Kyle Spearrin 2019-03-13 10:17:24 -04:00
parent e6ee23fbe8
commit d6e7040aba
3 changed files with 64 additions and 65 deletions

View File

@ -1,34 +1,72 @@
image:
- Visual Studio 2017
#- Visual Studio 2017
- Ubuntu1804
environment:
APPVEYOR_YML_DISABLE_PS_LINUX: true
services:
- docker
stack: node 10
init:
- ps: Install-Product node 10
- ps: |
if($isWindows) {
Install-Product node 10
}
install:
- sh: npm i -g gulp
- ps: choco install cloc --no-progress
- ps: "cloc --include-lang C#,SQL,Razor,\"Bourne Shell\",PowerShell,HTML,CSS,Sass,JavaScript,TypeScript --vcs git"
- ps: |
$env:PROD_DEPLOY = "false"
$env:TAG_NAME = ""
if($env:APPVEYOR_REPO_TAG -eq "true" -and $env:APPVEYOR_RE_BUILD -eq "True") {
$env:PROD_DEPLOY = "true"
$env:TAG_NAME = $env:APPVEYOR_REPO_TAG_NAME.TrimStart("v")
echo "This is a production deployment for ${env:TAG_NAME}."
}
if($isLinux) {
npm i -g gulp
} else {
choco install cloc --no-progress
cloc --include-lang C#,SQL,Razor,"Bourne Shell",PowerShell,HTML,CSS,Sass,JavaScript,TypeScript --vcs git
}
before_build:
#- sh: dotnet restore
- ps: msbuild /t:restore
- sh: |
if [ "${DOCKER_USERNAME}" != "" -a "${DOCKER_PASSWORD}" != "" ]
then
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
fi
- ps: |
if($isLinux) {
#dotnet restore
} else {
msbuild /t:restore
}
build_script:
- sh: chmod +x ./build-ci.sh
- sh: ./build-ci.sh
- sh: chmod +x ./build.sh
- ps: |
if($isLinux) {
#dotnet build --configuration Debug
./build.sh
./build.sh tag dev
if($env:PROD_DEPLOY -eq "true") {
./build.sh tag beta
./build.sh tag ${TAG_NAME}
}
docker images
./build.sh push dev
if($env:PROD_DEPLOY -eq "true") {
./build.sh push beta
./build.sh push latest
./build.sh push ${TAG_NAME}
}
} else {
msbuild bitwarden-server.sln /p:Configuration=Debug /verbosity:minimal `
/logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
- ps: |
$env:swaggerGen="true"
$env:ASPNETCORE_ENVIRONMENT="Production"
cd .\src\Api; dotnet swagger tofile --output ..\..\swagger.json --host api.bitwarden.com --format Indented `
@ -37,10 +75,13 @@ build_script:
$env:ASPNETCORE_ENVIRONMENT=""
$env:swaggerGen=""
Push-AppveyorArtifact .\swagger.json
}
after_build:
- sh: docker logout
test_script:
#- sh: dotnet test .\test\Core.Test\Core.Test.csproj --configuration Debug --no-build
- ps: dotnet test .\test\Core.Test\Core.Test.csproj --configuration Debug --no-build
- ps: |
if($isWindows) {
dotnet test .\test\Core.Test\Core.Test.csproj --configuration Debug --no-build
}

View File

@ -14,7 +14,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
.editorconfig = .editorconfig
.gitignore = .gitignore
appveyor.yml = appveyor.yml
build-ci.sh = build-ci.sh
build.sh = build.sh
LICENSE.txt = LICENSE.txt
NuGet.Config = NuGet.Config

View File

@ -1,43 +1,2 @@
#!/usr/bin/env bash
set -e
echo "Repo tag name: ${APPVEYOR_REPO_TAG_NAME}"
echo "Rebuild: ${APPVEYOR_RE_BUILD}"
PROD_DEPLOY=false
TAG_NAME=""
if [ "${APPVEYOR_REPO_TAG_NAME}" != "" -a "${APPVEYOR_RE_BUILD}" == "True" ]
then
PROD_DEPLOY=true
TAG_NAME=${APPVEYOR_REPO_TAG_NAME#"v"}
fi
echo "Prod deploy: ${PROD_DEPLOY}"
echo "Tag name: ${TAG_NAME}"
#dotnet build --configuration Debug
if [ "${DOCKER_USERNAME}" != "" -a "${DOCKER_PASSWORD}" != "" ]
then
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
fi
chmod +x ./build.sh
./build.sh
./build.sh tag dev
if [ "${PROD_DEPLOY}" == "true" ]
then
./build.sh tag beta
./build.sh tag $TAG_NAME
fi
docker images
./build.sh push dev
if [ "${PROD_DEPLOY}" == "true" ]
then
./build.sh push beta
./build.sh push latest
./build.sh push $TAG_NAME
fi