Add qa container (#1028)

* adding an almost duplicate job to build qa

* adding ~/.npm cache and testing the qa build

* switching the AZ creds to the QA ones for the QA workflow

* fixing initial qa container name

* removing the cache since the self hosted instance needs the  instead of the ci

* fixing the testing code

* removing the testing code and renaming some of the jobs
This commit is contained in:
Joseph Flinn 2021-06-14 12:20:49 -07:00 committed by GitHub
parent 6d54740aaf
commit c3f128182c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 102 additions and 3 deletions

View File

@ -1,4 +1,4 @@
name: build
name: Build
on:
push:
@ -8,6 +8,7 @@ on:
jobs:
cloc:
name: CLOC
runs-on: ubuntu-latest
steps:
- name: Checkout repo
@ -21,7 +22,9 @@ jobs:
- name: Print lines of code
run: cloc --include-lang TypeScript,JavaScript,HTML,Sass,CSS --vcs git
ubuntu:
build-selfhost:
name: Build SelfHost Docker image
runs-on: ubuntu-latest
steps:
- name: Set up Node
@ -33,6 +36,13 @@ jobs:
run: |
npm install -g npm@7
- name: Cache npm
id: npm-cache
uses: actions/cache@c64c572235d810460d0d6876e9c705ad5002b353 # v2.1.6
with:
path: '~/.npm'
key: ${{ runner.os }}-${{ github.run_id }}-npm-${{ hashFiles('**/package-lock.json') }}
- name: Print environment
run: |
whoami
@ -83,12 +93,14 @@ jobs:
- name: Restore
run: dotnet tool restore
- name: Install dependencies
run: npm install
- name: Build
run: |
echo -e "# Building Web\n"
echo "Building app"
echo "npm version $(npm --version)"
npm install
npm run dist:selfhost
echo -e "\nBuilding Docker image"
@ -125,7 +137,94 @@ jobs:
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/rc'
run: docker logout
build-qa:
name: Build QA Docker image
runs-on: ubuntu-latest
steps:
- name: Set up Node
uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea
with:
node-version: '14'
- name: Update NPM
run: |
npm install -g npm@7
- name: Cache npm
id: npm-cache
uses: actions/cache@c64c572235d810460d0d6876e9c705ad5002b353 # v2.1.6
with:
path: '~/.npm'
key: ${{ runner.os }}-${{ github.run_id }}-npm-${{ hashFiles('**/package-lock.json') }}
- name: Print environment
run: |
whoami
node --version
npm --version
gulp --version
docker --version
echo "GitHub ref: $GITHUB_REF"
echo "GitHub event: $GITHUB_EVENT"
- name: Login to Azure
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/rc'
uses: Azure/login@77f1b2e3fb80c0e8645114159d17008b8a2e475a
with:
creds: ${{ secrets.AZURE_QA_KV_CREDENTIALS }}
- name: Log into container registry
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/rc'
run: az acr login -n bitwardenqa
- name: Checkout repo
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
- name: Restore
run: dotnet tool restore
- name: Install dependencies
run: npm ci
- name: Build
run: |
echo -e "# Building Web\n"
echo "Building app"
echo "npm version $(npm --version)"
npm run build:qa
echo -e "\nBuilding Docker image"
docker --version
docker build -t bitwardenqa.azurecr.io/web .
- name: Tag rc branch
if: github.ref == 'refs/heads/rc'
run: docker tag bitwardenqa.azurecr.io/web bitwardenqa.azurecr.io/web:rc
- name: Tag dev
if: github.ref == 'refs/heads/master'
run: docker tag bitwardenqa.azurecr.io/web bitwardenqa.azurecr.io/web:dev
- name: List Docker images
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/rc'
run: docker images
- name: Push rc images
if: github.ref == 'refs/heads/rc'
run: docker push bitwardenqa.azurecr.io/web:rc
- name: Push dev images
if: github.ref == 'refs/heads/master'
run: docker push bitwardenqa.azurecr.io/web:dev
- name: Log out of Docker
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/rc'
run: docker logout
windows:
name: Test code on Windows
runs-on: windows-latest
steps:
- name: Set up NuGet