Skip to content

Update dependency @types/config to v3 #755

Update dependency @types/config to v3

Update dependency @types/config to v3 #755

Workflow file for this run

name: "CI/CD Pipeline"
on:
push:
branches-ignore:
- l10n_develop
- gh-pages
paths-ignore:
- '*.md'
- 'LICENSE'
- 'monitoring/grafana-dashboard.json'
- 'screenshots/**'
tags-ignore:
- '*'
pull_request:
paths-ignore:
- '*.md'
- 'LICENSE'
- 'data/static/i18n/*.json'
- 'frontend/src/assets/i18n/*.json'
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: "Check out Git repository"
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f #v2: v2.3.4 available
- name: "Use Node.js 14"
uses: actions/setup-node@f1f314fca9dfce2769ece7d933488f076716723e #v1: v2.x available
with:
node-version: 14
- name: "Install CLI tools"
run: npm install -g @angular/cli
- name: "Install application"
run: |
npm install --ignore-scripts
cd frontend
npm install --ignore-scripts
- name: "Lint source code"
run: npm run lint
- name: "Lint customization configs"
run: |
npm run lint:config -- -f ./config/7ms.yml
npm run lint:config -- -f ./config/addo.yml
npm run lint:config -- -f ./config/bodgeit.yml
npm run lint:config -- -f ./config/ctf.yml
npm run lint:config -- -f ./config/default.yml
npm run lint:config -- -f ./config/fbctf.yml
npm run lint:config -- -f ./config/juicebox.yml
npm run lint:config -- -f ./config/mozilla.yml
npm run lint:config -- -f ./config/oss.yml
npm run lint:config -- -f ./config/quiet.yml
npm run lint:config -- -f ./config/tutorial.yml
npm run lint:config -- -f ./config/unsafe.yml
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
node-version: [12, 14, 16]
steps:
- name: "Check out Git repository"
if: github.repository == 'juice-shop/juice-shop' || github.repository != 'juice-shop/juice-shop' && matrix.os == 'ubuntu-latest' && matrix.node-version == '14'
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f #v2: v2.3.4 available
- name: "Use Node.js ${{ matrix.node-version }}"
if: github.repository == 'juice-shop/juice-shop' || github.repository != 'juice-shop/juice-shop' && matrix.os == 'ubuntu-latest' && matrix.node-version == '14'
uses: actions/setup-node@f1f314fca9dfce2769ece7d933488f076716723e #v1: v2.x available
with:
node-version: ${{ matrix.node-version }}
- name: "Cache Node.js modules"
if: github.repository == 'juice-shop/juice-shop' || github.repository != 'juice-shop/juice-shop' && matrix.os == 'ubuntu-latest' && matrix.node-version == '14'
uses: actions/cache@c64c572235d810460d0d6876e9c705ad5002b353 #v2: 2.1.6 available
with:
path: ~/.npm
key: ${{ runner.OS }}-node-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.OS }}-node-
${{ runner.OS }}-
- name: "Install CLI tools"
if: github.repository == 'juice-shop/juice-shop' || github.repository != 'juice-shop/juice-shop' && matrix.os == 'ubuntu-latest' && matrix.node-version == '14'
run: npm install -g @angular/cli
- name: "Install application"
if: github.repository == 'juice-shop/juice-shop' || github.repository != 'juice-shop/juice-shop' && matrix.os == 'ubuntu-latest' && matrix.node-version == '14'
run: npm install
- name: "Execute unit tests"
if: github.repository == 'juice-shop/juice-shop' || github.repository != 'juice-shop/juice-shop' && matrix.os == 'ubuntu-latest' && matrix.node-version == '14'
uses: nick-invision/retry@45ba062d357edb3b29c4a94b456b188716f61020 #v2: 2.4.1 available
with:
timeout_minutes: 10
max_attempts: 3
command: npm test
- name: "Execute integration tests"
if: github.repository == 'juice-shop/juice-shop' || github.repository != 'juice-shop/juice-shop' && matrix.os == 'ubuntu-latest' && matrix.node-version == '14'
uses: nick-invision/retry@45ba062d357edb3b29c4a94b456b188716f61020 #v2: 2.4.1 available
with:
timeout_minutes: 5
max_attempts: 3
command: |
if [ "$RUNNER_OS" == "Windows" ]; then
set NODE_ENV=test
else
export NODE_ENV=test
fi
npm run frisby
shell: bash
- name: "Publish coverage to Codeclimate"
if: github.repository == 'juice-shop/juice-shop' && github.event_name == 'push' && matrix.os == 'ubuntu-latest' && matrix.node-version == '14'
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
run: |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-0.7.0-linux-amd64 > ./cc-test-reporter
chmod +x ./cc-test-reporter
sed -i s/SF:/SF:frontend\\//g build/reports/coverage/frontend-tests/lcov.info
./cc-test-reporter format-coverage -t lcov -o build/reports/coverage/codeclimate.frontend.json build/reports/coverage/frontend-tests/lcov.info
./cc-test-reporter format-coverage -t lcov -o build/reports/coverage/codeclimate.server.json build/reports/coverage/server-tests/lcov.info
./cc-test-reporter format-coverage -t lcov -o build/reports/coverage/codeclimate.api.json build/reports/coverage/api-tests/lcov.info
./cc-test-reporter sum-coverage build/reports/coverage/codeclimate.*.json -p 3
./cc-test-reporter upload-coverage
shell: bash
e2e:
runs-on: windows-latest
if: github.repository == 'juice-shop/juice-shop'
steps:
- name: "Check out Git repository"
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f #v2: v2.3.4 available
- name: "Use Node.js 14"
uses: actions/setup-node@f1f314fca9dfce2769ece7d933488f076716723e #v1: v2.x available
with:
node-version: 14
- name: "Install CLI tools"
run: npm install -g @angular/cli
- name: "Install application"
run: npm install
- name: "Execute end-to-end tests"
env:
SOLUTIONS_WEBHOOK: ${{ secrets.E2E_SOLUTIONS_WEBHOOK }}
uses: nick-invision/retry@45ba062d357edb3b29c4a94b456b188716f61020 #v2: 2.4.1 available
with:
timeout_minutes: 20
max_attempts: 2
command: |
set NODE_ENV=test
set SOLUTIONS_WEBHOOK="$env:SOLUTIONS_WEBHOOK"
npm run preprotractor:github
npm run e2e
e2e-in-subfolder:
runs-on: windows-latest
if: github.repository == 'juice-shop/juice-shop'
continue-on-error: true
steps:
- name: "Check out Git repository"
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f #v2: v2.3.4 available
- name: "Use Node.js 14"
uses: actions/setup-node@f1f314fca9dfce2769ece7d933488f076716723e #v1: v2.x available
with:
node-version: 14
- name: "Install CLI tools"
run: npm install -g @angular/cli
- name: "Install application"
run: npm install
- name: "Execute end-to-end tests with application hosted in subfolder"
uses: nick-invision/retry@45ba062d357edb3b29c4a94b456b188716f61020 #v2: 2.4.1 available
with:
timeout_minutes: 20
max_attempts: 2
command: |
set NODE_ENV=test
npm run preprotractor:github
npm run e2e -- subfolder
smoke:
runs-on: ubuntu-latest
steps:
- name: "Check out Git repository"
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f #v2: v2.3.4 available
- name: "Use Node.js 14"
uses: actions/setup-node@f1f314fca9dfce2769ece7d933488f076716723e #v1: v2.x available
with:
node-version: 14
- name: "Install CLI tools"
run: |
npm install -g @angular/cli
npm install -g grunt-cli
- name: "Set packaging options for Grunt"
run: |
echo "PCKG_OS_NAME=linux" >> $GITHUB_ENV
echo "PCKG_NODE_VERSION=14" >> $GITHUB_ENV
echo "PCKG_CPU_ARCH=x64" >> $GITHUB_ENV
- name: "Package application"
run: |
npm install --production
npm install -g grunt-cli
npm run package:ci
- name: "Unpack application archive"
run: |
cd dist
tar -zxf juice-shop-*.tgz
- name: "Execute smoke test"
run: |
cd dist/juice-shop_*
npm start &
cd ../..
chmod +x test/smoke/smoke-test.sh
test/smoke/smoke-test.sh http://localhost:3000
docker-test:
runs-on: ubuntu-latest
steps:
- name: "Check out Git repository"
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f #v2: v2.3.4 available
- name: "Execute smoke test on Docker"
run: docker-compose -f docker-compose.test.yml up --exit-code-from sut
docker:
if: github.repository == 'juice-shop/juice-shop' && github.event_name == 'push' && (github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/master')
needs: [test, e2e, docker-test]
runs-on: ubuntu-latest
steps:
- name: "Check out Git repository"
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f #v2: v2.3.4 available
- name: "Set up QEMU"
uses: docker/setup-qemu-action@27d0a4f181a40b142cce983c5393082c365d1480 #v1: V1.2.0 available
- name: "Set up Docker Buildx"
uses: docker/setup-buildx-action@94ab11c41e45d028884a99163086648e898eed25 #v1
- name: "Login to DockerHub"
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 #v1.10
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: "Set tag & labels for ${{ github.ref }}"
run: |
if [ "$GITHUB_REF" == "refs/heads/master" ]; then
echo "DOCKER_TAG=latest" >> $GITHUB_ENV
else
echo "DOCKER_TAG=snapshot" >> $GITHUB_ENV
fi
echo "VCS_REF=`git rev-parse --short HEAD`" >> $GITHUB_ENV
echo "BUILD_DATE=`date -u +”%Y-%m-%dT%H:%M:%SZ”`" >> $GITHUB_ENV
- name: "Build and push"
uses: docker/build-push-action@a66e35b9cbcf4ad0ea91ffcaf7bbad63ad9e0229 #note: newer is available
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm/v7,linux/arm64
push: true
tags: |
bkimminich/juice-shop:${{ env.DOCKER_TAG }}
build-args: |
VCS_REF=${{ env.VCS_REF }}
BUILD_DATE=${{ env.BUILD_DATE }}
heroku:
if: github.repository == 'juice-shop/juice-shop' && github.event_name == 'push' && (github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/master')
needs: [test, e2e]
runs-on: ubuntu-latest
steps:
- name: "Check out Git repository"
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f #v2: v2.3.4 available
- name: "Set Heroku app & branch for ${{ github.ref }}"
run: |
if [ "$GITHUB_REF" == "refs/heads/master" ]; then
echo "HEROKU_APP=juice-shop" >> $GITHUB_ENV
echo "HEROKU_BRANCH=master" >> $GITHUB_ENV
else
echo "HEROKU_APP=juice-shop-staging" >> $GITHUB_ENV
echo "HEROKU_BRANCH=develop" >> $GITHUB_ENV
fi
- name: "Deploy ${{ github.ref }} to Heroku"
uses: akhileshns/heroku-deploy@79ef2ae4ff9b897010907016b268fd0f88561820 #v3.12.12
with:
heroku_api_key: ${{ secrets.HEROKU_API_KEY }}
heroku_app_name: ${{ env.HEROKU_APP }}
heroku_email: bjoern.kimminich@owasp.org
branch: ${{ env.HEROKU_BRANCH }}
notify-slack:
if: github.repository == 'juice-shop/juice-shop' && github.event_name == 'push' && (success() || failure())
needs:
- docker
- heroku
- lint
- e2e-in-subfolder
- smoke
runs-on: ubuntu-latest
steps:
- name: "Slack workflow notification"
uses: Gamesight/slack-workflow-status@master
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
slack_webhook_url: ${{ secrets.SLACK_WEBHOOK_URL }}