Server/.gitea/workflows/run-test.yaml

59 lines
1.8 KiB
YAML
Raw Normal View History

name: Run Tests
on:
push:
branches: '*'
pull_request:
branches: '*'
jobs:
2024-04-11 00:42:58 +02:00
vitest:
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/${GITHUB_REPOSITORY}.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
2024-04-11 00:42:58 +02:00
- 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
2024-04-11 00:42:58 +02:00
if: steps.cache-npm-dependencies.outputs.cache-hit != 'true'
run: |
cd /workspace/SPT-AKI/Build/server/project
2024-04-11 00:42:58 +02:00
rm -rf node_modules
npm install
shell: bash
- name: Run Tests
2024-04-11 01:29:20 +02:00
id: run-tests
run: |
cd /workspace/SPT-AKI/Build/server/project
npm run test
shell: bash
2024-04-11 01:29:20 +02:00
- name: Fix Instructions
if: failure() && steps.run-tests.outcome == 'failure'
run: |
2024-04-11 01:56:01 +02:00
echo -e "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. 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\nnpm run test:ui\n"
2024-04-11 01:47:11 +02:00
echo -e "A test written today is a bug prevented tomorrow.™"
2024-04-11 01:29:20 +02:00
shell: bash