-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: added 'build' and 'lint' workflow files
- Loading branch information
shadowplay1
committed
Oct 29, 2023
1 parent
f3e2ae9
commit bdebeea
Showing
5 changed files
with
77 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: Build the package | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
types: [opened, reopened] | ||
push: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 | ||
|
||
- name: Install dependencies | ||
run: npm ci | ||
|
||
- name: Build the package | ||
run: npm run build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
name: Build the package | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
types: [opened, reopened] | ||
push: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 | ||
|
||
- name: Build the package | ||
run: bash ./scripts/lint.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,9 @@ | |
# ci/cd | ||
.github/ | ||
|
||
# bash scripts | ||
scripts/ | ||
|
||
# dependencies | ||
node_modules/ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,8 +8,8 @@ | |
"test": "ts-node ./utils/test.ts", | ||
"build": "npx tsc", | ||
"postinstall": "node postinstall.js", | ||
"lint": "eslint ./", | ||
"lint:fix": "eslint ./ --fix" | ||
"lint": "bash ./scripts/lint.sh", | ||
"lint:fix": "bash ./scripts/lint.sh --fix" | ||
}, | ||
"author": "shadowplay1 <[email protected]>", | ||
"license": "MIT", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/bin/bash | ||
|
||
output="" | ||
|
||
|
||
lint() { | ||
if [[ $1 == '--fix' ]]; then | ||
echo 'Fixing all the fixable linting issues...' | ||
echo | ||
|
||
eslint ./src --fix & output=$(eslint ./src --fix) | ||
else | ||
echo 'Checking the code for linting issues...' | ||
echo | ||
|
||
eslint ./src & output=$(eslint ./src) | ||
fi | ||
} | ||
|
||
|
||
lint $1 | ||
|
||
if [ -n "$output" ]; then | ||
echo 'Linting check failed.' | ||
exit 1 | ||
else | ||
echo 'Linting check passed!' | ||
exit 0 | ||
fi |