Skip to content

Commit

Permalink
[Tests] move tests from travis to GHA
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Nov 5, 2022
1 parent 50c508e commit d2ac1b7
Show file tree
Hide file tree
Showing 2 changed files with 165 additions and 27 deletions.
164 changes: 164 additions & 0 deletions .github/workflows/node.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
name: 'Tests: node.js'

on: [pull_request, push]

jobs:
build:
name: 'install deps and build'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: ljharb/actions/node/install@main
with:
skip-ls-check: true
- run: npx lerna bootstrap
- run: npm run build
- uses: actions/cache@v2
with:
path: |
packages/*/build
node_modules
packages/*/node_modules
key: enzyme-${{ github.workflow }}-${{ github.action }}-${{ github.run_id }}

karma:
needs: [build]
name: 'karma tests'
runs-on: ubuntu-latest
continue-on-error: true
strategy:
fail-fast: false
matrix:
react:
- '16'
- '16.3'
- '16.2'
- '16.1'
- '15'
- '15.4'
- '0.14'
- '0.13'
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/cache@v2
with:
path: |
packages/*/build
node_modules
packages/*/node_modules
key: enzyme-${{ github.workflow }}-${{ github.action }}-${{ github.run_id }}
- run: sudo chmod -R a+w .
- uses: ljharb/actions/node/install@main
with:
node-version: 'lts/*'
skip-install: true
after_install: '(nvm install node && REACT=${{ matrix.react }} TRAVIS=1 sh install-relevant-react.sh)'
skip-ls-check: true
- run: npm run test:karma -- --single-run
working-directory: ../..
env:
CHROME_BIN: chromium-browser
DISPLAY: 99.0

tests:
needs: [build]
name: 'tests'
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.continue-on-error || 'false' }}

strategy:
fail-fast: false
matrix:
node-version:
- '18'
- '4'
react:
- '16.14'
- '16.13'
- '16.12'
- '16.11'
- '16.10'
- '16.9'
- '16.8'
- '16.7'
- '16.6'
- '16.5'
- '16.4'
- '16.3'
- '16.2'
- '16.1'
- '16.0'
- '15.5'
- '15.4'
- '15.3'
- '15.2'
- '15.1'
- '15.0'
- '0.14'
- '0.13'
include:
- node-version: '16'
react: '16'
- node-version: '14'
react: '16'
- node-version: '12'
react: '16'
- node-version: '10'
react: '16'
- node-version: '8'
react: '16'
- node-version: '6'
react: '16'
- react: '16.8.3'
- react: '16.8.5'
env:
RENDERER: '16.8.5'
- react: '16.8.5'
continue-on-error: true
env:
RENDERER: '16.8.3'
- react: '16.3'
env:
ADAPTER: '16'
- react: '16.8'
continue-on-error: true
env:
RENDERER: '16.7'
- react: '16.7'
env:
RENDERER: '16.8'
- react: '16.7'
env:
RENDERER: '16.7'

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/cache@v2
with:
path: |
packages/*/build
node_modules
packages/*/node_modules
key: enzyme-${{ github.workflow }}-${{ github.action }}-${{ github.run_id }}
- run: sudo chmod -R a+w .
- uses: ljharb/actions/node/install@main
with:
node-version: ${{ matrix.node-version || 'lts/* '}}
skip-install: true
after_install: '(nvm exec node sh install-relevant-react.sh)'
skip-ls-check: true
env:
REACT: ${{ matrix.react }}
- run: npm run travis
- uses: codecov/codecov-action@v1

node:
name: 'node + react + karma'
needs: [tests, karma]
runs-on: ubuntu-latest
steps:
- run: 'echo tests completed'
28 changes: 1 addition & 27 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@ import:
install: 'echo already installed!'
before_script:
- 'nvm exec node sh install-relevant-react.sh'
- 'if [ -n "${KARMA-}" ]; then export CHROME_BIN=chromium-browser; export DISPLAY=:99.0; sh -e /etc/init.d/xvfb start; fi'
script:
- 'if [ -n "${KARMA-}" ]; then npm run test:karma -- --single-run; elif [ -n "${REACT-}" ]; then npm run travis; else false ; fi'
- 'if [ -n "${REACT-}" ]; then npm run travis; else false ; fi'
after_script:
- 'if [ -n "${REACT-}" ] && [ "${TRAVIS_ALLOW_FAILURE}" != true ]; then case "${TRAVIS_NODE_VERSION}" in "8" | "6") ;; *) cat ./coverage/lcov.info | ./node_modules/.bin/coveralls ;; esac ; fi'
- 'if [ -n "${REACT-}" ] && [ "${TRAVIS_ALLOW_FAILURE}" != true ]; then bash <(curl -s https://codecov.io/bash) -f coverage/*.json; fi'
Expand Down Expand Up @@ -75,32 +74,7 @@ matrix:
- node_js: "lts/gallium"
env: REACT=15.0
stage: test
- node_js: "6"
env: KARMA=true REACT=0.13
stage: test
- node_js: "6"
env: KARMA=true REACT=0.14
stage: test
- node_js: "6"
env: KARMA=true REACT=15.4
stage: test
- node_js: "6"
env: KARMA=true REACT=15
stage: test
- node_js: "6"
env: KARMA=true REACT=16
stage: test
allow_failures:
- node_js: "6"
env: KARMA=true REACT=0.13
- node_js: "6"
env: KARMA=true REACT=0.14
- node_js: "6"
env: KARMA=true REACT=15.4
- node_js: "6"
env: KARMA=true REACT=15
- node_js: "6"
env: KARMA=true REACT=16
- node_js: "lts/gallium"
env: REACT=16.8.5 RENDERER=16.8.3
- node_js: "lts/gallium"
Expand Down

0 comments on commit d2ac1b7

Please sign in to comment.