@ -3,27 +3,30 @@ name: Levitate / Detect breaking changes
on : pull_request
jobs:
build:
name : Detect
buildPR :
name : Build PR
runs-on : ubuntu-latest
env:
GITHUB_STEP_NUMBER : 7
defaults:
run:
working-directory : './pr'
steps:
- uses : actions/checkout@v2
- name : Setup environment
uses : actions/setup-node@v2.5.1
with :
node-version : '16 '
path : './pr'
- name : Get link for the Github Action job
id : job
uses : actions/github-script@v5
- 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:
script : |
const script = require('./.github/workflows/scripts/pr-get-job-link.js')
await script({github, context, core})
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
@ -31,24 +34,108 @@ jobs:
- name : Build packages
run : yarn packages:build
- 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 : Zip built packages
run : zip -r ./pr_built_packages.zip ./packages/**/dist
- name : Upload build output as artifact
uses : actions/upload-artifact@v2
with:
name : buildPr
path : './pr/pr_built_packages.zip'
buildMain:
name : Build Main
runs-on : ubuntu-latest
defaults:
run:
working-directory : './main'
steps:
- uses : actions/checkout@v2
with :
path : './main'
ref : 'main'
- 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-
- name : Install dependencies
run : yarn install --immutable
- name : Build packages
run : yarn packages:build
- name : Persisting the check output
run : |
mkdir -p ./levitate
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\" }" > ./levitate/result.json
- name : Zip built packages
run : zip -r ./main_built_packages.zip ./packages/**/dist
- name : Upload check output as artifact
- name : Upload build output as artifact
uses : actions/upload-artifact@v2
with:
name : levitate
path : levitate/
name : buildMain
path : './main/main_built_packages.zip'
Detect:
name : Detect breaking changes
runs-on : ubuntu-latest
needs : [ 'buildPR' , 'buildMain' ]
env:
GITHUB_STEP_NUMBER : 7
steps:
- uses : actions/checkout@v2
- name : Get built packages from pr
uses : actions/download-artifact@v2
with:
name : buildPr
- name : Get built packages from main
uses : actions/download-artifact@v2
with:
name : buildMain
- name : Unzip artifact from pr
run : unzip pr_built_packages.zip -d ./pr && rm pr_built_packages.zip
- name : Unzip artifact from main
run : unzip main_built_packages.zip -d ./main && rm main_built_packages.zip
- name : Get link for the Github Action job
id : job
uses : actions/github-script@v5
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
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\" }" > ./levitate/result.json
- 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
- name : Exit
run : exit ${{ steps.breaking-changes.outputs.is_breaking }}
shell : bash