Skip to content

Commit

Permalink
feat: run tests on github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
limpbrains committed Aug 21, 2024
1 parent 3c7fa84 commit 6ce32c8
Show file tree
Hide file tree
Showing 5 changed files with 177 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/lint-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: lint-check

on:
workflow_dispatch:
pull_request:

jobs:
lint:
name: Run lint check
runs-on: ubuntu-latest

steps:
- name: Check out Git repository
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'

- name: Install Node.js dependencies
run: npm install || npm install

- name: Lint check
run: npm run lint:check
43 changes: 43 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: tests

on:
workflow_dispatch:
pull_request:

jobs:
tests:
name: Run unit tests
runs-on: ubuntu-latest

steps:
- name: Check out Git repository
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Run regtest setup
run: cd docker && docker compose up --quiet-pull -d

- name: Wait for bitcoind
run: |
sudo apt install wait-for-it
wait-for-it -h 127.0.0.1 -p 43782 -t 60
- name: Wait for electrum server
run: wait-for-it -h 127.0.0.1 -p 60001 -t 60

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'

- name: Install Node.js dependencies
run: npm install || npm install

- name: Run Tests
run: npm run test

- name: Dump docker logs on failure
if: failure()
uses: jwalton/gh-docker-logs@v2
28 changes: 28 additions & 0 deletions .github/workflows/type-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: type-check

on:
workflow_dispatch:
pull_request:

jobs:
typescript:
name: Run type check
runs-on: ubuntu-latest

steps:
- name: Check out Git repository
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'

- name: Install Node.js dependencies
run: npm install || npm install

- name: Type check
run: npm run tsc:check
77 changes: 77 additions & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
services:
bitcoind:
container_name: bitcoin
image: btcpayserver/bitcoin:26.0
restart: unless-stopped
expose:
- '43782'
- '39388'
ports:
- '43782:43782'
- '39388:39388'
volumes:
- 'bitcoin_home:/home/bitcoin/.bitcoin'
environment:
BITCOIN_NETWORK: ${NBITCOIN_NETWORK:-regtest}
CREATE_WALLET: 'true'
BITCOIN_WALLETDIR: '/walletdata'
BITCOIN_EXTRA_ARGS: |
rpcport=43782
rpcbind=0.0.0.0:43782
rpcallowip=0.0.0.0/0
port=39388
whitelist=0.0.0.0/0
maxmempool=500
rpcauth=polaruser:5e5e98c21f5c814568f8b55d83b23c1c$$066b03f92df30b11de8e4b1b1cd5b1b4281aa25205bd57df9be82caf97a05526
txindex=1
fallbackfee=0.00001
zmqpubrawblock=tcp://0.0.0.0:28334
zmqpubrawtx=tcp://0.0.0.0:28335
zmqpubhashblock=tcp://0.0.0.0:28336
bitcoinsetup:
image: btcpayserver/bitcoin:26.0
depends_on:
- bitcoind
restart: 'no'
volumes:
- 'bitcoin_home:/home/bitcoin/.bitcoin'
user: bitcoin
# generate one block so electrs stop complaining
entrypoint:
[
'bash',
'-c',
'sleep 1; while ! bitcoin-cli -rpcconnect=bitcoind -generate 1; do sleep 1; done',
]

electrs:
container_name: electrum
image: getumbrel/electrs:v0.10.2
restart: unless-stopped
depends_on:
- bitcoind
expose:
- '60001'
- '28334'
- '28335'
- '28336'
ports:
- '60001:60001'
# - '28334:28334'
# - '28335:28335'
# - '28336:28336'
volumes:
- './electrs.toml:/data/electrs.toml'
environment:
- ELECTRS_NETWORK=regtest
- ELECTRS_ELECTRUM_RPC_ADDR=electrs:60001
- ELECTRS_DAEMON_RPC_ADDR=bitcoind:43782
- ELECTRS_DAEMON_P2P_ADDR=bitcoind:39388
- ELECTRS_LOG_FILTERS=INFO


volumes:
bitcoin_home:

networks: {}
1 change: 1 addition & 0 deletions docker/electrs.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
auth = "polaruser:polarpass"

0 comments on commit 6ce32c8

Please sign in to comment.