1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-25 12:45:18 +01:00
bitwarden-server/appveyor.yml

135 lines
3.5 KiB
YAML
Raw Normal View History

2019-03-08 05:21:58 +01:00
image:
2019-03-15 16:10:18 +01:00
- Visual Studio 2017
2019-03-08 05:21:58 +01:00
- Ubuntu1804
2019-03-08 20:16:44 +01:00
2019-03-08 05:21:58 +01:00
services:
- docker
2019-03-08 20:16:44 +01:00
2019-03-08 05:46:06 +01:00
stack: node 10
2019-03-08 20:16:44 +01:00
2019-03-12 17:36:32 +01:00
init:
2019-03-15 06:02:18 +01:00
- ps: |
if($isWindows -and $env:DEBUG_RDP -eq "true") {
iex ((new-object net.webclient).DownloadString(`
'https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
}
2019-03-13 15:17:24 +01:00
- ps: |
if($isWindows) {
Install-Product node 10
}
2019-03-12 17:36:32 +01:00
2019-03-08 05:37:34 +01:00
install:
2019-03-13 15:17:24 +01:00
- ps: |
2019-03-18 17:21:51 +01:00
$env:PUSH_DOCKER = "false"
2019-03-13 15:17:24 +01:00
$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}."
}
2019-03-20 03:06:02 +01:00
if("${env:DOCKER_USERNAME}" -ne "" -and "${env:DOCKER_PASSWORD}" -ne "") {
2019-03-20 03:05:00 +01:00
$env:PUSH_DOCKER = "true"
}
2019-03-13 15:17:24 +01:00
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
}
2019-03-08 20:16:44 +01:00
2019-03-08 06:14:38 +01:00
before_build:
2019-03-13 15:17:24 +01:00
- sh: |
2019-03-20 03:05:00 +01:00
if [ "${PUSH_DOCKER}" == "true" ]
2019-03-13 15:17:24 +01:00
then
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
fi
- ps: |
if($isLinux) {
#dotnet restore
} else {
msbuild /t:restore
}
2019-03-08 20:16:44 +01:00
2019-03-08 05:21:58 +01:00
build_script:
2019-03-13 15:17:24 +01:00
- sh: chmod +x ./build.sh
2019-03-11 03:35:41 +01:00
- ps: |
2019-03-13 15:17:24 +01:00
if($isLinux) {
#dotnet build --configuration Debug
./build.sh
./build.sh tag dev
if($env:PROD_DEPLOY -eq "true") {
./build.sh tag beta
2019-03-13 15:18:37 +01:00
./build.sh tag $env:TAG_NAME
2019-03-13 15:17:24 +01:00
}
docker images
2019-03-18 17:21:51 +01:00
if($env:PUSH_DOCKER -eq "true") {
./build.sh push dev
if($env:PROD_DEPLOY -eq "true") {
./build.sh push beta
./build.sh push latest
./build.sh push $env:TAG_NAME
}
2019-03-13 15:17:24 +01:00
}
} else {
msbuild bitwarden-server.sln /p:Configuration=Debug /verbosity:minimal `
2019-03-11 03:21:57 +01:00
/logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
2019-03-13 15:32:00 +01:00
2019-03-13 15:30:41 +01:00
$env:swaggerGen = "true"
$env:ASPNETCORE_ENVIRONMENT = "Production"
cd .\src\Api
dotnet swagger tofile --output ..\..\swagger.json --host api.bitwarden.com --format Indented `
2019-03-11 03:21:57 +01:00
.\bin\Debug\netcoreapp2.1\Api.dll public
2019-03-13 15:17:24 +01:00
cd ..\..
2019-03-13 15:30:41 +01:00
$env:ASPNETCORE_ENVIRONMENT = ""
$env:swaggerGen = ""
2019-03-13 15:17:24 +01:00
Push-AppveyorArtifact .\swagger.json
}
2019-03-15 14:35:40 +01:00
- sh: |
2019-03-15 14:33:49 +01:00
echo "Make docker stubs"
2019-03-15 15:00:33 +01:00
STUB_OUTPUT=$(pwd)/docker-stub
2019-03-15 15:06:45 +01:00
docker run -i --rm --name setup -v $STUB_OUTPUT:/bitwarden bitwarden/setup:dev \
2019-03-15 15:00:33 +01:00
dotnet Setup.dll -stub 1 -install 1 -domain bitwarden.company.com -os lin
2019-03-15 15:33:06 +01:00
sudo chown -R appveyor:appveyor $STUB_OUTPUT
2019-03-15 15:38:50 +01:00
rm -rf $STUB_OUTPUT/ca-certificates $STUB_OUTPUT/identity $STUB_OUTPUT/letsencrypt $STUB_OUTPUT/ssl
2019-03-15 15:00:33 +01:00
rm $STUB_OUTPUT/env/uid.env
2019-03-15 15:38:50 +01:00
cd docker-stub; zip -r ../docker-stub.zip *; cd ..
2019-03-20 03:05:00 +01:00
- ps: |
if($isLinux) {
Push-AppveyorArtifact ./docker-stub.zip
}
2019-03-15 14:33:49 +01:00
2019-03-08 20:16:44 +01:00
2019-03-08 14:55:19 +01:00
after_build:
2019-03-18 17:21:51 +01:00
- sh: |
if [ "${PUSH_DOCKER}" == "true" ]
then
docker logout
fi
2019-03-08 20:16:44 +01:00
2019-03-08 06:34:51 +01:00
test_script:
2019-03-13 15:17:24 +01:00
- ps: |
if($isWindows) {
dotnet test .\test\Core.Test\Core.Test.csproj --configuration Debug --no-build
}
2019-03-15 06:02:18 +01:00
on_finish:
- ps: |
if($isWindows -and $env:DEBUG_RDP -eq "true") {
$blockRdp = $true
iex ((new-object net.webclient).DownloadString(`
'https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
}
2019-03-15 15:53:24 +01:00
deploy:
provider: GitHub
auth_token: $(GH_TOKEN)
artifact: /.*/
force_update: true
on:
branch: master
PROD_DEPLOY: true