From 3e1548062096fabaec1b738b15843dbc7aa08b9d Mon Sep 17 00:00:00 2001 From: NotifyChain CI Date: Thu, 18 Jun 2026 12:00:19 +0100 Subject: [PATCH] ci: add GitHub Actions CI and frontend linting config --- .github/workflows/ci.yml | 48 ++++++++++++++++++++++++++++++++++++++++ dashboard/.eslintignore | 6 +++++ dashboard/.eslintrc.cjs | 20 +++++++++++++++++ dashboard/package.json | 5 +++++ 4 files changed, 79 insertions(+) create mode 100644 .github/workflows/ci.yml create mode 100644 dashboard/.eslintignore create mode 100644 dashboard/.eslintrc.cjs diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..73410dac --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,48 @@ +name: CI + +on: + pull_request: + +jobs: + frontend: + name: Frontend (lint, typecheck, test) + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: 18 + cache: 'npm' + - name: Install dependencies + working-directory: dashboard + run: npm ci + - name: Run lint + working-directory: dashboard + run: npm run lint + - name: TypeScript check (build) + working-directory: dashboard + run: npm run build + - name: Run tests + working-directory: dashboard + run: npm test --silent + + rust: + name: Rust (fmt check, tests) + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Install Rust toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + profile: minimal + override: true + - name: Check formatting + working-directory: contract + run: | + rustup component add rustfmt || true + cargo fmt --all -- --check + - name: Run tests + working-directory: contract + run: cargo test --workspace --all-features --verbose diff --git a/dashboard/.eslintignore b/dashboard/.eslintignore new file mode 100644 index 00000000..2f834e6b --- /dev/null +++ b/dashboard/.eslintignore @@ -0,0 +1,6 @@ +node_modules +dist +build +coverage +/.cache +*.log diff --git a/dashboard/.eslintrc.cjs b/dashboard/.eslintrc.cjs new file mode 100644 index 00000000..1245c265 --- /dev/null +++ b/dashboard/.eslintrc.cjs @@ -0,0 +1,20 @@ +module.exports = { + root: true, + parser: '@typescript-eslint/parser', + parserOptions: { + ecmaVersion: 2020, + sourceType: 'module', + ecmaFeatures: { jsx: true } + }, + plugins: ['@typescript-eslint', 'react'], + extends: [ + 'eslint:recommended', + 'plugin:@typescript-eslint/recommended', + 'plugin:react/recommended' + ], + settings: { react: { version: 'detect' } }, + env: { browser: true, es2021: true, node: true, jest: true }, + rules: { + 'react/react-in-jsx-scope': 'off' + } +}; diff --git a/dashboard/package.json b/dashboard/package.json index 161c94aa..83122ee8 100644 --- a/dashboard/package.json +++ b/dashboard/package.json @@ -7,6 +7,7 @@ "build": "node ./node_modules/typescript/bin/tsc --noEmit && node ./node_modules/vite/bin/vite.js build", "preview": "node ./node_modules/vite/bin/vite.js preview", "dev": "node ./node_modules/vite/bin/vite.js", + "lint": "eslint 'src/**/*.{ts,tsx}' --max-warnings=0", "test": "node ./node_modules/jest/bin/jest.js", "benchmark": "node ./node_modules/jest/bin/jest.js src/benchmark" }, @@ -17,6 +18,10 @@ "zustand": "^5.0.6" }, "devDependencies": { + "@typescript-eslint/eslint-plugin": "^6.10.0", + "@typescript-eslint/parser": "^6.10.0", + "eslint": "^8.46.0", + "eslint-plugin-react": "^7.33.0", "@testing-library/react": "^16.3.0", "@testing-library/user-event": "^14.6.1", "@types/jest": "^29.5.14",