ci(js): ci workflow for js (#7267)

- ci(js): ci workflow for js
This commit is contained in:
Prashant Shahi 2025-03-11 19:10:54 +05:30 committed by GitHub
parent 494d2460a0
commit 239ea9d34c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 48 additions and 36 deletions

View File

@ -21,35 +21,8 @@ jobs:
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Install dependencies - name: Install dependencies
run: cd frontend && yarn install run: cd frontend && yarn install
- name: Run ESLint
run: cd frontend && npm run lint
- name: Run Jest
run: cd frontend && npm run jest
- name: TSC - name: TSC
run: yarn tsc run: yarn i18n:generate-hash && yarn tsc
working-directory: ./frontend
- name: Build frontend docker image
shell: bash
run: |
make build-frontend-amd64
build-frontend-ee:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Create .env file
run: |
echo 'INTERCOM_APP_ID="${{ secrets.INTERCOM_APP_ID }}"' > frontend/.env
echo 'SEGMENT_ID="${{ secrets.SEGMENT_ID }}"' >> frontend/.env
- name: Install dependencies
run: cd frontend && yarn install
- name: Run ESLint
run: cd frontend && npm run lint
- name: Run Jest
run: cd frontend && npm run jest
- name: TSC
run: yarn tsc
working-directory: ./frontend working-directory: ./frontend
- name: Build frontend docker image - name: Build frontend docker image
shell: bash shell: bash

View File

@ -1,4 +1,4 @@
name: ci name: goci
on: on:
pull_request: pull_request:

38
.github/workflows/jsci.yaml vendored Normal file
View File

@ -0,0 +1,38 @@
name: jsci
on:
pull_request:
branches:
- main
pull_request_target:
types:
- labeled
jobs:
test:
if: |
(github.event_name == 'pull_request' && ! github.event.pull_request.head.repo.fork && github.event.pull_request.user.login != 'dependabot[bot]' && ! contains(github.event.pull_request.labels.*.name, 'safe-to-test')) ||
(github.event_name == 'pull_request_target' && contains(github.event.pull_request.labels.*.name, 'safe-to-test'))
uses: signoz/primus.workflows/.github/workflows/js-test.yaml@main
secrets: inherit
with:
PRIMUS_REF: main
JS_SRC: frontend
fmt:
if: |
(github.event_name == 'pull_request' && ! github.event.pull_request.head.repo.fork && github.event.pull_request.user.login != 'dependabot[bot]' && ! contains(github.event.pull_request.labels.*.name, 'safe-to-test')) ||
(github.event_name == 'pull_request_target' && contains(github.event.pull_request.labels.*.name, 'safe-to-test'))
uses: signoz/primus.workflows/.github/workflows/js-fmt.yaml@main
secrets: inherit
with:
PRIMUS_REF: main
JS_SRC: frontend
lint:
if: |
(github.event_name == 'pull_request' && ! github.event.pull_request.head.repo.fork && github.event.pull_request.user.login != 'dependabot[bot]' && ! contains(github.event.pull_request.labels.*.name, 'safe-to-test')) ||
(github.event_name == 'pull_request_target' && contains(github.event.pull_request.labels.*.name, 'safe-to-test'))
uses: signoz/primus.workflows/.github/workflows/js-lint.yaml@main
secrets: inherit
with:
PRIMUS_REF: main
JS_SRC: frontend

View File

@ -5,22 +5,23 @@
"main": "webpack.config.js", "main": "webpack.config.js",
"scripts": { "scripts": {
"i18n:generate-hash": "node ./i18-generate-hash.js", "i18n:generate-hash": "node ./i18-generate-hash.js",
"dev": "npm run i18n:generate-hash && cross-env NODE_ENV=development webpack serve --progress", "dev": "cross-env NODE_ENV=development webpack serve --progress",
"build": "npm run i18n:generate-hash && webpack --config=webpack.config.prod.js --progress", "build": "webpack --config=webpack.config.prod.js --progress",
"prettify": "prettier --write .", "prettify": "prettier --write .",
"lint": "npm run i18n:generate-hash && eslint ./src", "fmt": "prettier --check .",
"lint:fix": "npm run i18n:generate-hash && eslint ./src --fix", "lint": "eslint ./src",
"lint:fix": "eslint ./src --fix",
"jest": "jest", "jest": "jest",
"jest:coverage": "jest --coverage", "jest:coverage": "jest --coverage",
"jest:watch": "jest --watch", "jest:watch": "jest --watch",
"postinstall": "is-ci || yarn husky:configure", "postinstall": "yarn i18n:generate-hash && (is-ci || yarn husky:configure)",
"playwright": "npm run i18n:generate-hash && NODE_ENV=testing playwright test --config=./playwright.config.ts", "playwright": "NODE_ENV=testing playwright test --config=./playwright.config.ts",
"playwright:local:debug": "PWDEBUG=console yarn playwright --headed --browser=chromium", "playwright:local:debug": "PWDEBUG=console yarn playwright --headed --browser=chromium",
"playwright:codegen:local": "playwright codegen http://localhost:3301", "playwright:codegen:local": "playwright codegen http://localhost:3301",
"playwright:codegen:local:auth": "yarn playwright:codegen:local --load-storage=tests/auth.json", "playwright:codegen:local:auth": "yarn playwright:codegen:local --load-storage=tests/auth.json",
"husky:configure": "cd .. && husky install frontend/.husky && cd frontend && chmod ug+x .husky/*", "husky:configure": "cd .. && husky install frontend/.husky && cd frontend && chmod ug+x .husky/*",
"commitlint": "commitlint --edit $1", "commitlint": "commitlint --edit $1",
"test": "jest --coverage", "test": "jest",
"test:changedsince": "jest --changedSince=main --coverage --silent" "test:changedsince": "jest --changedSince=main --coverage --silent"
}, },
"engines": { "engines": {