diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index a588d6d0c..4b57fbec4 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,22 +1,52 @@ name: CI -on: push +on: [push, pull_request] jobs: build: runs-on: ubuntu-latest - strategy: - matrix: - node: ['16.x'] - name: Node ${{ matrix.node }} sample steps: - - uses: actions/checkout@v2 - - name: Setup node - uses: actions/setup-node@v2 + - name: Git checkout + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 with: - node-version: ${{ matrix.node }} + fetch-depth: 0 + + - name: Setup Node.js + uses: actions/setup-node@1a4442cacd436585916779262731d5b162bc6ec7 + 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 + + printf '%s\n' "$TENDERLY_PROJECT" > test.txt + cat test.txt diff --git a/src/dex/balancer-v2/new.test.ts b/src/dex/balancer-v2/new.test.ts new file mode 100644 index 000000000..a10047991 --- /dev/null +++ b/src/dex/balancer-v2/new.test.ts @@ -0,0 +1,10 @@ +import dotenv from 'dotenv'; +dotenv.config(); + + +describe('Test', () => { + it('should pass', () => { + console.log(process.env.TENDERLY_PROJECT); + expect(true).toBe(true); + }) +}); diff --git a/test.txt b/test.txt new file mode 100644 index 000000000..573541ac9 --- /dev/null +++ b/test.txt @@ -0,0 +1 @@ +0 diff --git a/tests/tenderly-simulation.ts b/tests/tenderly-simulation.ts index ddc53c786..b1bcd5982 100644 --- a/tests/tenderly-simulation.ts +++ b/tests/tenderly-simulation.ts @@ -76,6 +76,7 @@ export class TenderlySimulation implements TransactionSimulator { } try { + await process.nextTick(() => { }); // https://stackoverflow.com/questions/69169492/async-external-function-leaves-open-handles-jest-supertest-express let res = await axios.post( `https://api.tenderly.co/api/v1/account/${TENDERLY_ACCOUNT_ID}/project/${TENDERLY_PROJECT}/fork`, { @@ -109,6 +110,7 @@ export class TenderlySimulation implements TransactionSimulator { }; try { if (stateOverrides) { + await process.nextTick(() => { }); // https://stackoverflow.com/questions/69169492/async-external-function-leaves-open-handles-jest-supertest-express const result = await axios.post( ` https://api.tenderly.co/api/v1/account/${TENDERLY_ACCOUNT_ID}/project/${TENDERLY_PROJECT}/contracts/encode-states`, @@ -133,6 +135,7 @@ export class TenderlySimulation implements TransactionSimulator { ); } + await process.nextTick(() => { }); // https://stackoverflow.com/questions/69169492/async-external-function-leaves-open-handles-jest-supertest-express const { data } = await axios.post( `https://api.tenderly.co/api/v1/account/${TENDERLY_ACCOUNT_ID}/project/${TENDERLY_PROJECT}/fork/${this.forkId}/simulate`, _params,