From 10d6ace700073efcb7ac62ed7476d08b5229e704 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Fri, 8 Mar 2019 14:16:44 -0500 Subject: [PATCH] build-ci script --- appveyor.yml | 22 +++++++++++----------- bitwarden-server.sln | 1 + build-ci.sh | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 48 insertions(+), 11 deletions(-) create mode 100644 build-ci.sh diff --git a/appveyor.yml b/appveyor.yml index 9a0f2c58f..762c4f697 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,33 +1,33 @@ image: -- Visual Studio 2017 +#- Visual Studio 2017 - Ubuntu1804 + environment: APPVEYOR_YML_DISABLE_PS_LINUX: true + services: - docker + stack: node 10 + install: - sh: npm i -g gulp - sh: echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin - cmd: choco install cloc --no-progress - cmd: "cloc --include-lang C#,SQL,Razor,\"Bourne Shell\",PowerShell,HTML,CSS,Sass,JavaScript,TypeScript --vcs git" + before_build: #- sh: dotnet restore - cmd: msbuild /t:restore + build_script: -#- dotnet build --configuration Debug -- sh: chmod +x ./build.sh -- sh: ./build.sh -- sh: ./build.sh tag dev -- sh: '[[ "${APPVEYOR_REPO_TAG_NAME}" != "" ]] && echo "TAG IS SET"' -- sh: '[[ $APPVEYOR_FORCED_BUILD ]] && echo "FORCED BUILD"' -#- sh: '[[ "${APPVEYOR_REPO_TAG_NAME}" != "" && $APPVEYOR_FORCED_BUILD ]] && ./build.sh tag ${APPVEYOR_REPO_TAG_NAME#"v"}' -- sh: docker images -- sh: ./build.sh push dev -#- sh: '[[ "${APPVEYOR_REPO_TAG_NAME}" != "" && $APPVEYOR_FORCED_BUILD ]] && ./build.sh push latest && ./build.sh push ${APPVEYOR_REPO_TAG_NAME#"v"}' +- sh: chmod +x ./build-ci.sh +- sh: ./build-ci.sh - cmd: msbuild bitwarden-server.sln /p:Configuration=Debug /verbosity:minimal /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" + after_build: - sh: docker logout + test_script: #- sh: dotnet test .\test\Core.Test\Core.Test.csproj --configuration Debug --no-build - cmd: dotnet test .\test\Core.Test\Core.Test.csproj --configuration Debug --no-build diff --git a/bitwarden-server.sln b/bitwarden-server.sln index 15d70fe8a..08e376d6c 100644 --- a/bitwarden-server.sln +++ b/bitwarden-server.sln @@ -14,6 +14,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution .editorconfig = .editorconfig .gitignore = .gitignore appveyor.yml = appveyor.yml + build-ci.sh = build-ci.sh build.ps1 = build.ps1 build.sh = build.sh LICENSE.txt = LICENSE.txt diff --git a/build-ci.sh b/build-ci.sh new file mode 100644 index 000000000..a257ac23e --- /dev/null +++ b/build-ci.sh @@ -0,0 +1,36 @@ +#!/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 + +chmod +x ./build.sh + +#dotnet build --configuration Debug + +./build.sh +./build.sh tag dev + +if [ $PROD_DEPLOY ] +then + ./build.sh tag beta + ./build.sh tag $TAG_NAME +fi + +docker images +./build.sh push dev + +if [ $PROD_DEPLOY ] +then + ./build.sh push beta + ./build.sh push latest + ./build.sh push $TAG_NAME +fi