From f478bc50a15f09a7d40163ca8473713bcb83aca5 Mon Sep 17 00:00:00 2001 From: Evan Sims Date: Thu, 24 Aug 2023 17:54:07 -0500 Subject: [PATCH] Update workflows --- .github/actions/build/action.yml | 28 +----------- .github/actions/framework/action.yml | 9 +--- .github/workflows/test.yml | 68 ++++++++++++++++++++++++---- 3 files changed, 61 insertions(+), 44 deletions(-) diff --git a/.github/actions/build/action.yml b/.github/actions/build/action.yml index beee06252..fd5a28a0f 100644 --- a/.github/actions/build/action.yml +++ b/.github/actions/build/action.yml @@ -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 @@ -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 }} diff --git a/.github/actions/framework/action.yml b/.github/actions/framework/action.yml index cfa07b6a1..0f3cec383 100644 --- a/.github/actions/framework/action.yml +++ b/.github/actions/framework/action.yml @@ -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 @@ -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: | diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8463543aa..e9776cbec 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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 # pin@3.1.4 + 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: @@ -89,7 +139,7 @@ jobs: react: needs: test - name: React + name: React Tests runs-on: ubuntu-latest steps: @@ -113,7 +163,7 @@ jobs: vue: needs: test - name: Vue + name: Vue Tests runs-on: ubuntu-latest steps: @@ -137,7 +187,7 @@ jobs: angular: needs: test - name: Angular + name: Angular Tests runs-on: ubuntu-latest steps: