-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[test] chore: adding github action for contract test
- Loading branch information
1 parent
4e5b3be
commit e931660
Showing
2 changed files
with
65 additions
and
0 deletions.
There are no files selected for viewing
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
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 |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.