BACK-1332: run changed tests on GH Actions CI #1802
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, pull_request] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Git checkout | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup Node.js | |
uses: actions/setup-node@1a4442cacd436585916779262731d5b162bc6ec7 # v3 | |
with: | |
node-version: 16 | |
- name: Install Dependencies | |
run: yarn | |
- name: Run Eslint checks | |
if: github.event_name == 'push' | |
run: yarn check:es | |
- name: Run Changed tests only | |
if: github.event_name == 'pull_request' | |
timeout-minutes: 15 | |
env: | |
TENDERLY_ACCOUNT_ID: ${{ secrets.TENDERLY_USERNAME }} | |
TENDERLY_PROJECT: ${{ secrets.TENDERLY_PROJECT }} | |
TENDERLY_TOKEN: ${{ secrets.TENDERLY_TOKEN }} | |
HTTP_PROVIDER_1: ${{ secrets.HTTP_PROVIDER_1 }} | |
HTTP_PROVIDER_10: ${{ secrets.HTTP_PROVIDER_10 }} | |
HTTP_PROVIDER_56: ${{ secrets.HTTP_PROVIDER_56 }} | |
HTTP_PROVIDER_137: ${{ secrets.HTTP_PROVIDER_137 }} | |
HTTP_PROVIDER_250: ${{ secrets.HTTP_PROVIDER_250 }} | |
HTTP_PROVIDER_1101: ${{ secrets.HTTP_PROVIDER_1101 }} | |
HTTP_PROVIDER_8453: ${{ secrets.HTTP_PROVIDER_8453 }} | |
HTTP_PROVIDER_42161: ${{ secrets.HTTP_PROVIDER_42161 }} | |
HTTP_PROVIDER_43114: ${{ secrets.HTTP_PROVIDER_43114 }} | |
run: | | |
CHANGED_TESTS=$(git diff --name-only origin/${{ github.base_ref }} origin/${{ github.head_ref }} | grep test.ts || true) | |
echo "$CHANGED_TESTS" | |
if [ -n "$CHANGED_TESTS" ]; then | |
echo "Running the following changed specs" | |
npx jest --ci --forceExit --verbose $CHANGED_TESTS | |
else | |
echo "There are no changed tests...skipping" | |
fi |