BACK-1332: run tests on GH Actions CI #1739
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: | |
- 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 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 ${{ github.event.pull_request.base.sha }} ${{ 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 |