Skip to content

test, release: Update runner to Ubuntu 20 #315

test, release: Update runner to Ubuntu 20

test, release: Update runner to Ubuntu 20 #315

Workflow file for this run

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