BACK-1332: run tests on GH Actions CI #1
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: Run changed or added tests within PR | |
on: pull_request | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
- name: Install Dependencies | |
run: yarn | |
- name: Run Changed tests only | |
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 ${{ github.base_ref }} ${{ github.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 |