Skip to content

Commit

Permalink
Add repository variables for different Next.js CI checks
Browse files Browse the repository at this point in the history
  • Loading branch information
ebronson68 committed Aug 21, 2024
1 parent 343f0ac commit 1abbc22
Showing 1 changed file with 48 additions and 2 deletions.
50 changes: 48 additions & 2 deletions .github/workflows/next-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,30 @@ on:
environment:
required: true
type: string
YARN_INSTALL:
required: false
type: string
default: ${{ vars.APPLICATION_CI_YARN_INSTALL || 'false' }}
RUN_PLAYWRIGHT_TESTS:
required: false
type: string
default: ${{ vars.APPLICATION_CI_RUN_PLAYWRIGHT_TESTS || 'true' }}
LINT_SCSS:
required: false
type: string
default: ${{ vars.APPLICATION_CI_LINT_SCSS || 'true' }}
LINT_JS:
required: false
type: string
default: ${{ vars.APPLICATION_CI_LINT_JS || 'true' }}
CHECK_SIZE_LIMIT:
required: false
type: string
default: ${{ vars.APPLICATION_CI_CHECK_SIZE_LIMIT || 'true' }}
RUN_JEST_TESTS:
required: false
type: string
default: ${{ vars.APPLICATION_CI_RUN_JEST_TESTS || 'true' }}
secrets:
AZURE_CREDENTIALS:
required: true
Expand All @@ -25,12 +49,19 @@ jobs:
fetch-depth: 0

- name: Use cache-next-install action
if: ${{ inputs.YARN_INSTALL == 'false' }}
uses: Andrews-McMeel-Universal/cache-next-install@v1

- name: Use cache-yarn-install action
if: ${{ inputs.YARN_INSTALL == 'true' }}
uses: Andrews-McMeel-Universal/cache-yarn-install@v1

- name: Lint javascript
if: ${{ inputs.LINT_JS == 'true' }}
run: yarn lint:js

- name: Lint scss
if: ${{ inputs.LINT_SCSS == 'true' }}
run: yarn lint:styles

- name: Push Linting Fixes
Expand All @@ -49,18 +80,23 @@ jobs:
- name: Use cache-next-build action
uses: Andrews-McMeel-Universal/cache-next-build@v1

# Required status check
unit-tests:
name: Unit Tests
if: ${{ inputs.RUN_JEST_TESTS == 'true' }}
needs: [build]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Use cache-next-install action
if: ${{ inputs.YARN_INSTALL == 'false' }}
uses: Andrews-McMeel-Universal/cache-next-install@v1

- name: Use cache-yarn-install action
if: ${{ inputs.YARN_INSTALL == 'true' }}
uses: Andrews-McMeel-Universal/cache-yarn-install@v1

- name: Use .env cache action
uses: Andrews-McMeel-Universal/get-envs@v1
with:
Expand All @@ -71,10 +107,12 @@ jobs:
uses: Andrews-McMeel-Universal/cache-next-build@v1

- name: Run Jest tests
if: ${{ inputs.RUN_JEST_TESTS == 'true' }}
run: yarn test:unit:ci

integration-tests:
name: Integration Tests
if: ${{ inputs.RUN_PLAYWRIGHT_TESTS == 'true' || inputs.CHECK_SIZE_LIMIT == 'true' }}
needs: [build]
runs-on: ubuntu-latest
timeout-minutes: 25
Expand All @@ -83,9 +121,15 @@ jobs:
uses: actions/checkout@v4

- name: Use cache-next-install action
if: ${{ inputs.YARN_INSTALL == 'false' }}
uses: Andrews-McMeel-Universal/cache-next-install@v1

- name: Use cache-yarn-install action
if: ${{ inputs.YARN_INSTALL == 'true' }}
uses: Andrews-McMeel-Universal/cache-yarn-install@v1

- name: Install Playwright Browsers
if: ${{ inputs.RUN_PLAYWRIGHT_TESTS == 'true' }}
run: yarn playwright install

- name: Use .env cache action
Expand All @@ -98,16 +142,18 @@ jobs:
uses: Andrews-McMeel-Universal/cache-next-build@v1

- name: Run Playwright tests
if: ${{ inputs.RUN_PLAYWRIGHT_TESTS == 'true' }}
run: yarn test:integration:ci

- uses: actions/upload-artifact@v4
if: always()
if: inputs.RUN_PLAYWRIGHT_TESTS == 'true' && always()
with:
name: playwright-report
path: playwright-report/
retention-days: 30

- uses: andresz1/size-limit-action@v1
if: ${{ inputs.CHECK_SIZE_LIMIT == 'true' }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
# The size-limit-action tries to run a
Expand Down

0 comments on commit 1abbc22

Please sign in to comment.