2019-03-08 05:21:58 +01:00
|
|
|
image:
|
2019-03-15 15:28:46 +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-15 15:28:46 +01:00
|
|
|
- sh: ls -lS
|
2019-03-13 15:17:24 +01:00
|
|
|
- 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
|
|
|
|
}
|
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: |
|
|
|
|
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
|
|
|
|
}
|
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
|
|
|
|
./build.sh push dev
|
|
|
|
|
|
|
|
if($env:PROD_DEPLOY -eq "true") {
|
|
|
|
./build.sh push beta
|
|
|
|
./build.sh push latest
|
2019-03-13 15:18:37 +01:00
|
|
|
./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:28:46 +01:00
|
|
|
sudo chown -R appveyor:appveyor /docker-stub
|
2019-03-15 15:00:33 +01:00
|
|
|
rm -rf $STUB_OUTPUT/ca-certificates
|
|
|
|
rm -rf $STUB_OUTPUT/identity
|
|
|
|
rm -rf $STUB_OUTPUT/letsencrypt
|
|
|
|
rm -rf $STUB_OUTPUT/ssl
|
|
|
|
rm $STUB_OUTPUT/env/uid.env
|
2019-03-15 15:12:39 +01:00
|
|
|
cd docker-stub
|
|
|
|
zip -r ../docker-stub.zip *
|
|
|
|
cd ..
|
|
|
|
- ps: 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:
|
|
|
|
- sh: docker logout
|
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'))
|
|
|
|
}
|