Adds Lint & Style Workflows
This commit is contained in:
parent
a331ab608d
commit
2b50b29db2
59
.gitea/workflows/run-lint.yaml
Normal file
59
.gitea/workflows/run-lint.yaml
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
name: Run Code Linter
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: '*'
|
||||||
|
pull_request:
|
||||||
|
branches: '*'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
biome:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: refringe/spt-build-node:1.0.7
|
||||||
|
steps:
|
||||||
|
- name: Clone
|
||||||
|
run: |
|
||||||
|
rm -rf /workspace/SPT-AKI/Build/server
|
||||||
|
git clone https://dev.sp-tarkov.com/SPT-AKI/Server.git --branch master /workspace/SPT-AKI/Build/server
|
||||||
|
|
||||||
|
cd /workspace/SPT-AKI/Build/server
|
||||||
|
git checkout ${GITHUB_SHA}
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
- name: Pull LFS Files
|
||||||
|
run: |
|
||||||
|
cd /workspace/SPT-AKI/Build/server
|
||||||
|
git lfs pull
|
||||||
|
git lfs ls-files
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
- name: Cache NPM Dependencies
|
||||||
|
id: cache-npm-dependencies
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: /workspace/SPT-AKI/Build/server/project/node_modules
|
||||||
|
key: npm-dependencies-${{ hashFiles('/workspace/SPT-AKI/Build/server/project/package.json') }}
|
||||||
|
|
||||||
|
- name: Install NPM Dependencies
|
||||||
|
if: steps.cache-npm-dependencies.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
cd /workspace/SPT-AKI/Build/server/project
|
||||||
|
rm -rf node_modules
|
||||||
|
npm install
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
- name: Run Linter
|
||||||
|
id: run-tests
|
||||||
|
run: |
|
||||||
|
cd /workspace/SPT-AKI/Build/server/project
|
||||||
|
npm run lint
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
- name: Fix Instructions
|
||||||
|
if: failure() && steps.run-tests.outcome == 'failure'
|
||||||
|
run: |
|
||||||
|
echo "Code linting has failed. The linter has been configured to look for coding errors, defects, and questionable constructs. Please look into resolving these errors.\n\n"
|
||||||
|
echo "The linter may be able to resolve some of these issues automatically. You can launch the automatic fixer by running the following command from within the `project` directory. Anything not resolved by running this command must be resolved manually.\n`npm run lint:fix`\n\n"
|
||||||
|
echo "Consistency is professionalism.™"
|
||||||
|
shell: bash
|
60
.gitea/workflows/run-style.yaml
Normal file
60
.gitea/workflows/run-style.yaml
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
name: Check Code Style
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: '*'
|
||||||
|
pull_request:
|
||||||
|
branches: '*'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
dprint:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: refringe/spt-build-node:1.0.7
|
||||||
|
steps:
|
||||||
|
- name: Clone
|
||||||
|
run: |
|
||||||
|
rm -rf /workspace/SPT-AKI/Build/server
|
||||||
|
git clone https://dev.sp-tarkov.com/SPT-AKI/Server.git --branch master /workspace/SPT-AKI/Build/server
|
||||||
|
|
||||||
|
cd /workspace/SPT-AKI/Build/server
|
||||||
|
git checkout ${GITHUB_SHA}
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
- name: Pull LFS Files
|
||||||
|
run: |
|
||||||
|
cd /workspace/SPT-AKI/Build/server
|
||||||
|
git lfs pull
|
||||||
|
git lfs ls-files
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
- name: Cache NPM Dependencies
|
||||||
|
id: cache-npm-dependencies
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: /workspace/SPT-AKI/Build/server/project/node_modules
|
||||||
|
key: npm-dependencies-${{ hashFiles('/workspace/SPT-AKI/Build/server/project/package.json') }}
|
||||||
|
|
||||||
|
- name: Install NPM Dependencies
|
||||||
|
if: steps.cache-npm-dependencies.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
cd /workspace/SPT-AKI/Build/server/project
|
||||||
|
rm -rf node_modules
|
||||||
|
npm install
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
- name: Check Code Style
|
||||||
|
id: check-code-style
|
||||||
|
run: |
|
||||||
|
cd /workspace/SPT-AKI/Build/server/project
|
||||||
|
npm run style
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
- name: Fix Instructions
|
||||||
|
if: failure() && steps.check-code-style.outcome == 'failure'
|
||||||
|
run: |
|
||||||
|
echo "The code style check has failed. To fix this, please ensure your code adheres to the project's style guidelines.\n\n"
|
||||||
|
echo "You can automatically format the project code by running the following command from within the `project` directory.\n`npm run style:fix`\n\n"
|
||||||
|
echo "To automatically format code on-save in your IDE, please install the recommended VSCode plugins listed within the `project/Server.code-workspace` file."
|
||||||
|
echo "Thank you for keeping our house clean. ♥"
|
||||||
|
shell: bash
|
@ -44,7 +44,16 @@ jobs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
- name: Run Tests
|
- name: Run Tests
|
||||||
|
id: run-tests
|
||||||
run: |
|
run: |
|
||||||
cd /workspace/SPT-AKI/Build/server/project
|
cd /workspace/SPT-AKI/Build/server/project
|
||||||
npm run test
|
npm run test
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
|
- name: Fix Instructions
|
||||||
|
if: failure() && steps.run-tests.outcome == 'failure'
|
||||||
|
run: |
|
||||||
|
echo "Automated tests have failed. This could point to an issue with the commited code, or an updated test that has yet to be updated. Please look into resolving these test failures.\n\n"
|
||||||
|
echo "The testing suite has a GUI to aid in writing tests. You can launch this by running the following command from within the `project` directory.\n`npm run test:ui`\n\n"
|
||||||
|
echo "A test written today is a bug prevented tomorrow.™"
|
||||||
|
shell: bash
|
Loading…
Reference in New Issue
Block a user