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,46 +1,87 @@
image: image:
- Visual Studio 2017 #- Visual Studio 2017
- Ubuntu1804 - Ubuntu1804
environment:
APPVEYOR_YML_DISABLE_PS_LINUX: true
services: services:
- docker - docker
stack: node 10 stack: node 10
init: init:
- ps: Install-Product node 10 - ps: |
if($isWindows) {
Install-Product node 10
}
install: install:
- sh: npm i -g gulp - ps: |
- ps: choco install cloc --no-progress $env:PROD_DEPLOY = "false"
- ps: "cloc --include-lang C#,SQL,Razor,\"Bourne Shell\",PowerShell,HTML,CSS,Sass,JavaScript,TypeScript --vcs git" $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: before_build:
#- sh: dotnet restore - sh: |
- ps: msbuild /t:restore 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: build_script:
- sh: chmod +x ./build-ci.sh - sh: chmod +x ./build.sh
- sh: ./build-ci.sh
- ps: | - ps: |
msbuild bitwarden-server.sln /p:Configuration=Debug /verbosity:minimal ` 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" /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
- ps: |
$env:swaggerGen="true" $env:swaggerGen="true"
$env:ASPNETCORE_ENVIRONMENT="Production" $env:ASPNETCORE_ENVIRONMENT="Production"
cd .\src\Api; dotnet swagger tofile --output ..\..\swagger.json --host api.bitwarden.com --format Indented ` cd .\src\Api; dotnet swagger tofile --output ..\..\swagger.json --host api.bitwarden.com --format Indented `
.\bin\Debug\netcoreapp2.1\Api.dll public .\bin\Debug\netcoreapp2.1\Api.dll public
cd ..\.. cd ..\..
$env:ASPNETCORE_ENVIRONMENT="" $env:ASPNETCORE_ENVIRONMENT=""
$env:swaggerGen="" $env:swaggerGen=""
Push-AppveyorArtifact .\swagger.json Push-AppveyorArtifact .\swagger.json
}
after_build: after_build:
- sh: docker logout - sh: docker logout
test_script: test_script:
#- sh: dotnet test .\test\Core.Test\Core.Test.csproj --configuration Debug --no-build - ps: |
- ps: dotnet test .\test\Core.Test\Core.Test.csproj --configuration Debug --no-build 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 .editorconfig = .editorconfig
.gitignore = .gitignore .gitignore = .gitignore
appveyor.yml = appveyor.yml appveyor.yml = appveyor.yml
build-ci.sh = build-ci.sh
build.sh = build.sh build.sh = build.sh
LICENSE.txt = LICENSE.txt LICENSE.txt = LICENSE.txt
NuGet.Config = NuGet.Config NuGet.Config = NuGet.Config

View File

@ -1,43 +1,2 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -e 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