Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
49 changes: 34 additions & 15 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,43 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x] # Adjust node version as necessary
node-version: [22.15.0] # Adjust node version as necessary

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: Install dependencies
run: |
make install
- name: Enable Corepack
run: corepack enable

- name: Prepare Yarn 4.9.1
run: corepack prepare yarn@4.9.1 --activate

- name: Lint interface
run: yarn lint
working-directory: ./interface
- name: Cache Yarn
uses: actions/cache@v3
with:
path: |
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-

- name: Lint server
run: yarn lint
working-directory: ./server
- name: Install dependencies
run: make install
env:
YARN_ENABLE_HARDENED_MODE: 0

- name: Lint interface
run: yarn lint
working-directory: ./interface

- name: Lint server
run: yarn lint
working-directory: ./server
33 changes: 28 additions & 5 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ jobs:
POSTGRES_USER: postgres
ports:
- 5432:5432
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
Expand All @@ -32,10 +31,30 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
node-version: 22.15.0

- name: Enable Corepack
run: corepack enable

- name: Prepare Yarn 4.9.1
run: corepack prepare yarn@4.9.1 --activate

- name: Cache Yarn
uses: actions/cache@v3
with:
path: |
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-

- name: Install dependencies
run: make install
env:
YARN_ENABLE_HARDENED_MODE: 0

- name: Run DB Migration
run: make run-migrations
Expand Down Expand Up @@ -83,12 +102,16 @@ jobs:
JWT_SECRET: 6b23439e8fee67c5da38b61b8779e9f41a5e3e36efe723c6299dd2111896def6
ADMIN_PASSWORD: 123123

- name: Sync SvelteKit config
run: yarn svelte-kit sync
working-directory: ./interface

- name: Install Playwright Browsers
run: npx playwright install --with-deps
run: yarn dlx playwright install --with-deps
working-directory: ./interface

- name: Run Playwright tests
run: npx playwright test --project='chromium'
run: yarn dlx playwright test --project=chromium
working-directory: ./interface
env:
PUBLIC_HUFI_BACKEND_URL: "http://localhost:3000"
Expand All @@ -102,7 +125,7 @@ jobs:

- name: Upload Playwright test artifacts
if: always()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: playwright-report
path: ./interface/playwright-report/
Expand Down
28 changes: 26 additions & 2 deletions .github/workflows/servertests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
test:
timeout-minutes: 60
Expand All @@ -14,10 +15,33 @@ jobs:

steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: '18'
node-version: '22.15.0'

- name: Enable Corepack
run: corepack enable

- name: Prepare Yarn 4.9.1
run: corepack prepare yarn@4.9.1 --activate

- name: Cache Yarn
uses: actions/cache@v3
with:
path: |
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-

- name: Install dependencies
run: yarn
run: yarn install --immutable
env:
YARN_ENABLE_HARDENED_MODE: 0

- name: Execute Unit tests
run: yarn test
33 changes: 30 additions & 3 deletions .github/workflows/vitest.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
name: Runs All Unit Tests
name: Runs All interface Unit Tests
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
test:
timeout-minutes: 60
Expand All @@ -14,10 +15,36 @@ jobs:

steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: '18'
node-version: '22.15.0'

- name: Enable Corepack
run: corepack enable

- name: Prepare Yarn 4.9.1
run: corepack prepare yarn@4.9.1 --activate

- name: Cache Yarn
uses: actions/cache@v3
with:
path: |
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-

- name: Install dependencies
run: yarn
run: yarn install --immutable
env:
YARN_ENABLE_HARDENED_MODE: 0

- name: Sync SvelteKit config
run: yarn svelte-kit sync

- name: Execute Unit tests
run: yarn test:unit
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ install-client:

install-server:
@echo "Installing server dependencies..."
@cd server && yarn install || exit 1
@cd server && yarn install --immutable || exit 1
@echo "Server dependencies installed successfully!"
.PHONY: install-server

