Skip to content

Commit

Permalink
[test] chore: adding github action for contract test
Browse files Browse the repository at this point in the history
  • Loading branch information
helloitsdave committed May 25, 2024
1 parent 4e5b3be commit e931660
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 0 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/backend-contract-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Backend Contract Tests

on:
push:
branches: [ "main" ]
paths:
- "backend/**"
pull_request:
branches: [ "main" ]
paths:
- "backend/**"

defaults:
run:
working-directory: ./backend

jobs:
build:
runs-on: ubuntu-latest
env:
API_URL: http://localhost:5000
steps:
- uses: actions/checkout@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Use Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: 18.x

- name: Create .env file
run: |
echo "JWT_SECRET=${{ secrets.JWT_SECRET }}" > .env
echo "CONTRACT_TEST_AUTH_TOKEN=${{ secrets.CONTRACT_TEST_AUTH_TOKEN }}" >> .env
- name: Start service in docker
run: |
npm run docker:up
- name: Wait for service to start
run: |
sleep 15
- name: Print application logs
run: docker-compose logs

- name: Test connectivity
run: curl ${API_URL}

- name: Run Service Tests
run: |
npm ci
npm run test:scontract
- name: Stop service in docker
run: |
npm run docker:down
6 changes: 6 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e931660

Please sign in to comment.