Skip to content

Commit

Permalink
[OPIK-927] [TypeScript SDK] Add CI/CD flows (#1257)
Browse files Browse the repository at this point in the history
* [OPIK-927] Add lint / TS check / unit-tests to the GitHub actions

* Add ESLint support + fix ESLint errors/warnings

* Extend CI/CD linter to more folders
  • Loading branch information
ferc authored Feb 11, 2025
1 parent bed2c1c commit f65082a
Show file tree
Hide file tree
Showing 9 changed files with 393 additions and 117 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/typescript_sdk_linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: TypeScript SDK Linter
run-name: "TypeScript SDK Linter ${{ github.ref_name }} by @${{ github.actor }}"
on:
pull_request:
paths:
- "sdks/typescript/**"
push:
branches:
- "main"
paths:
- "sdks/typescript/**"
workflow_dispatch:
jobs:
lint:
runs-on: ubuntu-latest
defaults:
run:
working-directory: sdks/typescript
steps:
- name: Checkout code
uses: actions/checkout@v4.2.2

- name: Set up Node.js
uses: actions/setup-node@v4.2.0
with:
node-version: "20"

- name: Install dependencies
run: npm install

- name: ESLint
run: npm run lint

- name: Type check
run: npm run typecheck
32 changes: 32 additions & 0 deletions .github/workflows/typescript_sdk_unit_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: TypeScript SDK Unit Tests
run-name: "TypeScript SDK Unit Tests ${{ github.ref_name }} by @${{ github.actor }}"
on:
pull_request:
paths:
- "sdks/typescript/**"
push:
branches:
- "main"
paths:
- "sdks/typescript/**"
workflow_dispatch:
jobs:
lint:
runs-on: ubuntu-latest
defaults:
run:
working-directory: sdks/typescript
steps:
- name: Checkout code
uses: actions/checkout@v4.2.2

- name: Set up Node.js
uses: actions/setup-node@v4.2.0
with:
node-version: "20"

- name: Install dependencies
run: npm install

- name: Unit tests
run: npm run test
12 changes: 12 additions & 0 deletions sdks/typescript/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import globals from "globals";
import pluginJs from "@eslint/js";
import tseslint from "typescript-eslint";

/** @type {import('eslint').Linter.Config[]} */
export default [
{ ignores: ["dist/**", "node_modules/**", "src/opik/rest_api/**"] },
{ files: ["src/**/*.{js,mjs,cjs,ts}", "tests/**/*.{js,mjs,cjs,ts}"] },
{ languageOptions: { globals: globals.browser } },
pluginJs.configs.recommended,
...tseslint.configs.recommended,
];
Loading

0 comments on commit f65082a

Please sign in to comment.