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

51 lines
1.6 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
2024-04-25 05:31:39 +02:00
if: > # Conditional to limit runs: it checks if it's NOT a push to a branch with an open PR
github.event_name == 'push' ||
github.event.pull_request.head.repo.full_name != github.repository
container:
image: refringe/spt-build-node:1.0.7
steps:
2024-04-25 05:31:39 +02:00
- name: Checkout Repository
uses: actions/checkout@v3
with:
lfs: true
github-server-url: 'https://dev.sp-tarkov.com'
- name: Cache NPM Dependencies
id: cache-npm-dependencies
uses: actions/cache@v4
with:
path: project/node_modules
key: npm-dependencies-${{ hashFiles('project/package.json') }}
- name: Install NPM Dependencies
if: steps.cache-npm-dependencies.outputs.cache-hit != 'true'
run: |
rm -rf project/node_modules
npm install
shell: bash
- name: Run Tests
id: run-tests
run: |
npm run test
shell: bash
- name: Fix Instructions
if: failure() && steps.run-tests.outcome == 'failure'
run: |
echo -e "Automated tests have failed. This could point to an issue with the committed 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"
echo -e "A test written today is a bug prevented tomorrow.™"
shell: bash