Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Githubcicd #75

Open
wants to merge 3 commits into
base: githubcicd
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 69 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Bitcoin order App
on:
push:
branches:
- githubcicd
jobs:
ci:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [16.x]

steps:
- uses: actions/checkout@v2
- uses: browser-actions/setup-chrome@latest
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- name: Cache node modules
id: cache-nodemodules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
# caching node_modules
path: node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Install Dependencies
if: steps.cache-nodemodules.outputs.cache-hit != 'true'
run: |
npm ci --force
- name: Build
run: |
npm run build --force
- name: Lint
run: |
npm run lint
- name: Update types to latest
run: |
npm install --save-dev @types/node@latest --force
#- name: Test
# run: |
# npm run test --watch=false --browsers=ChromeHeadless
- name: Conventional Changelog Action
id: changelog
uses: TriPSs/conventional-changelog-action@v3
with:
github-token: ${{ secrets.WORKSHOP6_GITHUB_TOKEN }}
output-file: "false"

- name: Create Release
uses: actions/create-release@v1
if: ${{ steps.changelog.outputs.skipped == 'false' }}
env:
GITHUB_TOKEN: ${{ secrets.WORKSHOP6_GITHUB_TOKEN }}
with:
tag_name: ${{ steps.changelog.outputs.tag }}
release_name: ${{ steps.changelog.outputs.tag }}
body: ${{ steps.changelog.outputs.clean_changelog }}
- name: Deploy
run: |
npm run deploy
40 changes: 40 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: "linting-tool-scan"

on:
push:
branches: [githubcicd]

jobs:
test:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [16.x]

steps:
- uses: actions/checkout@v2

- name: Install Dependencies
if: steps.cache-nodemodules.outputs.cache-hit != 'true'
run: |
npm ci --force

- name: Installing JSHint
run: |
sudo npm install -g jshint

- name: Change script permission
run: |
chmod +x scripts/jshint-script.sh

- name: Run scan with JSHint
run: scripts/jshint-script.sh

- name: Archive production artifacts
uses: actions/upload-artifact@v2
with:
name: linting tool report
path: |
./JSHint-report

38 changes: 38 additions & 0 deletions .github/workflows/sast-scan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: "sast-scan"

on:
push:
branches: [githubcicd]

jobs:
test:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [16.x]

steps:
- uses: actions/checkout@v2

- name: Install Dependencies
if: steps.cache-nodemodules.outputs.cache-hit != 'true'
run: |
npm ci --force

- name: OWASP Dependency Check
run: |
wget https://github.com/jeremylong/DependencyCheck/releases/download/v7.2.0/dependency-check-7.2.0-release.zip
unzip dependency-check-7.2.0-release.zip

- name: Run scan with ODC
run: |
dependency-check/bin/dependency-check.sh --project "bitcoin" --scan . > ODC-report

- name: Archive production artifacts
uses: actions/upload-artifact@v2
with:
name: sast report
path: |
./ODC-report

32 changes: 32 additions & 0 deletions .github/workflows/zap-scan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: "owasp-scan"

on:
push:
branches: [githubcicd]

jobs:
test:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [16.x]

steps:
- uses: actions/checkout@v2

- name: Change script permission
run: |
chmod +x scripts/zap-script.sh

- name: ZAP scan
run: scripts/zap-script.sh

- name: Archive production artifacts
uses: actions/upload-artifact@v2
with:
name: zap report
path: |
./zap_baseline_report.html


5 changes: 5 additions & 0 deletions scripts/jshint-script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

jshint --exclude="node_modules/" --reporter=unix . > JSHint-report

echo $? > /dev/null
6 changes: 6 additions & 0 deletions scripts/zap-script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

docker pull owasp/zap2docker-stable
docker run -i owasp/zap2docker-stable zap-baseline.py -t "https://kenken64.github.io/bitcoin-order-app/" -l PASS > zap_baseline_report.html

echo $? > /dev/null