Skip to content

Commit

Permalink
Rewrite action to typescript (#24)
Browse files Browse the repository at this point in the history
* Migrate to compose action

* Migrate to compose action

* Migrate to typescript

* Migrate to typescript

* Migrate to typescript

* Migrate to typescript

* Migrate to typescript

* Added added typescript implementation

* Added added typescript implementation

* Added added typescript implementation

* Fix query typing

* Drop docker code

* Added tests
  • Loading branch information
goruha authored Sep 11, 2024
1 parent 4252b52 commit 062f747
Show file tree
Hide file tree
Showing 39 changed files with 43,734 additions and 56 deletions.
4 changes: 4 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
lib/
dist/
node_modules/
coverage/
67 changes: 67 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
"plugins": ["jest", "@typescript-eslint"],
"extends": [
"plugin:github/recommended",
"plugin:import/errors",
"plugin:import/warnings",
"plugin:import/typescript"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 9,
"sourceType": "module",
"project": ["./tsconfig.json", "./__tests__/tsconfig.json"]
},
"rules": {
"i18n-text/no-en": "off",
"eslint-comments/no-use": "off",
"import/no-namespace": "off",
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/explicit-member-accessibility": ["error", {"accessibility": "no-public"}],
"@typescript-eslint/no-require-imports": "error",
"@typescript-eslint/array-type": "error",
"@typescript-eslint/await-thenable": "error",
"@typescript-eslint/ban-ts-comment": "error",
"camelcase": "off",
"@typescript-eslint/consistent-type-assertions": "error",
"@typescript-eslint/explicit-function-return-type": ["error", {"allowExpressions": true}],
"@typescript-eslint/func-call-spacing": ["error", "never"],
"@typescript-eslint/no-array-constructor": "error",
"@typescript-eslint/no-empty-interface": "error",
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-extraneous-class": "error",
"@typescript-eslint/no-for-in-array": "error",
"@typescript-eslint/no-inferrable-types": "error",
"@typescript-eslint/no-misused-new": "error",
"@typescript-eslint/no-namespace": "error",
"@typescript-eslint/no-non-null-assertion": "warn",
"@typescript-eslint/no-unnecessary-qualifier": "error",
"@typescript-eslint/no-unnecessary-type-assertion": "error",
"@typescript-eslint/no-useless-constructor": "error",
"@typescript-eslint/no-var-requires": "error",
"@typescript-eslint/prefer-for-of": "warn",
"@typescript-eslint/prefer-function-type": "warn",
"@typescript-eslint/prefer-includes": "error",
"@typescript-eslint/prefer-string-starts-ends-with": "error",
"@typescript-eslint/promise-function-async": "error",
"@typescript-eslint/require-array-sort-compare": "error",
"@typescript-eslint/restrict-plus-operands": "error",
"semi": "off",
"@typescript-eslint/semi": ["error", "never"],
"@typescript-eslint/type-annotation-spacing": "error",
"@typescript-eslint/unbound-method": "error"
},
"env": {
"node": true,
"es6": true
},
"settings": {
"import/resolver": {
"node": {
"extensions": [".js", ".jsx", ".ts", ".tsx"],
"moduleDirectory": ["node_modules", "src/"]
}
}
}
}
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* text=auto eol=lf

dist/** -diff linguist-generated=true
Binary file added .github/banner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions .github/codeql/codeql-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
name: "CodeQL config"

paths-ignore:
- dist

11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly

- package-ecosystem: npm
directory: /
schedule:
interval: weekly
1 change: 1 addition & 0 deletions .github/mergify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
extends: .github
36 changes: 36 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: build-and-test
on:
pull_request:
branches:
- main
types: [opened, synchronize, reopened]
push:
branches:
- main

jobs:
check-dist:
name: "check-dist matches source"
uses: cloudposse/github-actions-workflows/.github/workflows/ci-typescript-app-check-dist.yml@main
with:
node-version: 20.x

unit-test:
name: "unit tests"
runs-on: ubuntu-latest
needs: check-dist
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}

- uses: actions/setup-node@v4
with:
node-version-file: package.json
cache: yarn

- name: install dependencies
run: yarn add ci

- name: run unit tests
run: yarn test
73 changes: 73 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ "master" ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "master" ]
schedule:
- cron: '32 8 * * 6'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'javascript' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

steps:
- name: Checkout repository
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
config-file: ./.github/codeql/codeql-config.yml
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality


# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
10 changes: 10 additions & 0 deletions .github/workflows/test-multiline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version-file: package.json
cache: yarn

- name: install dependencies
run: |-
yarn add ci
yarn build
- uses: ./
id: current
with:
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/test-negative.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version-file: package.json
cache: yarn

- name: install dependencies
run: |-
yarn add ci
yarn build
- uses: ./
id: current
with:
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/test-positive.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version-file: package.json
cache: yarn

- name: install dependencies
run: |-
yarn add ci
yarn build
- uses: ./
id: current
with:
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/test-query-1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version-file: package.json
cache: yarn

- name: install dependencies
run: |-
yarn add ci
yarn build
- uses: ./
id: current
with:
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/test-query-2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version-file: package.json
cache: yarn

- name: install dependencies
run: |-
yarn add ci
yarn build
- uses: ./
id: current
with:
Expand Down
12 changes: 11 additions & 1 deletion .github/workflows/test-query-3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,20 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version-file: package.json
cache: yarn

- name: install dependencies
run: |-
yarn add ci
yarn build
- uses: ./
id: current
with:
query: .false
query: ."false"
config: |
true:
mask: ". + {}"
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/test-structure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version-file: package.json
cache: yarn

- name: install dependencies
run: |-
yarn add ci
yarn build
- uses: ./
id: current
with:
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/test-wrong-yaml-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version-file: package.json
cache: yarn

- name: install dependencies
run: |-
yarn add ci
yarn build
- uses: ./
id: current
with:
Expand Down
Loading

0 comments on commit 062f747

Please sign in to comment.