-
Notifications
You must be signed in to change notification settings - Fork 67
79 lines (62 loc) · 2.04 KB
/
ci.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
name: Run tests
on: [ push, pull_request ]
env:
go-version: 1.21
UBUNTU_VERSION: linux-x86_64-ubuntu2004
jobs:
static_check:
runs-on: ubuntu-20.04
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ${{ env.go-version }}
- name: Vet code
run: go vet ./...
- name: Lint code
uses: golangci/golangci-lint-action@v3
with:
version: v1.54.1
args: --timeout 2m0s
build:
needs: static_check
runs-on: ubuntu-20.04
strategy:
matrix:
mongodb-version: [5.0.21, 6.0.9, 7.0.1, 7.0.1-sharded]
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ${{ env.go-version }}
- name: Export MongoDB version
run: echo "MONGO_VERSION=$( echo ${{ matrix.mongodb-version }} | tr -d '[:alpha:][=-=]')" >> $GITHUB_ENV
- name: Download MongoDB
run: |
wget -q http://downloads.mongodb.org/linux/mongodb-$UBUNTU_VERSION-$MONGO_VERSION.tgz
tar xzvf mongodb-$UBUNTU_VERSION-$MONGO_VERSION.tgz
echo "$PWD/mongodb-$UBUNTU_VERSION-$MONGO_VERSION/bin" >> $GITHUB_PATH
mkdir $PWD/db
- name: Setup a sharded cluster
if: contains(matrix.mongodb-version, 'sharded')
run: |
wget https://raw.githubusercontent.com/feliixx/mongodbShardedCluster/master/deploy.sh
chmod +x deploy.sh
./deploy.sh $PWD/db 2
- name: Setup a standalone db
if: contains(matrix.mongodb-version, 'sharded') == false
run: mongod --dbpath $PWD/db --logpath /dev/null --nojournal --fork
- name: Run go tests
run: ./test.sh
- name: Full run
run: |
go build
./mgodatagen -f datagen/testdata/big.json
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
files: ./coverage.txt