fix: breaking failing tests (#22) #99
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: Unit Tests | |
on: | |
workflow_dispatch: | |
push: | |
branches: ["main"] | |
pull_request: | |
jobs: | |
tests: | |
name: Unit Tests | |
runs-on: ubuntu-latest | |
env: | |
MONGO_URI: mongodb://localhost:27017 | |
MONGO_DB: opensource | |
MONGO_COLLECTION: contributors | |
BASIC_AUTH_USERNAME: user | |
BASIC_AUTH_PASSWORD: pass | |
REDIS_URI: localhost:6379 | |
REDIS_RATE_LIMIT: 100 | |
steps: | |
- name: MongoDB | |
uses: supercharge/mongodb-github-action@v1 | |
with: | |
mongodb-version: '7.0' | |
mongodb-port: 27017 | |
- name: Redis | |
uses: supercharge/[email protected] | |
with: | |
redis-version: '7.0' | |
redis-port: 6379 | |
- name: Checkout Repo Code | |
uses: actions/checkout@v4 | |
- name: Setup mongodb-tools | |
run: | | |
wget https://fastdl.mongodb.org/tools/db/mongodb-database-tools-ubuntu2204-x86_64-100.6.1.deb | |
sudo apt install ./mongodb-database-tools-*-100.6.1.deb | |
mongorestore --version | |
- name: Migrate database | |
run: mongoimport --db $MONGO_DB --collection $MONGO_COLLECTION --file ./tests/testdata.json --jsonArray --drop | |
- name: Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: 1.23 | |
- name: Clear Test Cache | |
run: go clean -testcache | |
- name: Run Unit Tests | |
run: go test -v ./tests/... |