mirror of
https://github.com/smogon/pokemon-showdown.git
synced 2026-04-25 15:40:31 -05:00
Github Actions: Perform selective eslint & testing for PRs (#9506)
This commit is contained in:
parent
6a04694a20
commit
3901e11b8b
35
.github/workflows/test.yml
vendored
35
.github/workflows/test.yml
vendored
|
|
@ -21,12 +21,45 @@ jobs:
|
|||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
cache: 'npm'
|
||||
|
||||
- run: npm ci
|
||||
- run: npm run full-test
|
||||
|
||||
- name: Determine which files to lint (if pull request)
|
||||
if: ${{ github.event_name == 'pull_request' }}
|
||||
id: changed-files
|
||||
uses: tj-actions/changed-files@v35
|
||||
with:
|
||||
files: |
|
||||
**/*.js
|
||||
**/*.ts
|
||||
**/*.tsx
|
||||
|
||||
- name: Determine whether test/sim or test/random-battles need to run (if pull request)
|
||||
if: ${{ github.event_name == 'pull_request' }}
|
||||
id: changed-directories
|
||||
uses: tj-actions/changed-files@v35
|
||||
with:
|
||||
files: |
|
||||
config/formats.ts
|
||||
data/**
|
||||
sim/**
|
||||
|
||||
- name: Run selective lint & neccessary tests (if pull request)
|
||||
if: ${{ github.event_name == 'pull_request' }}
|
||||
run: npm run full-test-ci
|
||||
env:
|
||||
CI: true
|
||||
FILES: ${{ steps.changed-files.outputs.all_changed_and_modified_files }}
|
||||
SKIPSIMTESTS: ${{ steps.changed-directories.outputs.all_changed_and_modified_files == '' }}
|
||||
|
||||
- name: Run full lint & test (if push to master)
|
||||
run: npm run full-test
|
||||
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
|
||||
env:
|
||||
CI: true
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@
|
|||
"test": "mocha",
|
||||
"posttest": "npm run tsc",
|
||||
"full-test": "npm run lint && npm run tsc && mocha --timeout 8000 --forbid-only -g \".*\"",
|
||||
"full-test-ci": "eslint ${FILES} --max-warnings 0 && npm run tsc && (([ \"$SKIPSIMTESTS\" = true ] && mocha --timeout 8000 --forbid-only -g \".*\" --exclude \"test/{sim,random-battles}/**\") || mocha --timeout 8000 --forbid-only -g \".*\")",
|
||||
"postinstall": "npm run build postinstall"
|
||||
},
|
||||
"bin": "./pokemon-showdown",
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user