Skip to content

Commit 9ab56dd

Browse files
shanejonasBelfordZ
authored andcommitted
fix: add initial workflow and tests
1 parent aa96afe commit 9ab56dd

File tree

6 files changed

+7739
-2995
lines changed

6 files changed

+7739
-2995
lines changed

.github/workflows/ci.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Node CI Workflow
2+
#
3+
# The parameters are defaulted at the org level but can be overridden on the repository.
4+
# See the github-automation repo for more documentation
5+
#
6+
on:
7+
push:
8+
branches:
9+
- dev
10+
- main
11+
pull_request:
12+
branches:
13+
- dev
14+
- main
15+
issue_comment:
16+
types: [created]
17+
workflow_dispatch:
18+
inputs:
19+
workflowBranch:
20+
description: "Branch of the reusable workflow. Defaults to main, select dev for testing only."
21+
required: true
22+
default: "main"
23+
type: choice
24+
options:
25+
- dev
26+
- main
27+
jobs:
28+
echo-inputs:
29+
name: Repo Workflow Debugging
30+
runs-on: ubuntu-latest
31+
steps:
32+
- name: Check Repo Vars
33+
run: |
34+
echo "*** Start - Check inputs in repo workflow ***"
35+
echo "Node Version: ${{ vars.NODE_VERSION }}"
36+
echo "Lint Required: ${{ vars.IS_LINT_REQUIRED }}"
37+
echo "Format Check Required: ${{ vars.IS_FORMAT_CHECK_REQUIRED }}"
38+
echo "Apply Patches Required: ${{ vars.IS_APPLY_PATCHES_REQUIRED }}"
39+
echo "Unit Tests Required: ${{ vars.IS_UNIT_TESTS_REQUIRED }}"
40+
echo "*** End - Check inputs in repo workflow ***"
41+
ci-test-only:
42+
if: ${{ github.event.inputs.workflowBranch == 'dev' }}
43+
uses: shardeum/github-automation/.github/workflows/reusable-node-ci.yml@dev
44+
permissions:
45+
issues: write
46+
pull-requests: write
47+
contents: write
48+
with:
49+
node-version: ${{ vars.NODE_VERSION }}
50+
lint-required: ${{ vars.IS_LINT_REQUIRED == 'true' }}
51+
format-check-required: ${{ vars.IS_FORMAT_CHECK_REQUIRED == 'true' }}
52+
apply-patches-required: ${{ vars.IS_APPLY_PATCHES_REQUIRED == 'true' }}
53+
unit-tests-required: ${{ vars.IS_UNIT_TESTS_REQUIRED == 'true' }}
54+
secrets: inherit
55+
56+
ci:
57+
if: ${{ github.event.inputs.workflowBranch == 'main' || !github.event.inputs.workflowBranch }}
58+
uses: shardeum/github-automation/.github/workflows/reusable-node-ci.yml@main
59+
permissions:
60+
issues: write
61+
pull-requests: write
62+
contents: write
63+
with:
64+
node-version: ${{ vars.NODE_VERSION }}
65+
lint-required: ${{ vars.IS_LINT_REQUIRED == 'true' }}
66+
format-check-required: ${{ vars.IS_FORMAT_CHECK_REQUIRED == 'true' }}
67+
apply-patches-required: ${{ vars.IS_APPLY_PATCHES_REQUIRED == 'true' }}
68+
unit-tests-required: ${{ vars.IS_UNIT_TESTS_REQUIRED == 'true' }}
69+
secrets: inherit

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
node_modules/
1+
node_modules/
2+
coverage/
3+
.env

jest.config.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
module.exports = {
2+
testEnvironment: 'node',
3+
testMatch: ['**/__tests__/**/*.js', '**/?(*.)+(spec|test).js'],
4+
testPathIgnorePatterns: ['/node_modules/', './test.js'],
5+
collectCoverage: true,
6+
coverageDirectory: 'coverage',
7+
coverageReporters: ['json', 'lcov', 'text', 'json-summary'],
8+
verbose: true,
9+
testTimeout: 10000, // Increased timeout for async operations
10+
};

0 commit comments

Comments
 (0)