[WIP] [TEST] [DO NOT MERGE] Aba ci speeding up test #211
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: Integration test - API | |
on: pull_request | |
jobs: | |
build-docker-images: | |
name: Build docker images with cache | |
strategy: | |
matrix: | |
include: | |
- image: matterlabs/block-explorer-app:pr | |
dockerfile: ./packages/app/Dockerfile | |
name: docker-block-explorer-app | |
- image: matterlabs/block-explorer-worker:pr | |
dockerfile: ./packages/worker/Dockerfile | |
name: docker-block-explorer-worker | |
- image: matterlabs/block-explorer-data-fetcher:pr | |
dockerfile: ./packages/data-fetcher/Dockerfile | |
name: docker-block-explorer-data-fetcher | |
- image: matterlabs/block-explorer-api:pr | |
dockerfile: ./packages/api/Dockerfile | |
name: docker-block-explorer-api | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build and push block-explorer-app | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ${{ matrix.dockerfile }} | |
tags: ${{ matrix.image }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
outputs: type=docker,dest=/tmp/${{ matrix.name }}.tar | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ matrix.name }} | |
path: /tmp/${{ matrix.name }}.tar | |
# SPLIT TESTS BY CHUNKS LIKE THAT: | |
# https://gist.github.com/imhoffd/b4ca0a94c2496d81303ebb00063a863d | |
# removes necessity to always update CI file when new .ts added | |
# you control number of parallel chunks | |
run-tests: | |
timeout-minutes: 30 | |
runs-on: ubuntu-latest | |
needs: build-docker-images | |
strategy: | |
matrix: | |
node-version: ['lts/*'] # 18.17.1 or lts/* | |
test-pattern: | |
- accounts.test.ts | |
# - addresses.test.ts | |
# - batches.test.ts | |
# - blocks.test.ts | |
# - contracts.test.ts | |
# - logs.test.ts | |
# - stats.test.ts | |
# - tokens.test.ts | |
# - transactions.test.ts | |
name: 'API test set: ${{ matrix.test-pattern}} / Node: ${{ matrix.node-version}}' | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: npm | |
- name: Download prebuilt docker images | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: docker-* | |
path: /tmp | |
- name: Load image | |
run: | | |
docker load --input /tmp/*.tar | |
docker image ls -a | |
# - uses: isbang/[email protected] | |
# with: | |
# compose-file: "./docker/docker-compose-prebuilt.yaml" | |
# down-flags: "--volumes" | |
# | |
# - name: API tests run (parallel) | |
# working-directory: packages/integration-tests | |
# run: | | |
# npm ci --no-audit | |
# npx playwright install --with-deps chromium | |
# | |
# - name: API tests run (parallel) | |
# working-directory: packages/integration-tests | |
# run: | | |
# npx jest --verbose --testPathPattern=${{ matrix.test-pattern }} |