Skip to content

CI: Run jobs on ubuntu 22.04 #329

CI: Run jobs on ubuntu 22.04

CI: Run jobs on ubuntu 22.04 #329

Workflow file for this run

name: Run tests
on: [ push, pull_request ]
env:
go-version: 1.23
UBUNTU_VERSION: linux-x86_64-ubuntu2004
jobs:
static_check:
runs-on: ubuntu-22.04
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.go-version }}
- name: Vet code
run: go vet ./...
- name: Lint code
uses: golangci/golangci-lint-action@v6
with:
version: v1.62.2
args: --timeout 2m0s
build:
needs: static_check
runs-on: ubuntu-22.04
strategy:
matrix:
mongodb-version: [6.0.19, 7.0.15, 8.0.3, 8.0.3-sharded]
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
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 --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@v5
with:
files: ./coverage.txt