Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 85 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: CI

on:
push:
branches: [main]
pull_request:

Comment thread
expede marked this conversation as resolved.
# Cancel in-progress runs for the same ref when a new commit lands.
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true

jobs:
check:
name: Typecheck, lint, build
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up pnpm
# Reads the pnpm version from package.json#packageManager.
uses: pnpm/action-setup@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "24"
cache: pnpm

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Typecheck
run: pnpm typecheck

- name: Lint
run: pnpm lint

- name: Build
run: pnpm build

test:
name: Test (${{ matrix.name }})
needs: check
runs-on: ubuntu-latest
timeout-minutes: 25
strategy:
# Always run both backends so a regression in one is visible even if the
# other fails first.
fail-fast: false
matrix:
include:
# WebSocket suite hits wss://sync3.automerge.org.
- name: WebSocket backend
script: test:websocket
# Subduction suite hits wss://subduction.sync.inkandswitch.com via
# the --sub flag (plus pure-unit Subduction tests).
- name: Subduction backend
script: test:subduction
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up pnpm
uses: pnpm/action-setup@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "24"
cache: pnpm

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Build
# Several integration tests shell out to `dist/cli.js`, so the build
# artifact must exist before tests run.
run: pnpm build

- name: Test
run: pnpm run ${{ matrix.script }}
timeout-minutes: 20
41 changes: 41 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// Minimal ESLint flat config for pushwork.
//
// Goal: catch genuine bugs (undeclared bindings, unreachable code, etc.) without
// nitpicking existing style — formatting belongs to Prettier (.prettierrc).
//
// Most stylistic rules from typescript-eslint's `recommended` set are toned down
// here so this can run green on the existing codebase. Tighten over time.
import tseslint from "typescript-eslint";

export default tseslint.config(
{
ignores: ["dist/**", "node_modules/**", "coverage/**", "**/*.d.ts"],
},
...tseslint.configs.recommended,
{
rules: {
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/no-empty-object-type": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-require-imports": "off",
"@typescript-eslint/no-unused-expressions": "off",
"@typescript-eslint/no-unused-vars": [
"warn",
{
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
caughtErrorsIgnorePattern: "^_",
},
],
"no-empty": ["warn", { allowEmptyCatch: true }],
// `ignoreReadBeforeAssign` keeps the rule from flagging the legitimate
// pattern where a `let` is declared first so it can be captured by a
// closure defined immediately afterward, and is then assigned later
// (e.g. `let timer; const cleanup = () => clearTimeout(timer); timer = setTimeout(...)`).
// Rewriting those to `const` would force restructuring just to silence
// the lint without any real readability gain.
"prefer-const": ["warn", { ignoreReadBeforeAssign: true }],
},
},
);
13 changes: 9 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@
"dev": "tsc --watch",
"test": "jest",
"test:bail": "jest --bail",
"test:watch": "jest --watch",
"test:coverage": "jest --coverage",
"lint": "eslint src --ext .ts",
"lint:fix": "eslint src --ext .ts --fix",
"test:subduction": "jest test/unit/repo-factory.test.ts test/unit/network-sync-sub.test.ts test/unit/subduction-config.test.ts test/integration/sub-flag.test.ts",
"test:watch": "jest --watch",
"test:websocket": "jest --testPathIgnorePatterns=/node_modules/ --testPathIgnorePatterns=\"(repo-factory|network-sync-sub|subduction-config|sub-flag)[.]test[.]ts$\"",
"lint": "eslint src",
"lint:fix": "eslint src --fix",
"clean": "rm -rf dist",
"prepack": "pnpm run build",
"start": "node dist/cli.js",
Expand Down Expand Up @@ -61,12 +63,14 @@
"@types/node": "^20.0.0",
"@types/tmp": "^0.2.4",
"babel-jest": "^30.2.0",
"eslint": "^9.18.0",
"fast-check": "^4.3.0",
"jest": "^29.7.0",
"tmp": "^0.2.1",
"ts-jest": "^29.1.0",
"tsx": "^4.19.2",
"typescript": "^5.2.0"
"typescript": "^5.2.0",
"typescript-eslint": "^8.20.0"
},
"jest": {
"preset": "ts-jest",
Expand All @@ -86,6 +90,7 @@
"setupFilesAfterEnv": [
"<rootDir>/test/jest.setup.ts"
],
"globalSetup": "<rootDir>/test/jest.globalSetup.ts",
"maxWorkers": "75%",
"maxConcurrency": 10,
"transformIgnorePatterns": [
Expand Down
Loading
Loading