Skip to content
Open
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
40 changes: 33 additions & 7 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
module.exports = {
module.exports={
env: {
browser: true,
node: true,
jest: true
jest: true,
es2020: true
},
plugins: ['jest', '@typescript-eslint'],
overrides: [
{
files: ['*.ts', '*.tsx'], // Apply these settings only to TypeScript files
parser: '@typescript-eslint/parser',
files: ['*.ts', '*.tsx'],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaFeatures: {
experimentalObjectRestSpread: true
Expand All @@ -19,11 +20,36 @@ module.exports = {
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended'
]
],
rules: {
'@typescript-eslint/no-empty-object-type': [
'error',
{
allowObjectTypes: 'always'
}
]
}
},
{
files: ['*.js'], // Apply these settings only to JavaScript files
extends: ['standard', 'eslint:recommended']
files: ['*.js'],
extends: ['eslint:recommended'],
parserOptions: {
ecmaVersion: 2020,
sourceType: 'module'
}
},
{
files: [
'**/tests/**/*.js',
'**/mocks/**/*.js',
'**/__mocks__/**/*.js'
],
rules: {
'no-unused-vars': ['error', {
argsIgnorePattern: '^_',
varsIgnorePattern: '^_'
}]
}
}
],
settings: {
Expand Down
44 changes: 37 additions & 7 deletions .github/workflows/check-tests.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
name: Check tests

on:

push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:

jobs:
install-and-build:
Expand All @@ -28,7 +30,7 @@ jobs:


- name: Install dependencies
run: npm ci
run: npm ci --prefer-offline --no-audit


- name: Lint SDK Only
Expand All @@ -40,12 +42,13 @@ jobs:
timeout-minutes: 10

- name: Build documentation
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: npx nx affected -t build-docs
timeout-minutes: 5


- name: Cache dependencies and build artifacts
uses: actions/cache/save@v3
uses: actions/cache/save@v4
with:
path: |
node_modules
Expand Down Expand Up @@ -74,13 +77,21 @@ jobs:


- name: Restore dependencies and build artifacts
uses: actions/cache/restore@v3
id: cache-restore
uses: actions/cache/restore@v4
with:
path: |
node_modules
dist
.nx/cache
key: ${{ runner.os }}-build-${{ github.sha }}
restore-keys: |
${{ runner.os }}-build-


- name: Install dependencies (if cache miss)
if: steps.cache-restore.outputs.cache-hit != 'true'
run: npm ci --prefer-offline --no-audit


- name: Run Unit Tests
Expand All @@ -89,8 +100,13 @@ jobs:
e2e-tests:
needs: install-and-build
runs-on: ubuntu-latest
steps:
strategy:
matrix:
test-file:

- 'FunctionalPublish.steps.js'
- 'Puppeteer.steps.js'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
Expand All @@ -107,19 +123,33 @@ jobs:


- name: Restore dependencies and build artifacts
uses: actions/cache/restore@v3
id: cache-restore
uses: actions/cache/restore@v4
with:
path: |
node_modules
dist
.nx/cache
key: ${{ runner.os }}-build-${{ github.sha }}
restore-keys: |
${{ runner.os }}-build-

- name: Install dependencies (if cache miss)
if: steps.cache-restore.outputs.cache-hit != 'true'
run: npm ci --prefer-offline --no-audit

- name: Cache Puppeteer Browsers
uses: actions/cache@v4
with:
path: ~/.cache/puppeteer
key: ${{ runner.os }}-puppeteer-${{ hashFiles('package-lock.json') }}
restore-keys: |
${{ runner.os }}-puppeteer-

- name: Install Puppeteer Chrome
run: npx -y puppeteer browsers install chrome

- name: Run E2E Tests
run: npm run test-e2e
run: npm run test-e2e -- --testPathPattern=${{ matrix.test-file }}
env:
ACCOUNT_ID: ${{ vars.PUBLISHER_DEMO_ACC_ID }}
PUBLISH_TOKEN: ${{ secrets.PUBLISHER_DEMO_TOKEN }}
2 changes: 2 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ESLINT_USE_FLAT_CONFIG=false npx lint-staged

10 changes: 10 additions & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

# Run unit tests
echo "Running unit tests..."
npm run test-unit

# Run signature check
echo "Checking commit signatures..."
./check-signature.sh
Loading
Loading