-
-
Notifications
You must be signed in to change notification settings - Fork 2
56 lines (46 loc) · 1.38 KB
/
unit-test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
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/...