Skip to content

Commit

Permalink
Update workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
evansims committed Aug 24, 2023
1 parent 9c10016 commit f478bc5
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 44 deletions.
28 changes: 1 addition & 27 deletions .github/actions/build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,6 @@ inputs:
description: The Node version to use
required: false
default: 18
tests:
description: Whether tests should be run
required: false
default: 'false'
browserstack-access-key:
description: BrowserStack access key
required: false
default: ''
browserstack-username:
description: BrowserStack username
required: false
default: ''

runs:
using: composite
Expand All @@ -43,20 +31,6 @@ runs:
shell: bash
run: npm run print-bundle-size

- if: ${{ inputs.tests == 'true' }}
name: Run `es-check`
- name: Run `es-check`
shell: bash
run: npm run test:es-check

- if: ${{ inputs.tests == 'true' }}
name: Run Jest unit tests
shell: bash
run: npm run test -- --maxWorkers=2

- if: ${{ inputs.tests == 'true' }}
name: Run BrowserStack tests
shell: bash
run: npx concurrently --raw --kill-others --success first "npm:dev" "wait-on http://127.0.0.1:3000/ && browserstack-cypress run --build-name ${{ github.ref }}"
env:
BROWSERSTACK_ACCESS_KEY: ${{ inputs.browserstack-access-key }}
BROWSERSTACK_USERNAME: ${{ inputs.browserstack-username }}
9 changes: 1 addition & 8 deletions .github/actions/framework/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ runs:
- name: Restore build artifacts
uses: actions/cache/restore@v3
with:
path: |
dist
path: .
key: ${{ inputs.cache }}

- name: Relocate build artifacts
Expand All @@ -44,12 +43,6 @@ runs:
shell: bash
run: ${{ inputs.install }}

- name: Install dependencies
shell: bash
run: |
npm ci
working-directory: my-app

- name: Install SDK
shell: bash
run: |
Expand Down
68 changes: 59 additions & 9 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,24 +48,74 @@ jobs:
uses: ./.github/actions/build
with:
node: ${{ env.NODE_VERSION }}
tests: 'true'
browserstack-access-key: ${{ secrets.BROWSERSTACK_ACCESSKEY }}
browserstack-username: ${{ secrets.BROWSERSTACK_USERNAME }}

- name: Save build artifacts
uses: actions/cache/save@v3
with:
path: |
dist
path: .
key: ${{ env.CACHE_KEY }}

- name: Upload coverage
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # [email protected]

unit:
needs: test

name: Unit Tests
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'

- name: Restore build artifacts
uses: actions/cache/restore@v3
with:
path: .
key: ${{ env.CACHE_KEY }}

- name: Run tests
run: npm run test -- --maxWorkers=2

browserstack:
needs: test

name: BrowserStack Tests
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'

- name: Restore build artifacts
uses: actions/cache/restore@v3
with:
path: .
key: ${{ env.CACHE_KEY }}

- name: Run tests
shell: bash
run: npx concurrently --raw --kill-others --success first "npm:dev" "wait-on http://127.0.0.1:3000/ && browserstack-cypress run --build-name ${{ github.ref }}"
env:
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }}

gatsby:
needs: test

name: Gatsby
name: Gatsby Tests
runs-on: ubuntu-latest

steps:
Expand All @@ -89,7 +139,7 @@ jobs:
react:
needs: test

name: React
name: React Tests
runs-on: ubuntu-latest

steps:
Expand All @@ -113,7 +163,7 @@ jobs:
vue:
needs: test

name: Vue
name: Vue Tests
runs-on: ubuntu-latest

steps:
Expand All @@ -137,7 +187,7 @@ jobs:
angular:
needs: test

name: Angular
name: Angular Tests
runs-on: ubuntu-latest

steps:
Expand Down

0 comments on commit f478bc5

Please sign in to comment.