💡 [major] Prefer MSGPack over JSON #143
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: 🚦 Npm Tests | |
env: | |
APPLICATION_NAME: cachette | |
TEST_REDIS_URL: redis://localhost:6379 | |
on: | |
pull_request: | |
# adding 'ready_for_review' to the default [opened, synchronize, reopened] since we don't run on pr.draft == false | |
# see https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request | |
types: [opened, synchronize, reopened, ready_for_review] | |
branches: | |
- master | |
paths: | |
- "**/*.js" | |
- "**/*.ts" | |
- "**/*.json" | |
jobs: | |
tests: | |
runs-on: ubuntu-latest | |
if: ${{ github.event.pull_request.draft == false }} | |
services: | |
# Label used to access the service container | |
redis: | |
# Docker Hub image | |
image: redis | |
# Set health checks to wait until redis has started | |
options: >- | |
--health-cmd "redis-cli ping" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 6379:6379 | |
steps: | |
# https://github.com/actions/checkout | |
- name: Checkout 🛎️ | |
uses: actions/checkout@v2 | |
- name: Get node version ⭐️ | |
run: | | |
echo "NODE_VERSION=$(echo $(jq '.engines.node' package.json) | sed -E 's/"[<>=]*([0-9]([\.0-9a-z]+)?)*.*"/\1/')" >> $GITHUB_ENV | |
echo "${{ env.NODE_VERSION }}" | |
- name: Setup Node ${{ env.NODE_VERSION }}📍️ | |
uses: actions/setup-node@v1 | |
env: | |
CI: true | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
# https://github.com/actions/cache | |
- name: NPM cache 📦 | |
uses: actions/cache@v2 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-${{ env.APPLICATION_NAME }}-npm-cache-${{ hashFiles('**/package-lock.json') }} | |
- name: NPM install 📦 | |
run: | | |
npm ci | |
- name: Run tests ✅ | |
run: | | |
npm run test:ci |