diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..4597d44 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,77 @@ +name: Node CI Workflow +# +# The parameters are defaulted at the org level but can be overridden on the repository. +# See the github-automation repo for more documentation +# +on: + push: + branches: + - dev + - main + pull_request: + branches: + - dev + - main + issue_comment: + inputs: + workflowBranch: + description: 'Branch of the reusable workflow. Defaults to main, select dev for testing only.' + required: true + default: 'main' + type: choice + options: + - dev + - main + workflow_dispatch: + inputs: + workflowBranch: + description: 'Branch of the reusable workflow. Defaults to main, select dev for testing only.' + required: true + default: 'main' + type: choice + options: + - dev + - main +jobs: + echo-inputs: + name: Repo Workflow Debugging + runs-on: ubuntu-latest + steps: + - name: Check Repo Vars + run: | + echo "*** Start - Check inputs in repo workflow ***" + echo "Node Version: ${{ vars.NODE_VERSION }}" + echo "Lint Required: ${{ vars.IS_LINT_REQUIRED }}" + echo "Format Check Required: ${{ vars.IS_FORMAT_CHECK_REQUIRED }}" + echo "Apply Patches Required: ${{ vars.IS_APPLY_PATCHES_REQUIRED }}" + echo "Unit Tests Required: ${{ vars.IS_UNIT_TESTS_REQUIRED }}" + echo "*** End - Check inputs in repo workflow ***" + ci-test-only: + if: ${{ github.event.inputs.workflowBranch == 'dev' }} + uses: shardeum/github-automation/.github/workflows/reusable-node-ci.yml@dev + permissions: + issues: write + pull-requests: write + contents: write + with: + node-version: ${{ vars.NODE_VERSION }} + lint-required: ${{ vars.IS_LINT_REQUIRED == 'true' }} + format-check-required: ${{ vars.IS_FORMAT_CHECK_REQUIRED == 'true' }} + apply-patches-required: ${{ vars.IS_APPLY_PATCHES_REQUIRED == 'true' }} + unit-tests-required: ${{ vars.IS_UNIT_TESTS_REQUIRED == 'true' }} + secrets: inherit + + ci: + if: ${{ github.event.inputs.workflowBranch == 'main' || !github.event.inputs.workflowBranch }} + uses: shardeum/github-automation/.github/workflows/reusable-node-ci.yml@main + permissions: + issues: write + pull-requests: write + contents: write + with: + node-version: ${{ vars.NODE_VERSION }} + lint-required: ${{ vars.IS_LINT_REQUIRED == 'true' }} + format-check-required: ${{ vars.IS_FORMAT_CHECK_REQUIRED == 'true' }} + apply-patches-required: ${{ vars.IS_APPLY_PATCHES_REQUIRED == 'true' }} + unit-tests-required: ${{ vars.IS_UNIT_TESTS_REQUIRED == 'true' }} + secrets: inherit diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index 0337b23..0000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,45 +0,0 @@ -include: - - remote: 'https://gitlab.com/pod_security/shared-ci/-/raw/main/security.yml' - -image: 'registry.gitlab.com/shardus/dev-container' - -before_script: - - node -v - -stages: - - build - - appsec - -build-job: - cache: - paths: - - node_modules/ - stage: build - script: - - echo "Compiling the code..." - - npm install - - npm run test - - npm run compile - - echo "Compile complete." - -lint-checker-job: - cache: - paths: - - node_modules/ - stage: build - script: - - echo "Running ESlint..." - - npm install @typescript-eslint/eslint-plugin@5.48.0 --save-dev - - npm run lint - - echo "Running ESlint complete." - -format-checker-job: - cache: - paths: - - node_modules/ - stage: build - script: - - echo "Running Prettier..." - - npm install prettier --save-dev - - npm run format-check - - echo "Running Prettier complete." diff --git a/CODEOWNERS b/CODEOWNERS new file mode 100644 index 0000000..200b737 --- /dev/null +++ b/CODEOWNERS @@ -0,0 +1,13 @@ +# CODEOWNERS file +# To add additional teams to any approval, include them on the same line separated by spaces +# It is best practice to assign a team as a code owner and not an invidual. +# Please submit requests for new teams to Systems and Automation + +# Global approval (all files) +# * @shardeum/team-name + +# Directory-level approval +/.github/ @shardeum/systems-and-automation + +# Specific file rules +# README.md @shardeum/team-name diff --git a/package.json b/package.json index 40409be..d7e910b 100644 --- a/package.json +++ b/package.json @@ -10,9 +10,9 @@ "test": "test" }, "scripts": { - "lint": "eslint './src/**/*.ts'", - "lint-windows": "eslint ./src/**/*.ts", + "lint": "eslint \"./src/**/*.ts\"", "format-check": "prettier --check './src/**/*.ts'", + "format-fix": "prettier --write './src/**/*.ts'", "prepare": "npm run compile", "prepublish": "npm run compile", "pretest": "npm run compile",