Skip to content

Commit

Permalink
MAT-3353: First commit with Measure application
Browse files Browse the repository at this point in the history
  • Loading branch information
Gregory P. Akins committed Nov 1, 2021
0 parents commit dd9838d
Show file tree
Hide file tree
Showing 28 changed files with 28,549 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": ["ts-react-important-stuff", "plugin:prettier/recommended"],
"parser": "@babel/eslint-parser"
}
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Code owners:
* @AndrewBird81 @adongare @jkotanchik-SB @serhii-ilin @gregory-akins @RohitKandimalla
29 changes: 29 additions & 0 deletions .github/workflows/gitleaks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# @format

name: Github Secrets Scanner

on: [push]

jobs:
gitleaks_scan:
runs-on: ubuntu-latest
env:
REPO: https://github.com/MeasureAuthoringTool/madie-public
REMOTE_EXCLUDES_URL: https://raw.githubusercontent.com/semanticbits/bmat-gitleaks-automation/master/madie-public/gitleaks.toml
GITLEAKS_VERSION: v7.5.0
steps:
- name: Execute Gitleaks
run: |
wget ${REMOTE_EXCLUDES_URL} -O gitleaks.toml
wget https://github.com/zricethezav/gitleaks/releases/download/${GITLEAKS_VERSION}/gitleaks-linux-amd64 -O gitleaks
chmod +x gitleaks
echo ${GITHUB_SHA}
echo "gitleaks --repo-url=${REPO} -v --redact --commit=${GITHUB_SHA} --config-path=gitleaks.toml"
./gitleaks --repo-url=${REPO} -v --redact --commit=${GITHUB_SHA} --config-path=gitleaks.toml
- name: Slack notification
if: failure()
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
uses: Ilshidur/action-slack@master
with:
args: "Potential Secrets found in: https://github.com/{{ GITHUB_REPOSITORY }}/commit/{{ GITHUB_SHA }} Link to build with full gitleaks output: https://github.com/{{ GITHUB_REPOSITORY }}/commit/{{ GITHUB_SHA }}/checks"
59 changes: 59 additions & 0 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: npm-publish
on:
push:
branches:
- main
jobs:
npm-publish:
name: npm-publish
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Use Node.js 14.x
uses: actions/setup-node@v2-beta
with:
node-version: 14.x

- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
path: ~/.npm
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 node dependencies
run: npm ci

- name: Audit dependencies for security vulnerabilities
run: npm audit

- name: Lint the source code
run: npm run-script lint

- name: Check prettier formatting
run: npm run-script check-format

- name: Build the source code
run: npm run build

- name: Execute test coverage
run: npm run-script coverage

- name: Publish if version has been updated
uses: pascalgn/npm-publish-action@master
with: # All of theses inputs are optional
tag_name: "v%s"
tag_message: "v%s"
commit_pattern: "[\\s\\S]*Release (\\S+)"
publish_args: " --access public"
env: # More info about the environment variables in the README
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Leave this as is, it's automatically generated
NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
98 changes: 98 additions & 0 deletions .github/workflows/unit_test_coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# This workflow will do the following:
# - perform a clean install of node dependencies
# - lint the source code for errors
# - build the source code
# - run tests and capture code coverage
# - run end-to-end tests
# - upload the code coverage report to Codacy
# - upload the code coverage report to Codecov

name: Continuous Integration

on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]

jobs:
build:
name: Checkout, install, lint, build and test with coverage
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Use Node.js 14.x
uses: actions/setup-node@v2-beta
with:
node-version: 14.x

- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
path: ~/.npm
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 node dependencies
run: npm ci

- name: Audit dependencies for security vulnerabilities
run: npm audit

- name: Lint the source code
run: npm run-script lint

- name: Check prettier formatting
run: npm run-script check-format

- name: Build the source code
run: npm run build

- name: Execute test coverage
run: npm run-script coverage

- name: Store the coverage report as an artifact
uses: actions/upload-artifact@v2
with:
name: coverage
path: src/coverage/lcov.info

upload-codacy-coverage:
name: Upload code coverage to Codacy
needs: build
runs-on: ubuntu-latest
steps:
- name: Download coverage artifact
uses: actions/download-artifact@v2
with:
name: coverage

- name: Upload code coverage to Codacy
uses: codacy/codacy-coverage-reporter-action@master
with:
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
coverage-reports: lcov.info

upload-codecov-coverage:
name: Upload code coverage to Codecov
needs: build
runs-on: ubuntu-latest
steps:
- name: Download coverage artifact
uses: actions/download-artifact@v2
with:
name: coverage

- name: Upload code coverage to Codecov
uses: codecov/codecov-action@v2
with:
file: lcov.info
fail_ci_if_error: true
72 changes: 72 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# next.js build output
.next
dist

# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
.DS_Store
1 change: 1 addition & 0 deletions .husky/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npm exec pretty-quick --staged && npm exec concurrently npm:test npm:lint
8 changes: 8 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.gitignore
.prettierignore
yarn.lock
yarn-error.log
package-lock.json
dist
coverage
pnpm-lock.yaml
12 changes: 12 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM node:16 as build-stage
WORKDIR /usr/src/app
COPY . .
RUN npm install && \
npm run build:webpack && \
npm test -- --silent

# Stage 1, based on Nginx, to have only the compiled app, ready for production with Nginx
FROM nginx:1.21.0-alpine
COPY --from=build-stage /usr/src/app/dist/ /usr/share/nginx/html
COPY nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 8503
Loading

0 comments on commit dd9838d

Please sign in to comment.