Workflow: Tests the checkout action

This commit is contained in:
Refringe 2024-04-24 23:31:39 -04:00
parent d8504950f2
commit cfdea7d325
No known key found for this signature in database
GPG Key ID: 7715B85B4A6306ED

View File

@ -9,50 +9,42 @@ on:
jobs: jobs:
vitest: vitest:
runs-on: ubuntu-latest runs-on: ubuntu-latest
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: container:
image: refringe/spt-build-node:1.0.7 image: refringe/spt-build-node:1.0.7
steps: 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 - name: Checkout Repository
git checkout ${GITHUB_SHA} uses: actions/checkout@v3
shell: bash with:
lfs: true
github-server-url: 'https://dev.sp-tarkov.com'
- name: Pull LFS Files - name: Cache NPM Dependencies
run: | id: cache-npm-dependencies
cd /workspace/SPT-AKI/Build/server uses: actions/cache@v4
git lfs pull with:
git lfs ls-files path: project/node_modules
shell: bash key: npm-dependencies-${{ hashFiles('project/package.json') }}
- name: Cache NPM Dependencies - name: Install NPM Dependencies
id: cache-npm-dependencies if: steps.cache-npm-dependencies.outputs.cache-hit != 'true'
uses: actions/cache@v4 run: |
with: rm -rf project/node_modules
path: /workspace/SPT-AKI/Build/server/project/node_modules npm install
key: npm-dependencies-${{ hashFiles('/workspace/SPT-AKI/Build/server/project/package.json') }} shell: bash
- name: Install NPM Dependencies - name: Run Tests
if: steps.cache-npm-dependencies.outputs.cache-hit != 'true' id: run-tests
run: | run: |
cd /workspace/SPT-AKI/Build/server/project npm run test
rm -rf node_modules shell: bash
npm install
shell: bash
- name: Run Tests - name: Fix Instructions
id: run-tests if: failure() && steps.run-tests.outcome == 'failure'
run: | run: |
cd /workspace/SPT-AKI/Build/server/project 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"
npm run test echo -e "A test written today is a bug prevented tomorrow.™"
shell: bash 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 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"
echo -e "A test written today is a bug prevented tomorrow.™"
shell: bash