diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 27da9b415e..0096eb076b 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -21,35 +21,8 @@ jobs: uses: actions/checkout@v4 - 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 - - 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 + run: yarn i18n:generate-hash && yarn tsc working-directory: ./frontend - name: Build frontend docker image shell: bash diff --git a/.github/workflows/ci.yaml b/.github/workflows/goci.yaml similarity index 99% rename from .github/workflows/ci.yaml rename to .github/workflows/goci.yaml index e347425698..01db82f1fb 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/goci.yaml @@ -1,4 +1,4 @@ -name: ci +name: goci on: pull_request: diff --git a/.github/workflows/jsci.yaml b/.github/workflows/jsci.yaml new file mode 100644 index 0000000000..041a041a5c --- /dev/null +++ b/.github/workflows/jsci.yaml @@ -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 diff --git a/frontend/package.json b/frontend/package.json index 031ff57385..498ebe7c0e 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -5,22 +5,23 @@ "main": "webpack.config.js", "scripts": { "i18n:generate-hash": "node ./i18-generate-hash.js", - "dev": "npm run i18n:generate-hash && cross-env NODE_ENV=development webpack serve --progress", - "build": "npm run i18n:generate-hash && webpack --config=webpack.config.prod.js --progress", + "dev": "cross-env NODE_ENV=development webpack serve --progress", + "build": "webpack --config=webpack.config.prod.js --progress", "prettify": "prettier --write .", - "lint": "npm run i18n:generate-hash && eslint ./src", - "lint:fix": "npm run i18n:generate-hash && eslint ./src --fix", + "fmt": "prettier --check .", + "lint": "eslint ./src", + "lint:fix": "eslint ./src --fix", "jest": "jest", "jest:coverage": "jest --coverage", "jest:watch": "jest --watch", - "postinstall": "is-ci || yarn husky:configure", - "playwright": "npm run i18n:generate-hash && NODE_ENV=testing playwright test --config=./playwright.config.ts", + "postinstall": "yarn i18n:generate-hash && (is-ci || yarn husky:configure)", + "playwright": "NODE_ENV=testing playwright test --config=./playwright.config.ts", "playwright:local:debug": "PWDEBUG=console yarn playwright --headed --browser=chromium", "playwright:codegen:local": "playwright codegen http://localhost:3301", "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/*", "commitlint": "commitlint --edit $1", - "test": "jest --coverage", + "test": "jest", "test:changedsince": "jest --changedSince=main --coverage --silent" }, "engines": {