diff --git a/.github/workflows/quality-gate.yml b/.github/workflows/quality-gate.yml index 28344a6f..396aeac9 100644 --- a/.github/workflows/quality-gate.yml +++ b/.github/workflows/quality-gate.yml @@ -9,10 +9,10 @@ on: jobs: # ======================================== - # BUILD, LINT & TEST (CRITICAL) + # WEB APP - BUILD, LINT & TEST # ======================================== - quality-gate: - name: Build, Lint & Test + web: + name: Web App runs-on: ubuntu-latest steps: @@ -34,9 +34,9 @@ jobs: uses: actions/cache@v4 with: path: web/node_modules - key: ${{ runner.os }}-node-${{ hashFiles('web/package-lock.json') }} + key: ${{ runner.os }}-web-${{ hashFiles('web/package-lock.json') }} restore-keys: | - ${{ runner.os }}-node- + ${{ runner.os }}-web- - name: Install dependencies working-directory: ./web @@ -55,12 +55,11 @@ jobs: run: npm run build # ======================================== - # SECURITY CHECKS (INFORMATIVE) + # MOBILE APP - LINT & TEST # ======================================== - security-audit: - name: Security Audit + mobile: + name: Mobile App runs-on: ubuntu-latest - needs: quality-gate steps: - name: Checkout code @@ -74,23 +73,94 @@ jobs: - name: Cache npm dependencies uses: actions/cache@v4 with: - path: web/node_modules - key: ${{ runner.os }}-node-${{ hashFiles('web/package-lock.json') }} + path: mobile/node_modules + key: ${{ runner.os }}-mobile-${{ hashFiles('mobile/package-lock.json') }} restore-keys: | - ${{ runner.os }}-node- - + ${{ runner.os }}-mobile- + - name: Install dependencies - working-directory: ./web + working-directory: ./mobile run: npm install - - name: Run npm audit + - name: Run Linter + working-directory: ./mobile + run: npm run lint + + - name: Run Tests + working-directory: ./mobile + run: npm run test + + # ======================================== + # SDK UI - BUILD & TEST + # ======================================== + sdk-ui: + name: SDK UI + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Enable Corepack + run: corepack enable + + - name: Cache yarn dependencies + uses: actions/cache@v4 + with: + path: | + pezkuwi-sdk-ui/.yarn/cache + pezkuwi-sdk-ui/node_modules + key: ${{ runner.os }}-sdk-ui-${{ hashFiles('pezkuwi-sdk-ui/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-sdk-ui- + + - name: Install dependencies + working-directory: ./pezkuwi-sdk-ui + run: yarn install + + - name: Build Project + working-directory: ./pezkuwi-sdk-ui + run: yarn build + + # ======================================== + # SECURITY CHECKS (INFORMATIVE) + # ======================================== + security-audit: + name: Security Audit + runs-on: ubuntu-latest + needs: [web, mobile, sdk-ui] + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Web - npm audit working-directory: ./web continue-on-error: true - run: npm audit --audit-level=high + run: | + npm install + npm audit --audit-level=high + + - name: Mobile - npm audit + working-directory: ./mobile + continue-on-error: true + run: | + npm install + npm audit --audit-level=high - name: TruffleHog Secret Scan continue-on-error: true uses: trufflesecurity/trufflehog@main with: path: ./ - extra_args: --only-verified \ No newline at end of file + extra_args: --only-verified diff --git a/package.json b/package.json new file mode 100644 index 00000000..f09bd4b6 --- /dev/null +++ b/package.json @@ -0,0 +1,39 @@ +{ + "name": "pwap", + "version": "1.0.0", + "private": true, + "description": "Pezkuwi Web App Projects - Monorepo for web, mobile, and SDK UI applications", + "scripts": { + "build": "npm run build:web && npm run build:sdk-ui", + "build:web": "cd web && npm install && npm run build", + "build:sdk-ui": "cd pezkuwi-sdk-ui && yarn install && yarn build", + "build:all": "npm run build:web && npm run build:sdk-ui && npm run test:mobile", + "dev:web": "cd web && npm run dev", + "dev:mobile": "cd mobile && npm run dev", + "dev:sdk-ui": "cd pezkuwi-sdk-ui && yarn start", + "lint": "npm run lint:web && npm run lint:mobile", + "lint:web": "cd web && npm run lint", + "lint:mobile": "cd mobile && npm run lint", + "lint:sdk-ui": "cd pezkuwi-sdk-ui && yarn lint", + "test": "npm run test:web && npm run test:mobile", + "test:web": "cd web && npm run test", + "test:mobile": "cd mobile && npm run test", + "test:sdk-ui": "cd pezkuwi-sdk-ui && yarn test", + "install:all": "npm run install:web && npm run install:mobile && npm run install:sdk-ui", + "install:web": "cd web && npm install", + "install:mobile": "cd mobile && npm install", + "install:sdk-ui": "cd pezkuwi-sdk-ui && yarn install", + "clean": "npm run clean:web && npm run clean:mobile && npm run clean:sdk-ui", + "clean:web": "cd web && rm -rf node_modules dist", + "clean:mobile": "cd mobile && rm -rf node_modules", + "clean:sdk-ui": "cd pezkuwi-sdk-ui && yarn clean && rm -rf node_modules" + }, + "repository": { + "type": "git", + "url": "https://github.com/pezkuwichain/pwap.git" + }, + "license": "Apache-2.0", + "engines": { + "node": ">=18" + } +}