feat: use monorepo architecture to manage different packages #85
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: 'Tests' | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
jobs: | |
unit-tests: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Start test containers | |
run: docker-compose -f "./dev/docker-compose.yaml" up -d | |
- name: Setup node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 20.9.x | |
cache: npm | |
- name: Cache node modules | |
id: cache-node-modules | |
uses: actions/cache@v3 | |
with: | |
path: node_modules | |
key: node-modules-${{ hashFiles('package-lock.json') }} | |
- name: Install Dependencies | |
if: steps.cache-node-modules.outputs.cache-hit != 'true' | |
run: npm install | |
- name: Mine 10 blocks | |
run: | | |
curl --header "Content-Type: application/json" -X POST http://alice:password@localhost:18443 -d '{"method": "generatetoaddress", "params": [10, "bcrt1qq2yshcmzdlznnpxx258xswqlmqcxjs4dssfxt2"]}' | |
- name: Wait for esplora to become available | |
uses: nick-fields/retry@v2 | |
with: | |
timeout_minutes: 3 | |
retry_wait_seconds: 15 | |
max_attempts: 15 | |
command: curl --fail -X GET http://localhost:8094/regtest/api/blocks/tip/height | |
- name: Run unit tests | |
run: npm run test --ws | |
env: | |
BITCOIN_RPC_USER: alice | |
BITCOIN_RPC_PASSWORD: password | |
BITCOIN_RPC_HOST: localhost:18443 | |
- name: Fetch esplora logs | |
if: always() | |
run: docker-compose -f "./dev/docker-compose.yaml" logs esplora | |
- name: Stop test containers | |
if: always() | |
run: docker-compose -f "./dev/docker-compose.yaml" down |