Skip to content

Commit

Permalink
Run Jellyfish Tests in parallel (#2865)
Browse files Browse the repository at this point in the history
* extend timeout

* matrix

* revert timeout

* reflow jf ci

* docker build from bin on the fly

* move artifact to build

* package

* global env.TARGET
  • Loading branch information
canonbrother authored Mar 21, 2024
1 parent 2dea1cc commit fe1a87d
Showing 1 changed file with 83 additions and 12 deletions.
95 changes: 83 additions & 12 deletions .github/workflows/tests-jellyfish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,36 +11,107 @@ concurrency:
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}

env:
BUILD_VERSION: latest # Computed
BUILD_VERSION: latest
TARGET: x86_64-pc-linux-gnu
MAKE_DEBUG: 0
GIT_VERSION: 1

jobs:
build:
runs-on: ubuntu-latest
container: defi/ain-builder:latest
env:
CARGO_INCREMENTAL: 0
steps:
- uses: actions/checkout@v4
- run: git config --global --add safe.directory '*'

- name: Populate environment
run: ./make.sh ci-export-vars

- name: Setup dependencies
run: ./make.sh ci-setup-deps

- name: Setup user dependencies
run: ./make.sh ci-setup-user-deps

- name: Restore cpp build cache
id: cpp-cache-restore
uses: actions/cache/restore@v3
with:
path: |
./build/depends
./build/src
~/.ccache
key: cpp-${{ env.TARGET }}-${{ env.BUILD_TYPE }}

- name: Rust build cache
uses: Swatinem/rust-cache@v2
id: rust-cache-restore
with:
workspaces: lib -> ../build/lib/target
save-if: ${{ github.ref == 'refs/heads/master' }}
shared-key: ${{ env.TARGET }}

- name: Build binaries
run: ./make.sh build

- name: Pack binaries
run: ./make.sh deploy && ./make.sh package

- name: Upload binaries
uses: actions/upload-artifact@v3
with:
name: defi-bins
path: ./build/defichain-${{ env.BUILD_VERSION }}-${{ env.TARGET }}.${{ env.PKG_TYPE }}

test:
name: Test
runs-on: ubuntu-latest
needs: [build]
strategy:
fail-fast: false
matrix:
instance: [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ]

env:
GH_INSTANCE_TOTAL: 10

steps:
- uses: actions/checkout@v4

- name: Populate environment
run: ./make.sh ci-export-vars

- name: Download binaries
uses: actions/download-artifact@v3
with:
repository: JellyfishSDK/jellyfish
ref: 'main'
name: defi-bins
path: ./build/

- name: Unpack binaries
run: tar -xvzf ./build/defichain-${{ env.BUILD_VERSION }}-${{ env.TARGET }}.${{ env.PKG_TYPE }} -C ./build/

- name: Build defi image
run: rm .dockerignore && ./make.sh docker-build-from-binaries

- uses: actions/checkout@v4
with:
path: defichain
repository: JellyfishSDK/jellyfish
ref: 'main'
path: jellyfish

- uses: actions/setup-node@v3
with:
node-version: '18'

- name: Populate environment
run: cd defichain && GIT_VERSION=1 ./make.sh ci-export-vars

- name: Build and setup
run: "cd defichain && docker build -t test-build-container
-f ./contrib/dockerfiles/x86_64-pc-linux-gnu.dockerfile ."

- name: Run tests
run: |
cd jellyfish
npm ci
npm run compile
DEFICHAIN_DOCKER_IMAGE=test-build-container npm run ci:test -- --testTimeout=600000
set -e; ver=${{ env.BUILD_VERSION }}
DEFICHAIN_DOCKER_IMAGE=defichain-${{ env.TARGET }}:${ver} npm run ci:test -- --testTimeout=600000
env:
GH_INSTANCE_INDEX: ${{ matrix.instance }}

0 comments on commit fe1a87d

Please sign in to comment.