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 pull request | |
on: | |
push: | |
branches: | |
- master | |
paths-ignore: | |
- '.lib/**' | |
- '.husky/**' | |
- '.eslintrc' | |
- '.gitignore' | |
- '.travis.yml' | |
- 'Makefile' | |
- 'README.md' | |
- 'fields.json' | |
- 'mime.json' | |
- 'rid.json' | |
- 'rtype.json' | |
pull_request: | |
branches: | |
- '*' | |
paths-ignore: | |
- '.lib/**' | |
- '.husky/**' | |
- '.eslintrc' | |
- '.gitignore' | |
- '.travis.yml' | |
- 'Makefile' | |
- 'README.md' | |
- 'fields.json' | |
- 'mime.json' | |
- 'rid.json' | |
- 'rtype.json' | |
env: | |
NODE_VERSION: '14' | |
jobs: | |
run-tests: | |
runs-on: ubuntu-latest | |
environment: development | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Use Node.js ${{ env.NODE_VERSION }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
cache: 'npm' | |
cache-dependency-path: .lib/package-lock.json | |
- name: Make install | |
run: make install | |
- name: Get changed files | |
id: changed-parser | |
uses: tj-actions/changed-files@v35 | |
with: | |
files: | | |
**/*.js | |
files_ignore: .lib/** | |
- name: Run mocha tests | |
shell: bash | |
run: | | |
PLATFORMS="" | |
for file in ${{ steps.changed-parser.outputs.all_modified_files }}; do | |
PLATFORMS="$PLATFORMS $(echo $file | grep "/" | grep -v "^\." | cut -d "/" -f1 | uniq)" | |
done | |
if [ -n "$PLATFORMS" ]; then | |
echo "$PLATFORMS" | xargs make test | |
if [ $? -ne 0 ]; then exit 1; fi | |
fi |