-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DEVOPS-241] Add new UI CI workflow (#51)
<!-- We appreciate the effort for this pull request but before that please make sure you read the contribution guidelines, then fill out the blanks below. Please format the PR title appropriately based on the type of change: [<issue>]: <description> Where <issue> is the related Jira Issue Key. --> ## Description - Created a duplicate of `next-ci.yaml` to create `ui-ci.yaml` that accounts for the v3 Yarn install. ## Related Issues <!-- List any related Jira issues here --> - Jira Issue: DEVOPS-241
- Loading branch information
1 parent
639c3a0
commit 5b5233a
Showing
1 changed file
with
164 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,164 @@ | ||
name: Next.js Application CI | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
environment: | ||
required: true | ||
type: string | ||
secrets: | ||
AZURE_CREDENTIALS: | ||
required: true | ||
PAT_ACTION_CI: | ||
required: true | ||
|
||
jobs: | ||
build: | ||
name: Build App | ||
if: ${{ github.actor != 'dependabot[bot]' }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
token: ${{ secrets.PAT_ACTION_CI }} | ||
fetch-depth: 0 | ||
|
||
- name: Use cache-yarn-install action | ||
uses: Andrews-McMeel-Universal/cache-yarn-install@v1 | ||
|
||
- name: Lint javascript | ||
run: yarn lint:js | ||
|
||
- name: Lint scss | ||
run: yarn lint:styles | ||
|
||
- name: Push Linting Fixes | ||
uses: stefanzweifel/git-auto-commit-action@v4 | ||
with: | ||
commit_user_name: amutechtest | ||
commit_user_email: amu_deploy@amuniversal.com | ||
commit_message: "[Formatter] Apply prettier changes" | ||
|
||
- name: Login to Azure | ||
uses: Andrews-McMeel-Universal/cache-azure-login@v1 | ||
with: | ||
azureCredentials: "${{ secrets.AZURE_CREDENTIALS }}" | ||
|
||
- name: Use .env cache action | ||
uses: Andrews-McMeel-Universal/get-envs@v1 | ||
with: | ||
azurecredentials: ${{ secrets.AZURE_CREDENTIALS }} | ||
environment: ${{ inputs.environment }} | ||
|
||
- name: Use cache-next-build action | ||
uses: Andrews-McMeel-Universal/cache-next-build@v1 | ||
|
||
unit-tests: | ||
name: Unit Tests | ||
needs: [build] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Use cache-yarn-install action | ||
uses: Andrews-McMeel-Universal/cache-yarn-install@v1 | ||
|
||
- name: Login to Azure | ||
uses: Andrews-McMeel-Universal/cache-azure-login@v1 | ||
with: | ||
azureCredentials: "${{ secrets.AZURE_CREDENTIALS }}" | ||
|
||
- name: Use .env cache action | ||
uses: Andrews-McMeel-Universal/get-envs@v1 | ||
with: | ||
azurecredentials: ${{ secrets.AZURE_CREDENTIALS }} | ||
environment: ${{ inputs.environment }} | ||
|
||
- name: Use cache-next-build action | ||
uses: Andrews-McMeel-Universal/cache-next-build@v1 | ||
|
||
- name: Run Jest tests | ||
run: yarn test:unit:ci | ||
|
||
integration-tests: | ||
name: Integration Tests | ||
needs: [build] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Use cache-yarn-install action | ||
uses: Andrews-McMeel-Universal/cache-yarn-install@v1 | ||
|
||
- name: Install Playwright Browsers | ||
run: yarn pretest:integration:ci | ||
|
||
- name: Login to Azure | ||
uses: Andrews-McMeel-Universal/cache-azure-login@v1 | ||
with: | ||
azureCredentials: "${{ secrets.AZURE_CREDENTIALS }}" | ||
|
||
- name: Use .env cache action | ||
uses: Andrews-McMeel-Universal/get-envs@v1 | ||
with: | ||
azurecredentials: ${{ secrets.AZURE_CREDENTIALS }} | ||
environment: ${{ inputs.environment }} | ||
|
||
- name: Use cache-next-build action | ||
uses: Andrews-McMeel-Universal/cache-next-build@v1 | ||
|
||
- name: Run Playwright tests | ||
run: yarn test:integration:ci | ||
|
||
- uses: actions/upload-artifact@v3 | ||
if: always() | ||
with: | ||
name: playwright-report | ||
path: playwright-report/ | ||
retention-days: 30 | ||
|
||
# Required status check | ||
# Checks gzipped page sizes and application links | ||
check-app: | ||
name: Check Links and Size Limit | ||
runs-on: ubuntu-latest | ||
needs: [build] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Login to Azure | ||
uses: Andrews-McMeel-Universal/cache-azure-login@v1 | ||
with: | ||
azureCredentials: "${{ secrets.AZURE_CREDENTIALS }}" | ||
|
||
- name: Use .env cache action | ||
uses: Andrews-McMeel-Universal/get-envs@v1 | ||
with: | ||
azurecredentials: ${{ secrets.AZURE_CREDENTIALS }} | ||
environment: ${{ inputs.environment }} | ||
|
||
- name: Use cache-yarn-install action | ||
uses: Andrews-McMeel-Universal/cache-yarn-install@v1 | ||
|
||
- name: Use cache-next-build action | ||
uses: Andrews-McMeel-Universal/cache-next-build@v1 | ||
|
||
- name: Run Broken Link Checker | ||
id: link-checker-report | ||
continue-on-error: true | ||
run: yarn test:links | ||
|
||
- name: Link Checker Results | ||
if: ${{ failure() }} | ||
run: echo "::warning ${{steps.link-checker-report.outputs.result}}" | ||
|
||
- uses: andresz1/size-limit-action@v1 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
# The size-limit-action tries to run a | ||
# redundant yarn build | ||
skip_step: build |