Add common IIIF share component. #446
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 Unit Tests and Code Quality Checks | |
on: | |
push: | |
branches: | |
- "**" # This will run the action on push to any branch | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
env: | |
NEXT_PUBLIC_DCAPI_ENDPOINT: "https://dcapi.rdc-staging.library.northwestern.edu/api/v2" | |
NEXT_PUBLIC_DC_URL: "https://dc-next.rdc-staging.library.northwestern.edu" | |
steps: | |
- name: Cancel Previous Runs | |
uses: styfle/[email protected] | |
- name: Get files | |
uses: actions/checkout@v4 | |
- name: Get npm cache directory | |
id: npm-cache-dir | |
shell: bash | |
run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT} | |
- uses: actions/cache@v4 | |
id: npm-cache # use this to check for `cache-hit` ==> if: steps.npm-cache.outputs.cache-hit != 'true' | |
with: | |
path: ${{ steps.npm-cache-dir.outputs.dir }} | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Setup NodeJS | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "lts/*" | |
- name: Install dependencies | |
run: npm ci --force | |
- name: Check code formatting with Prettier | |
run: | | |
echo "Running Prettier check..." | |
npx prettier --check "**/*.{js,jsx,ts,tsx,json,md,css,scss}" | |
- name: Report Prettier results | |
if: failure() | |
run: | | |
echo "Prettier check failed. Please run 'npm run format' locally and commit the changes." | |
exit 1 | |
- name: Run tests | |
run: npm run test:ci |