debug ci #1650
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: CI | ||
on: push | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
# During a pre-merge check, Github creates and checks out an temporary merge commit. That | ||
# commit won't work as the HEAD for jest --changedSince | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
- name: Fetch merge base commits | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
# Fetch commits to a depth so that head and base reach their merge base. | ||
comparison=$(gh api\ | ||
repos/paraswap/parapswap-dex-lib/compare/${{ github.event.pull_request.base.sha }}...${{github.event.pull_request.head.sha }}) | ||
behind_by=$(echo -E $comparison | jq -r '.behind_by') | ||
ahead_by=$(echo -E $comparison | jq -r '.ahead_by') | ||
echo "ahead_by: $ahead_by; behind by: $behind_by" | ||
# +1 because fetch depth=1 is the commit itself. | ||
if [[ $behind_by -gt 0 ]]; then | ||
base_depth=$((behind_by+1)) | ||
echo Fetching base to depth $base_depth | ||
git -c protocol.version=2 fetch --no-tags --no-recurse-submodules\ | ||
--depth=$base_depth origin ${{github.event.pull_request.base.sha }} | ||
fi | ||
if [[ $ahead_by -gt 0 ]]; then | ||
head_depth=$((ahead_by+1)) | ||
echo Fetching head to depth $head_depth | ||
git -c protocol.version=2 fetch --no-tags --no-recurse-submodules\ | ||
--depth=$head_depth origin ${{github.event.pull_request.head.sha }} | ||
fi | ||
- uses: actions/checkout@v2 | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 | ||
- name: Install Dependencies | ||
run: yarn | ||
- name: Run Eslint checks | ||
run: yarn check:es | ||
- name: Run Changed tests only | ||
if: github.event_name == 'pull_request' | ||
run: npx jest --verbose --onlyChanged --changedSince=${{ env.BASE }} |