Skip to content

Commit

Permalink
Add optional dependencies to react workflow (#6879)
Browse files Browse the repository at this point in the history
- Installs optional dependencies on msal-react-e2e workflow since
they're missing because of an npm bug that ignores optional dependencies
  • Loading branch information
hectormmg authored Feb 6, 2024
1 parent e7a5551 commit e7e24e1
Show file tree
Hide file tree
Showing 4 changed files with 319 additions and 77 deletions.
120 changes: 62 additions & 58 deletions .github/workflows/msal-react-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,76 +5,80 @@
name: msal-react E2E Tests

on:
pull_request:
types: [opened, reopened, synchronize, ready_for_review]
paths:
- 'lib/msal-react/**/*'
- 'lib/msal-browser/**/*'
- 'lib/msal-common/**/*'
- 'samples/msal-react-samples/**/*'
- 'samples/e2eTestUtils/**/*'
- 'samples/package-lock.json'
- '!**.md'
- '.github/workflows/msal-react-e2e.yml'
merge_group:
types: [checks_requested]
pull_request:
types: [opened, reopened, synchronize, ready_for_review]
paths:
- "lib/msal-react/**/*"
- "lib/msal-browser/**/*"
- "lib/msal-common/**/*"
- "samples/msal-react-samples/**/*"
- "samples/e2eTestUtils/**/*"
- "samples/package-lock.json"
- "!**.md"
- ".github/workflows/msal-react-e2e.yml"
merge_group:
types: [checks_requested]

concurrency:
group: react-e2e-${{github.ref}}
cancel-in-progress: true
group: react-e2e-${{github.ref}}
cancel-in-progress: true

permissions:
contents: read
contents: read

jobs:
run-e2e:
if: (github.repository == 'AzureAD/microsoft-authentication-library-for-js') && (github.actor != 'dependabot[bot]') && ((github.event.pull_request.head.repo.full_name == github.repository) || (github.event_name == 'merge_group')) && !github.event.pull_request.draft
runs-on: ubuntu-latest
run-e2e:
if: (github.repository == 'AzureAD/microsoft-authentication-library-for-js') && (github.actor != 'dependabot[bot]') && ((github.event.pull_request.head.repo.full_name == github.repository) || (github.event_name == 'merge_group')) && !github.event.pull_request.draft
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
sample:
- 'react-router-sample'
- 'nextjs-sample'
- 'gatsby-sample'
- 'typescript-sample'
- 'b2c-sample'
strategy:
fail-fast: false
matrix:
sample:
- "react-router-sample"
- "nextjs-sample"
- "gatsby-sample"
- "typescript-sample"
- "b2c-sample"

name: ${{ matrix.sample }}
name: ${{ matrix.sample }}

steps:
- uses: actions/checkout@v4
steps:
- uses: actions/checkout@v4

- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 18
cache: 'npm'
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: "npm"

- name: Clean Install
run: npm ci --workspace=samples/msal-react-samples/${{matrix.sample}}
- name: Clean Install
run: npm ci --workspace=samples/msal-react-samples/${{matrix.sample}}

- name: Build packages
working-directory: lib/msal-react
run: npm run build:all
# Required because of https://github.com/npm/cli/issues/4828
- name: React optional dependencies
run: npm install --workspace=samples/msal-react-samples/${{matrix.sample}} --no-save @rollup/rollup-linux-x64-gnu @parcel/watcher-linux-x64-glibc

- name: Build ${{ matrix.sample }}
working-directory: samples/msal-react-samples/${{ matrix.sample }}
run: npm run build
- name: Build packages
working-directory: lib/msal-react
run: npm run build:all

- name: E2E Tests
working-directory: samples/msal-react-samples/${{ matrix.sample }}
timeout-minutes: 5
env:
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
run: npm test
- name: Build ${{ matrix.sample }}
working-directory: samples/msal-react-samples/${{ matrix.sample }}
run: npm run build

- name: Upload E2E Test Screenshots
uses: actions/upload-artifact@v4
if: failure()
with:
name: e2e-test-screenshots
path: samples/**/screenshots
- name: E2E Tests
working-directory: samples/msal-react-samples/${{ matrix.sample }}
timeout-minutes: 5
env:
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
run: npm test

- name: Upload E2E Test Screenshots
uses: actions/upload-artifact@v4
if: failure()
with:
name: e2e-test-screenshots
path: samples/**/screenshots
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "none",
"comment": "Add optional dependencies to react workflow #6879",
"packageName": "@azure/msal-react",
"email": "[email protected]",
"dependentChangeType": "none"
}
2 changes: 1 addition & 1 deletion lib/msal-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"prettier": "2.8.7",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"rollup": "^4.6.0",
"rollup": "^4.9.6",
"ts-jest": "^29.1.0",
"tslib": "^2.0.0",
"typescript": "^4.9.5"
Expand Down
Loading

0 comments on commit e7e24e1

Please sign in to comment.