Skip to content

Commit 3b2104e

Browse files
fariedtzone117x
authored andcommitted
test: add github action to test rosetta endpoints
Also add "npm run test:integration:rosetta" Change made by @zone117x in https://github.com/fariedt/stacks-blockchain-api/pull/2
1 parent 93c1538 commit 3b2104e

File tree

4 files changed

+57
-0
lines changed

4 files changed

+57
-0
lines changed

.github/workflows/stacks-blockchain-api.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,46 @@ jobs:
129129
uses: codecov/codecov-action@v1
130130
if: always()
131131

132+
test-rosetta:
133+
runs-on: ubuntu-latest
134+
steps:
135+
- uses: actions/checkout@v2
136+
137+
- name: Use Node.js
138+
uses: actions/setup-node@v1
139+
with:
140+
node-version: '13.x'
141+
142+
- name: Install deps
143+
run: npm install
144+
145+
- name: Setup integration environment
146+
run: |
147+
sudo ufw disable
148+
echo "::set-env name=STACKS_CORE_EVENT_HOST::http://0.0.0.0"
149+
npm run devenv:deploy -- -d
150+
npm run devenv:logs -- --no-color &> docker-compose-logs.txt &
151+
152+
- name: Run tests
153+
run: npm run test:rosetta
154+
155+
- name: Print integration environment logs
156+
run: cat docker-compose-logs.txt
157+
if: failure()
158+
159+
- name: Teardown integration environment
160+
run: npm run devenv:stop
161+
if: always()
162+
163+
- name: Upload coverage to Codecov
164+
uses: codecov/codecov-action@v1
165+
if: always()
166+
132167
build-publish:
133168
runs-on: ubuntu-latest
134169
needs:
135170
- test
171+
- test-rosetta
136172
- lint
137173
- lint-docs
138174
steps:
@@ -189,6 +225,7 @@ jobs:
189225
- lint
190226
- lint-docs
191227
- test
228+
- test-rosetta
192229
- build-publish
193230
# Only run on non-PR events or only PRs that aren't from forks
194231
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"test:rosetta": "cross-env NODE_ENV=development jest --config ./jest.config.rosetta.js --coverage --runInBand",
1212
"test:watch": "cross-env NODE_ENV=development jest --config ./jest.config.js --watch",
1313
"test:integration": "npm run devenv:deploy -- -d && cross-env NODE_ENV=development jest --config ./jest.config.js --coverage --no-cache --runInBand; npm run devenv:stop",
14+
"test:integration:rosetta": "npm run devenv:deploy -- -d && cross-env NODE_ENV=development jest --config ./jest.config.rosetta.js --coverage --no-cache --runInBand; npm run devenv:stop",
1415
"build": "rimraf ./lib && tsc",
1516
"start": "node ./lib/index.js",
1617
"lint": "npm run lint:eslint && npm run lint:prettier",

stacks-blockchain/docker/Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ FROM debian:stretch
1414
COPY wait-for-it.sh /bin/wait-for-it.sh
1515
RUN chmod +x /bin/wait-for-it.sh
1616

17+
COPY docker-entrypoint.sh /bin/
18+
RUN chmod +x /bin/docker-entrypoint.sh
19+
1720
COPY --from=build /bin/stacks-node /bin/
1821

22+
ENTRYPOINT ["/bin/docker-entrypoint.sh"]
1923
CMD ["stacks-node"]
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/env bash
2+
# Use this script to enable host.docker.internal on Docker for linux.
3+
# See https://github.com/bufferings/docker-access-host
4+
5+
HOST_DOMAIN="host.docker.internal"
6+
ping -q -c1 $HOST_DOMAIN > /dev/null 2>&1
7+
if [ $? -ne 0 ]; then
8+
HOST_IP=$(ip route | awk 'NR==1 {print $3}')
9+
echo -e "$HOST_IP\t$HOST_DOMAIN" >> /etc/hosts
10+
fi
11+
12+
cat /etc/hosts
13+
echo "patched host.docker.internal"
14+
15+
exec "$@"

0 commit comments

Comments
 (0)