ci: sleep for 5 second to wait the server start #3
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: Test | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '1.21.7' | |
- run: go test -v | |
- run: go build . | |
stress-test: | |
runs-on: ubuntu-latest | |
services: | |
mongodb: | |
image: mongo | |
ports: | |
- 27017:27017 | |
env: | |
MONGO_INITDB_ROOT_USERNAME: user | |
MONGO_INITDB_ROOT_PASSWORD: password | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '1.21.7' | |
- run: go build . | |
- run: ./ad-service & sleep 5 && disown | |
env: | |
GIN_MODE: release | |
MONGODB_URI: mongodb://user:password@mongo:27017 | |
- name: Run k6 test | |
uses: grafana/k6-action@v0.3.1 | |
with: | |
filename: scripts/stress.js | |
flags: --vus 100 --duration 10s |