Skip to content

Commit

Permalink
refactor: separate CI jobs for node and browser tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lquixada committed Apr 29, 2023
1 parent b98f51a commit a276386
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 14 deletions.
22 changes: 19 additions & 3 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ name: Checks
on: [workflow_call]

jobs:
test:
name: Test specs
test-node:
name: Node Test Specs
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand All @@ -22,7 +22,23 @@ jobs:
with:
node-version: ${{ matrix.node-version }}
- run: npm install --prefer-offline
- run: make test
- run: make test-node

test-browser:
name: Browser Test Specs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: ~/.npm # this is cache where npm installs from before going out to the network
key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }}
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: npm install --prefer-offline
- run: make test-browser

lint:
name: Code Lint
Expand Down
28 changes: 17 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,26 @@ secure:
@echo "=> make $@"
@npx snyk test

test: compile test-fetch test-module
##
# Test groups

test-fetch: \
test: compile test-browser test-node

test-browser: \
test-fetch-browser-native \
test-fetch-browser-whatwg \
test-module-web-cjs \
test-module-web-esm \
test-module-react-native

test-node: \
test-fetch-node-native \
test-fetch-node-fetch
test-fetch-node-fetch \
test-module-node-cjs \
test-module-node-esm

##
# Test units

test-fetch-browser-native: build
@echo ""
Expand All @@ -69,13 +82,6 @@ test-fetch-node-fetch: build
@echo "=> make $@"
@./test/fetch-api/node-fetch/run.sh

test-module: \
test-module-web-cjs \
test-module-web-esm \
test-module-node-cjs \
test-module-node-esm \
test-module-react-native

test-module-web-cjs: build
@echo ""
@echo "=> make $@"
Expand Down Expand Up @@ -106,4 +112,4 @@ typecheck:
@echo "=> make $@"
@npx tsc --lib ES6 --noEmit index.d.ts ./test/fetch-api/api.spec.ts

.PHONY: all build deploy lint test test-fetch test-fetch-browser-native test-fetch-browser-whatwg test-fetch-node-native test-fetch-node-fetch test-module test-module-web-cjs test-module-web-esm test-module-node-cjs test-module-node-esm test-module-react-native typecheck
.PHONY: all build deploy lint test test-fetch test-browser test-node test-fetch-browser-native test-fetch-browser-whatwg test-fetch-node-native test-fetch-node-fetch test-module test-module-web-cjs test-module-web-esm test-module-node-cjs test-module-node-esm test-module-react-native typecheck

0 comments on commit a276386

Please sign in to comment.