Skip to content

Commit 80ea22a

Browse files
authored
feat: Add CI/CD (#26)
1 parent a82399a commit 80ea22a

File tree

4 files changed

+44
-2
lines changed

4 files changed

+44
-2
lines changed

.github/workflows/publish.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Publish
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
npm-tag:
7+
description: 'NPM tag to publish the package (e.g., latest, beta, etc.)'
8+
required: false
9+
default: 'latest'
10+
type: string
11+
dry-run:
12+
description: 'Perform a dry run (true/false)'
13+
required: false
14+
default: false
15+
type: boolean
16+
17+
jobs:
18+
publish:
19+
uses: WJSoftware/cicd/.github/workflows/[email protected]
20+
with:
21+
node-version: 24
22+
build-script: build
23+
test-script: test
24+
npm-tag: ${{ inputs.npm-tag || 'latest' }}
25+
dry-run: ${{ inputs.dry-run || false }}
26+
secrets: inherit

.github/workflows/test.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Unit Testing
2+
3+
on:
4+
pull_request:
5+
branches: [ main ]
6+
7+
jobs:
8+
test:
9+
uses: WJSoftware/cicd/.github/workflows/[email protected]
10+
with:
11+
node-version: 24
12+
build-script: build
13+
test-script: test
14+
build: true

tests/ut/sync/AutoResetEvent.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { expect } from 'chai';
33
import { sinon } from '../../setup.js';
44
import { AutoResetEvent } from '../../../src/sync/AutoResetEvent.js';
55
import { autoResetEventIdentityData } from '../../../src/sync/identifiers.js';
6-
import { testAutoResetEventWaitInWorker } from '../helpers/helpers.js';
6+
import { delay, testAutoResetEventWaitInWorker } from '../helpers/helpers.js';
77
import { ManualResetEvent } from '../../../src/sync/ManualResetEvent.js';
88

99
describe('AutoResetEvent', () => {
@@ -87,6 +87,7 @@ describe('AutoResetEvent', () => {
8787
it('Should wait and succeed when signal becomes available.', async () => {
8888
const waitComplete = (await testAutoResetEventWaitInWorker(eventObj.token, 1000)).wait;
8989

90+
await delay(50); // Ensure the worker is waiting
9091
eventObj.signal();
9192

9293
const result = await waitComplete;

tests/ut/sync/ManualResetEvent.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { describe, it, beforeEach } from 'mocha';
22
import { expect } from 'chai';
33
import { sinon } from '../../setup.js';
44
import { ManualResetEvent } from '../../../src/sync/ManualResetEvent.js';
5-
import { testManualResetEventWaitInWorker, tokenTypeTest } from '../helpers/helpers.js';
5+
import { delay, testManualResetEventWaitInWorker, tokenTypeTest } from '../helpers/helpers.js';
66
import { manualResetEventIdentityData } from '../../../src/sync/identifiers.js';
77
import { AutoResetEvent } from '../../../src/sync/AutoResetEvent.js';
88

@@ -80,6 +80,7 @@ describe('ManualResetEvent', () => {
8080
it('Should wait and succeed when signal becomes available.', async () => {
8181
const waitComplete = (await testManualResetEventWaitInWorker(eventObj.token, 1000)).wait;
8282

83+
await delay(50); // Ensure the worker is waiting
8384
eventObj.signal();
8485

8586
const result = await waitComplete;

0 commit comments

Comments
 (0)