Expand Down
Binary file added interface/.yarn/install-state.gz
Binary file not shown.
1 change: 1 addition & 0 deletions interface/.yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodeLinker: node-modules
10 changes: 7 additions & 3 deletions interface/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@
"@fontsource/fira-mono": "^4.5.10",
"@fontsource/inter": "^5.0.16",
"@playwright/experimental-ct-svelte": "^1.40.1",
"@playwright/test": "^1.47.2",
"@playwright/test": "^1.55.1",
"@sveltejs/adapter-auto": "^3.0.0",
"@sveltejs/adapter-static": "^3.0.5",
"@sveltejs/kit": "^2.0.0",
"@sveltejs/vite-plugin-svelte": "^3.0.0",
"@types/node": "^20.11.0",
"@types/node": "^24.5.2",
"@types/path-browserify": "^1",
"@types/uuid": "^9.0.8",
"@typescript-eslint/eslint-plugin": "^6.19.1",
"@typescript-eslint/parser": "^6.19.1",
Expand All @@ -38,6 +39,7 @@
"eslint-plugin-svelte": "^2.35.1",
"svelte": "^4.2.7",
"svelte-check": "^3.6.0",
"svelte-eslint-parser": "^1.3.3",
"tslib": "^2.4.1",
"typescript": "^5.3.3",
"vite": "^5.0.3",
Expand All @@ -57,6 +59,7 @@
"lightweight-charts": "^4.1.1",
"moment": "^2.30.1",
"pako": "^2.1.0",
"path-browserify": "^1.0.1",
"postcss": "^8.4.32",
"reconnecting-websocket": "^4.4.0",
"socket.io-client": "^4.7.4",
Expand All @@ -78,5 +81,6 @@
".": {
"svelte": "./dist/index.js"
}
}
},
"packageManager": "yarn@4.9.1"
}
42 changes: 12 additions & 30 deletions interface/playwright.config.ts
Original file line number Diff line number Diff line change
@@ -1,56 +1,38 @@
import { defineConfig, devices } from '@playwright/test';

/**
* Read environment variables from file.
* https://github.com/motdotla/dotenv
*/
// require('dotenv').config();

/**
* See https://playwright.dev/docs/test-configuration.
*/
export default defineConfig({
timeout: 5000,
testDir: './tests',
/* Run tests in files in parallel */
fullyParallel: true,
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!process.env.CI,
/* Retry on CI only */
retries: process.env.CI ? 2 : 0,
/* Opt out of parallel tests on CI. */
workers: process.env.CI ? 1 : undefined,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: 'html',
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */

/* Shared settings for all tests */
use: {
/* Base URL to use in actions like `await page.goto('/')`. */
baseURL: 'http://127.0.0.1:5173',

/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry',
viewport: { width: 390, height: 844 }, // iPhone 14 Pro–like viewport
},

/* Configure projects for major browsers */
projects: [
/* Test against mobile viewports. */
{
name: 'chromium',
use: { ...devices['Galaxy S9+'] },
use: { ...devices['Pixel 5'] }, // ✅ valid device
},
{
name: 'webkit',
use: { ...devices['iPhone 14'] },
use: { ...devices['iPhone 14 Pro'] }, // ✅ valid device
},
],

/* Run your local dev server before starting the tests */
webServer: [
{
command: 'yarn dev',
url: 'http://127.0.0.1:5173',
reuseExistingServer: true,
ignoreHTTPSErrors: true,
},
],
/* Run local dev server before tests */
webServer: {
command: 'yarn dev',
url: 'http://127.0.0.1:5173',
reuseExistingServer: !process.env.CI,
timeout: 240 * 1000, // 4 minutes wait for server startup
},
});
8 changes: 4 additions & 4 deletions interface/tests/grow/arbitrage.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { test, expect } from '@playwright/test';

test.use({
viewport: { width: 390, height: 844 }, // iPhone 14 Pro
});

test.describe('Market making', () => {

test.beforeEach(async ({ page }) => {
await page.goto('http://127.0.0.1:5173/grow');
Expand Down Expand Up @@ -43,4 +42,5 @@ test('create arbitrage', async ({ page }) => {
const newPage2 = await pagePromise2;
await newPage2.waitForLoadState();
expect(newPage2.url()).toContain('https://mixin.one/pay');
})
});
});
8 changes: 3 additions & 5 deletions interface/tests/grow/market-making.spec.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import { test, expect } from '@playwright/test';

test.use({
viewport: { width: 390, height: 844 }, // iPhone 14 Pro
});

test.describe('Market making', () => {
test.beforeEach(async ({ page }) => {
await page.goto('http://127.0.0.1:5173/grow');
})
Expand All @@ -30,4 +27,5 @@ test('create market making', async ({ page }) => {

expect(page.getByTestId(`confirm-btn`)).toBeEnabled();
await page.getByTestId(`confirm-btn`).click();
})
});
});
Loading
Loading