Updates Actions #1
Workflow file for this run
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
name: Run Tests | ||
on: | ||
push: | ||
branches: ["*"] | ||
pull_request: | ||
branches: ["*"] | ||
jobs: | ||
vitest: | ||
runs-on: ubuntu-latest | ||
if: > | ||
Check failure on line 12 in .github/workflows/run-test.yaml GitHub Actions / Run TestsInvalid workflow file
|
||
# Conditional to limit runs: 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: | ||
- name: Clone | ||
run: | | ||
# For pull request events, checkout using GITHUB_SHA | ||
# For push events, checkout using GITHUB_REF_NAME | ||
if [[ $GITHUB_EVENT_NAME == "pull_request" ]]; then | ||
REF=${GITHUB_SHA} | ||
else | ||
REF=${GITHUB_REF_NAME} | ||
fi | ||
rm -rf /workspace/SPT/Server/current | ||
git clone https://dev.sp-tarkov.com/${{ github.repository }}.git /workspace/SPT/Server/current | ||
cd /workspace/SPT/Server/current | ||
git fetch | ||
git checkout $REF | ||
env: | ||
GITHUB_SHA: ${{ github.sha }} | ||
GITHUB_REF_NAME: ${{ github.ref_name }} | ||
GITHUB_EVENT_NAME: ${{ github.event_name }} | ||
shell: bash | ||
- name: Pull LFS Files | ||
run: | | ||
cd /workspace/SPT/Server/current && ls -lah | ||
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/Server/current/project/node_modules | ||
key: npm-dependencies-${{ hashFiles('/workspace/SPT/Server/current/project/package.json') }} | ||
- name: Install NPM Dependencies | ||
if: steps.cache-npm-dependencies.outputs.cache-hit != 'true' | ||
run: | | ||
cd /workspace/SPT/Server/current/project | ||
rm -rf /workspace/SPT/Server/current/project/node_modules | ||
npm install | ||
shell: bash | ||
- name: Run Tests | ||
id: run-tests | ||
run: | | ||
cd /workspace/SPT/Server/current/project | ||
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 |