2022-01-03 05:48:12 -06:00
|
|
|
name: Levitate / Detect breaking changes
|
|
|
|
|
|
|
|
on: pull_request
|
|
|
|
|
|
|
|
jobs:
|
2022-01-20 03:20:32 -06:00
|
|
|
buildPR:
|
|
|
|
name: Build PR
|
2022-01-03 05:48:12 -06:00
|
|
|
runs-on: ubuntu-latest
|
2022-01-20 03:20:32 -06:00
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
working-directory: './pr'
|
2022-01-03 05:48:12 -06:00
|
|
|
|
|
|
|
steps:
|
2022-04-08 03:26:30 -05:00
|
|
|
- uses: actions/checkout@v3
|
2022-01-20 03:20:32 -06:00
|
|
|
with:
|
|
|
|
path: './pr'
|
2022-01-03 05:48:12 -06:00
|
|
|
|
2022-01-20 03:20:32 -06:00
|
|
|
- name: Get yarn cache directory path
|
|
|
|
id: yarn-cache-dir-path
|
|
|
|
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
|
|
|
|
|
|
|
|
- name: Restore yarn cache
|
|
|
|
uses: actions/cache@v2
|
|
|
|
id: yarn-cache
|
2022-01-03 05:48:12 -06:00
|
|
|
with:
|
2022-01-20 03:20:32 -06:00
|
|
|
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
|
|
|
key: yarn-cache-folder-${{ hashFiles('**/yarn.lock', '.yarnrc.yml') }}
|
|
|
|
restore-keys: |
|
|
|
|
yarn-cache-folder-
|
|
|
|
|
|
|
|
- name: Install dependencies
|
|
|
|
run: yarn install --immutable
|
|
|
|
|
|
|
|
- name: Build packages
|
|
|
|
run: yarn packages:build
|
2022-01-03 05:48:12 -06:00
|
|
|
|
2022-01-20 03:20:32 -06:00
|
|
|
- name: Zip built packages
|
|
|
|
run: zip -r ./pr_built_packages.zip ./packages/**/dist
|
|
|
|
|
|
|
|
- name: Upload build output as artifact
|
|
|
|
uses: actions/upload-artifact@v2
|
2022-01-03 05:48:12 -06:00
|
|
|
with:
|
2022-01-20 03:20:32 -06:00
|
|
|
name: buildPr
|
|
|
|
path: './pr/pr_built_packages.zip'
|
|
|
|
|
2022-02-08 04:33:33 -06:00
|
|
|
buildBase:
|
|
|
|
name: Build Base
|
2022-01-20 03:20:32 -06:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
defaults:
|
|
|
|
run:
|
2022-02-08 04:33:33 -06:00
|
|
|
working-directory: './base'
|
2022-01-20 03:20:32 -06:00
|
|
|
|
|
|
|
steps:
|
2022-04-08 03:26:30 -05:00
|
|
|
- uses: actions/checkout@v3
|
2022-01-20 03:20:32 -06:00
|
|
|
with:
|
2022-02-08 04:33:33 -06:00
|
|
|
path: './base'
|
|
|
|
ref: ${{ github.event.pull_request.base.ref }}
|
2022-01-20 03:20:32 -06:00
|
|
|
|
|
|
|
- name: Get yarn cache directory path
|
|
|
|
id: yarn-cache-dir-path
|
|
|
|
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
|
|
|
|
|
|
|
|
- name: Restore yarn cache
|
|
|
|
uses: actions/cache@v2
|
|
|
|
id: yarn-cache
|
|
|
|
with:
|
|
|
|
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
|
|
|
key: yarn-cache-folder-${{ hashFiles('**/yarn.lock', '.yarnrc.yml') }}
|
|
|
|
restore-keys: |
|
|
|
|
yarn-cache-folder-
|
2022-01-03 05:48:12 -06:00
|
|
|
|
|
|
|
- name: Install dependencies
|
|
|
|
run: yarn install --immutable
|
|
|
|
|
|
|
|
- name: Build packages
|
|
|
|
run: yarn packages:build
|
|
|
|
|
2022-01-20 03:20:32 -06:00
|
|
|
- name: Zip built packages
|
2022-02-08 04:33:33 -06:00
|
|
|
run: zip -r ./base_built_packages.zip ./packages/**/dist
|
2022-01-03 05:48:12 -06:00
|
|
|
|
2022-01-20 03:20:32 -06:00
|
|
|
- name: Upload build output as artifact
|
2022-01-03 05:48:12 -06:00
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
with:
|
2022-02-08 04:33:33 -06:00
|
|
|
name: buildBase
|
|
|
|
path: './base/base_built_packages.zip'
|
2022-01-20 03:20:32 -06:00
|
|
|
|
|
|
|
Detect:
|
|
|
|
name: Detect breaking changes
|
|
|
|
runs-on: ubuntu-latest
|
2022-02-08 04:33:33 -06:00
|
|
|
needs: ['buildPR', 'buildBase']
|
2022-01-20 03:20:32 -06:00
|
|
|
env:
|
|
|
|
GITHUB_STEP_NUMBER: 7
|
|
|
|
|
|
|
|
steps:
|
2022-04-08 03:26:30 -05:00
|
|
|
- uses: actions/checkout@v3
|
2022-01-20 03:20:32 -06:00
|
|
|
|
|
|
|
- name: Get built packages from pr
|
2022-05-17 05:58:46 -05:00
|
|
|
uses: actions/download-artifact@v3
|
2022-01-20 03:20:32 -06:00
|
|
|
with:
|
|
|
|
name: buildPr
|
|
|
|
|
2022-02-08 04:33:33 -06:00
|
|
|
- name: Get built packages from base
|
2022-05-17 05:58:46 -05:00
|
|
|
uses: actions/download-artifact@v3
|
2022-01-20 03:20:32 -06:00
|
|
|
with:
|
2022-02-08 04:33:33 -06:00
|
|
|
name: buildBase
|
2022-01-04 06:54:38 -06:00
|
|
|
|
2022-01-20 03:20:32 -06:00
|
|
|
- name: Unzip artifact from pr
|
|
|
|
run: unzip pr_built_packages.zip -d ./pr && rm pr_built_packages.zip
|
|
|
|
|
2022-02-08 04:33:33 -06:00
|
|
|
- name: Unzip artifact from base
|
|
|
|
run: unzip base_built_packages.zip -d ./base && rm base_built_packages.zip
|
2022-01-20 03:20:32 -06:00
|
|
|
|
|
|
|
- name: Get link for the Github Action job
|
|
|
|
id: job
|
2022-02-16 03:51:40 -06:00
|
|
|
uses: actions/github-script@v6
|
2022-01-20 03:20:32 -06:00
|
|
|
with:
|
|
|
|
script: |
|
|
|
|
const script = require('./.github/workflows/scripts/pr-get-job-link.js')
|
|
|
|
await script({github, context, core})
|
|
|
|
|
|
|
|
- name: Detect breaking changes
|
|
|
|
id: breaking-changes
|
|
|
|
run: ./scripts/check-breaking-changes.sh
|
|
|
|
env:
|
|
|
|
FORCE_COLOR: 3
|
|
|
|
GITHUB_JOB_LINK: ${{ steps.job.outputs.link }}
|
|
|
|
|
|
|
|
- name: Persisting the check output
|
|
|
|
run: |
|
|
|
|
mkdir -p ./levitate
|
2022-02-15 04:10:44 -06:00
|
|
|
echo "{ \"exit_code\": ${{ steps.breaking-changes.outputs.is_breaking }}, \"message\": \"${{ steps.breaking-changes.outputs.message }}\", \"job_link\": \"${{ steps.job.outputs.link }}#step:${GITHUB_STEP_NUMBER}:1\", \"pr_number\": \"${{ github.event.pull_request.number }}\" }" > ./levitate/result.json
|
2022-01-20 03:20:32 -06:00
|
|
|
|
|
|
|
- name: Upload check output as artifact
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
with:
|
|
|
|
name: levitate
|
|
|
|
path: levitate/
|
|
|
|
|
|
|
|
- name: Exit
|
|
|
|
run: exit ${{ steps.breaking-changes.outputs.is_breaking }}
|
|
|
|
shell: bash
|