Skip to content

Commit

Permalink
feat: validate pr workflow (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
vasyl-ivanchuk authored Sep 14, 2023
1 parent 1f14ff5 commit 04987a2
Show file tree
Hide file tree
Showing 10 changed files with 128 additions and 13 deletions.
17 changes: 17 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# What :computer:
* First thing updated with this PR
* Second thing updated with this PR
* Third thing updated with this PR

# Why :hand:
* Reason why first thing was added to PR
* Reason why second thing was added to PR
* Reason why third thing was added to PR

# Evidence :camera:
Include screenshots, screen recordings, or `console` output here demonstrating that your changes work as intended

<!-- All sections below are optional. You can erase any section not applicable to your Pull Request. -->

# Notes :memo:
* Any notes/thoughts that the reviewers should know prior to reviewing the code?
17 changes: 17 additions & 0 deletions .github/workflows/secrets_scanner.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Leaked Secrets Scan
on: [pull_request]
jobs:
TruffleHog:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3
with:
fetch-depth: 0
- name: TruffleHog OSS
uses: trufflesecurity/trufflehog@0c66d30c1f4075cee1aada2e1ab46dabb1b0071a
with:
path: ./
base: ${{ github.event.repository.default_branch }}
head: HEAD
extra_args: --debug --only-verified
67 changes: 67 additions & 0 deletions .github/workflows/validate-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Validate PR

on:
pull_request:
types:
- opened
- edited
- reopened
- synchronize

jobs:
label:
name: Validate PR title
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v5
with:
subjectPattern: ^(?![A-Z]).+$
env:
GITHUB_TOKEN: ${{ github.token }}

build:
name: Build and Test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'npm'

- name: Install dependencies
run: |
npm ci
- name: Lint
run: |
npm run lint -- -- --no-fix --max-warnings 0
- name: App type check
working-directory: ./packages/app
run: |
npm run typecheck
- name: Test
run: |
npm run test:unit:ci
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action/composite@v2
if: always()
with:
files: |
packages/app/junit.xml
packages/api/junit.xml
packages/worker/junit.xml
check_run_annotations: all tests, skipped tests
report_individual_runs: "true"

- name: Build
run: |
npm run build
14 changes: 10 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "block-explorer",
"version": "1.0.0-development",
"private": true,
"workspaces": [
"packages/*"
Expand All @@ -8,6 +9,7 @@
"prepare": "husky install",
"lint": "lerna run lint",
"test": "lerna run test",
"test:unit:ci": "lerna run test:unit:ci",
"build": "lerna run build"
},
"dependencies": {
Expand All @@ -21,5 +23,9 @@
"@commitlint/cli": "^17.1.2",
"@commitlint/config-conventional": "^17.1.0",
"@matterlabs/prettier-config": "^1.0.2"
},
"engines": {
"npm": ">=9.0.0",
"node": ">=18.0.0"
}
}
2 changes: 1 addition & 1 deletion packages/api/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:18.10.0-alpine AS base-stage
FROM node:18.17.1-alpine AS base-stage
ENV NODE_ENV=production

WORKDIR /usr/src/app
Expand Down
7 changes: 4 additions & 3 deletions packages/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"test": "jest",
"test:watch": "jest --watch",
"test:cov": "jest --coverage",
"test:unit:ci": "jest --coverage",
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
"test:e2e": "jest --config ./test/jest-e2e.json --runInBand --detectOpenHandles",
"test:perf": "artillery run ./performance/load-test.yaml"
Expand Down Expand Up @@ -112,7 +113,7 @@
[
"jest-junit",
{
"suiteName": "Unit tests"
"suiteName": "API Unit tests"
}
]
]
Expand All @@ -124,7 +125,7 @@
]
},
"engines": {
"npm": ">=8.0.0",
"node": ">=16.0.0"
"npm": ">=9.0.0",
"node": ">=18.0.0"
}
}
2 changes: 1 addition & 1 deletion packages/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"build": "vue-tsc --noEmit && vite build",
"preview": "vite preview --port 5050",
"test": "TZ=UTC-3 vitest --environment jsdom",
"test:unit:ci": "TZ=UTC-3 vitest --environment jsdom --run",
"test:unit:ci": "TZ=UTC-3 vitest --environment jsdom --run --reporter=verbose --reporter=junit --outputFile.junit=./junit.xml",
"test:e2e": "cucumber-js -t \"not @testnet\"",
"typecheck": "vue-tsc --noEmit -p tsconfig.vitest.json --composite false",
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
Expand Down
2 changes: 1 addition & 1 deletion packages/worker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:18.10.0-alpine AS base-stage
FROM node:18.17.1-alpine AS base-stage
ENV NODE_ENV=production

WORKDIR /usr/src/app
Expand Down
7 changes: 4 additions & 3 deletions packages/worker/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"test": "jest",
"test:watch": "jest --watch",
"test:cov": "jest --coverage",
"test:unit:ci": "jest --coverage",
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
"test:e2e": "jest --config ./test/jest-e2e.json",
"typeorm": "typeorm-ts-node-commonjs",
Expand Down Expand Up @@ -110,7 +111,7 @@
[
"jest-junit",
{
"suiteName": "Unit tests"
"suiteName": "Worker Unit tests"
}
]
]
Expand All @@ -122,7 +123,7 @@
]
},
"engines": {
"npm": ">=8.0.0",
"node": ">=16.0.0"
"npm": ">=9.0.0",
"node": ">=18.0.0"
}
}

0 comments on commit 04987a2

Please sign in to comment.