feat: add integration tests to actions #36
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 Tests | |
on: | |
push: | |
branches: | |
- dev | |
- dev2 | |
pull_request: | |
branches: | |
- dev | |
- dev2 | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
services: | |
docker: | |
image: docker:19.03.12 | |
options: --privileged | |
ports: | |
- 5432:5432 | |
- 18443:18443 | |
- 50001:50001 | |
- 8000:8000 | |
- 18080:18080 | |
volumes: | |
- /var/run/docker.sock:/var/run/docker.sock | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Docker Compose | |
run: | | |
docker-compose -f docker-compose-test.yml up --build -d | |
- name: Wait for services to be ready | |
run: | | |
sleep 30 # Adjust time as necessary for services to initialize | |
- name: List all running containers | |
run: | | |
docker ps -a | |
- name: Verify Mercury Service with Curl | |
run: | | |
container_id=$(docker ps -qf "ancestor=commerceblockx/mercury-server" -q | head -n 1) | |
echo "Container ID: $container_id" | |
docker exec $container_id curl http://0.0.0.0:8000/info/config | |
- name: Add Mnemonic | |
run: | | |
docker exec $(docker ps -qf "name=enclave") \ | |
curl -X POST http://0.0.0.0:18080/add_mnemonic \ | |
-H "Content-Type: application/json" \ | |
-d '{ | |
"mnemonic": "achieve merry hidden lyrics element brand student armed dismiss vague fury avocado grief crazy garlic gallery blur spider bag bless motor crawl surround copper", | |
"password": "b1gHKyfXTzs6", | |
"index": 0, | |
"threshold": 2 | |
}' | |
- name: Set up Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '20.12.2' | |
- name: Install Node.js dependencies for client | |
run: | | |
cd clients/apps/nodejs | |
npm install | |
- name: Install Node.js dependencies for lib | |
run: | | |
cd clients/libs/nodejs | |
npm install | |
- name: Run npm link | |
run: | | |
cd clients/libs/nodejs | |
npm link --save | |
- name: Link mercurynodejslib | |
run: | | |
cd clients/apps/nodejs | |
npm link mercurynodejslib | |
- name: Run Client-Side Tests | |
run: | | |
cd clients/apps/nodejs | |
node test_basic_workflow2.js | |
- name: Tear Down | |
run: | | |
docker-compose down |