seheekim1009 is running Pull Request CI #1268
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
name: Pull Request CI | |
run-name: ${{ github.actor }} is running Pull Request CI | |
on: | |
pull_request_target: | |
branches: | |
- main | |
types: [opened, labeled, reopened, synchronize] | |
workflow_dispatch: | |
env: | |
rid: ${{ github.run_id }}-${{ github.run_number }} | |
jobs: | |
validate-action: | |
name: Validate Action | |
runs-on: ubuntu-latest | |
steps: | |
- name: Validate Labels | |
run: | | |
HEAD_REPO=${{ github.event.pull_request.head.repo.full_name }} | |
BASE_REPO=${{ github.event.pull_request.base.repo.full_name }} | |
FROM_BASE=0; [ "$HEAD_REPO" == "$BASE_REPO" ] && FROM_BASE=1 | |
HAS_VALIDATED_LABEL=${{ contains(github.event.pull_request.labels.*.name, 'validated') }} | |
VALIDATED=0; [ "$HAS_VALIDATED_LABEL" == "true" ] && VALIDATED=1 | |
echo from base $FROM_BASE | |
echo validated $VALIDATED | |
if [[ $FROM_BASE == 1 || $VALIDATED == 1 ]] | |
then | |
echo 'pull request is validated, running tests' | |
exit 0 | |
else | |
echo 'pull request is not validated, exiting' | |
exit 1 | |
fi | |
initialize: | |
name: ${{ matrix.os }} Initialize | |
needs: validate-action | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
steps: | |
- name: Checkout Project | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Setup Node | |
uses: actions/setup-node@v3.7.0 | |
with: | |
node-version-file: '.nvmrc' | |
registry-url: 'https://registry.npmjs.org' | |
cache: 'yarn' | |
- name: Validate Dependencies | |
id: validate-dependencies | |
uses: actions/cache@v3 | |
with: | |
path: '**/node_modules' | |
key: node-modules-${{ matrix.os }}-${{ hashFiles('**/yarn.lock') }} | |
- name: Install Dependencies | |
if: steps.validate-dependencies.outputs.cache-hit != 'true' | |
run: yarn | |
- name: Cache Dependencies | |
uses: actions/cache@v3 | |
if: steps.validate-dependencies.outputs.cache-hit != 'true' | |
with: | |
path: '**/node_modules' | |
key: node-modules-${{ matrix.os }}-${{ hashFiles('**/yarn.lock') }} | |
generate-package-matrix: | |
name: Generate Package Matrix | |
needs: initialize | |
runs-on: ubuntu-latest | |
outputs: | |
packages: ${{ steps.generate-package-matrix.outputs.packages }} | |
steps: | |
- name: Checkout Project | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Setup Node | |
uses: actions/setup-node@v3.7.0 | |
with: | |
node-version-file: '.nvmrc' | |
registry-url: 'https://registry.npmjs.org' | |
cache: 'yarn' | |
- name: Build Telemetry | |
run: yarn && yarn telemetry build | |
- name: Cache Telemetry Dist | |
uses: actions/cache@v3 | |
with: | |
path: 'packages/@momentum-design/telemetry/dist' | |
key: momentum-design-telemetry-dist-ubuntu-latest-${{ env.rid }} # this will need to be updated to match the os matrix | |
- name: Uncache Dependencies | |
uses: actions/cache@v3 | |
with: | |
path: '**/node_modules' | |
key: node-modules-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }} | |
- name: Synchronize Packages | |
run: yarn | |
- name: Update Main Branch | |
run: | | |
git fetch origin main --unshallow | |
- name: Build Automation Tooling | |
run: yarn automation build:cli | |
- id: generate-package-matrix | |
name: Generate Package Matrix | |
run: echo "packages=$(yarn md-automation -- --command get-packages --changed ${{ github.event.pull_request.base.sha }} --dependent)" >> $GITHUB_OUTPUT | |
- name: Display Package Matrix | |
run: echo "generated package matrix - ${{ steps.generate-package-matrix.outputs.packages }}" | |
analyze-prebuild: | |
name: ( ${{ matrix.package }} / ${{ matrix.os }} ) Analyze - Prebuild | |
needs: [generate-package-matrix, initialize] | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
package: ${{ fromJson(needs.generate-package-matrix.outputs.packages) }} | |
steps: | |
- name: Checkout Project | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Setup Node | |
uses: actions/setup-node@v3.7.0 | |
with: | |
node-version-file: '.nvmrc' | |
registry-url: 'https://registry.npmjs.org' | |
cache: 'yarn' | |
- name: Uncache Dependencies | |
uses: actions/cache@v3 | |
with: | |
path: '**/node_modules' | |
key: node-modules-${{ matrix.os }}-${{ hashFiles('**/yarn.lock') }} | |
- name: Uncache Telemetry Dist | |
uses: actions/cache@v3 | |
with: | |
path: 'packages/@momentum-design/telemetry/dist' | |
key: momentum-design-telemetry-dist-${{ matrix.os }}-${{ env.rid }} | |
- name: Synchronize Packages | |
run: yarn | |
- name: Analyze - Prebuild | |
run: yarn workspace ${{ matrix.package }} analyze:prebuild | |
test-prebuild: | |
name: ( ${{ matrix.package }} / ${{ matrix.os }} ) Test - Prebuild | |
needs: [generate-package-matrix, initialize] | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
package: ${{ fromJson(needs.generate-package-matrix.outputs.packages) }} | |
steps: | |
- name: Checkout Project | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Setup Node | |
uses: actions/setup-node@v3.7.0 | |
with: | |
node-version-file: '.nvmrc' | |
registry-url: 'https://registry.npmjs.org' | |
cache: 'yarn' | |
- name: Uncache Dependencies | |
uses: actions/cache@v3 | |
with: | |
path: '**/node_modules' | |
key: node-modules-${{ matrix.os }}-${{ hashFiles('**/yarn.lock') }} | |
- name: Uncache Telemetry Dist | |
uses: actions/cache@v3 | |
with: | |
path: 'packages/@momentum-design/telemetry/dist' | |
key: momentum-design-telemetry-dist-${{ matrix.os }}-${{ env.rid }} | |
- name: Synchronize Packages | |
run: yarn | |
- name: Test - Prebuild | |
run: yarn workspace ${{ matrix.package }} test:prebuild | |
build: | |
name: ${{ matrix.os }} Build | |
needs: initialize | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
steps: | |
- name: Checkout Project | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Setup Node | |
uses: actions/setup-node@v3.7.0 | |
with: | |
node-version-file: '.nvmrc' | |
registry-url: 'https://registry.npmjs.org' | |
cache: 'yarn' | |
- name: Uncache Dependencies | |
uses: actions/cache@v3 | |
with: | |
path: '**/node_modules' | |
key: node-modules-${{ matrix.os }}-${{ hashFiles('**/yarn.lock') }} | |
- name: Synchronize Packages | |
run: yarn | |
- name: Build | |
run: yarn build | |
env: | |
MOMENTUM_METRICS_API_KEY: ${{ secrets.MOMENTUM_METRICS_API_KEY }} | |
- name: Cache Dist | |
uses: actions/cache@v3 | |
with: | |
path: '**/dist' | |
key: dist-${{ matrix.os }}-${{ env.rid }} | |
analyze-postbuild: | |
name: ( ${{ matrix.package }} / ${{ matrix.os }} ) Analyze - Postbuild | |
needs: [generate-package-matrix, build] | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
package: ${{ fromJson(needs.generate-package-matrix.outputs.packages) }} | |
steps: | |
- name: Checkout Project | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Setup Node | |
uses: actions/setup-node@v3.7.0 | |
with: | |
node-version-file: '.nvmrc' | |
registry-url: 'https://registry.npmjs.org' | |
cache: 'yarn' | |
- name: Uncache Dependencies | |
uses: actions/cache@v3 | |
with: | |
path: '**/node_modules' | |
key: node-modules-${{ matrix.os }}-${{ hashFiles('**/yarn.lock') }} | |
- name: Uncache Dist | |
uses: actions/cache@v3 | |
with: | |
path: '**/dist' | |
key: dist-${{ matrix.os }}-${{ env.rid }} | |
- name: Synchronize Packages | |
run: yarn | |
- name: Analyze - Postbuild | |
run: yarn workspace ${{ matrix.package }} analyze:postbuild | |
test-postbuild: | |
name: ( ${{ matrix.package }} / ${{ matrix.os }} ) Test - Postbuild | |
needs: [generate-package-matrix, build] | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
package: ${{ fromJson(needs.generate-package-matrix.outputs.packages) }} | |
steps: | |
- name: Checkout Project | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Setup Node | |
uses: actions/setup-node@v3.7.0 | |
with: | |
node-version-file: '.nvmrc' | |
registry-url: 'https://registry.npmjs.org' | |
cache: 'yarn' | |
- name: Uncache Dependencies | |
uses: actions/cache@v3 | |
with: | |
path: '**/node_modules' | |
key: node-modules-${{ matrix.os }}-${{ hashFiles('**/yarn.lock') }} | |
- name: Uncache Dist | |
uses: actions/cache@v3 | |
with: | |
path: '**/dist' | |
key: dist-${{ matrix.os }}-${{ env.rid }} | |
- name: Synchronize Packages | |
run: yarn | |
- name: Test - Postbuild | |
run: yarn workspace ${{ matrix.package }} test:postbuild |