Skip to content

Build and test on all supported Golang versions #6

Build and test on all supported Golang versions

Build and test on all supported Golang versions #6

Workflow file for this run

name: Build and test on all supported Golang versions
# on:
# push:
# branches:
# - main
# pull_request:
# types: [opened, synchronize, reopened]
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
go_version:
- { version: "1.20", exclude_dirs: "" }
- { version: "1.19", exclude_dirs: "" }
- { version: "1.18", exclude_dirs: "./example/grpc-client-server ./instrumentation/cloud.google.com/go ./instrumentation/instaawsv2" }
- { version: "1.17", exclude_dirs: "./internal/bin/sql ./example/gin ./example/sql-redis ./example/gorm-postgres ./example/gorm-sqlite ./example/grpc-client-server ./instrumentation/cloud.google.com/go ./instrumentation/instabeego ./example/beego ./instrumentation/instaawsv2" }
- { version: "1.16", exclude_dirs: "./internal/bin/sql ./example/gin ./example/sql-redis ./example/grpc-client-server ./instrumentation/instafiber ./example/gorm-postgres ./example/gorm-sqlite ./instrumentation/instasarama ./instrumentation/instasarama/example ./example/kafka-producer-consumer ./instrumentation/cloud.google.com/go ./instrumentation/instabeego ./example/beego ./instrumentation/instaawsv2" }
- { version: "1.15", exclude_dirs: "./instrumentation/instaredigo ./internal/bin/sql ./example/gin ./example/sql-redis ./instrumentation/instagorm ./example/grpc-client-server ./instrumentation/instafiber ./example/gorm-postgres ./example/gorm-sqlite ./instrumentation/instasarama ./instrumentation/instasarama/example ./example/kafka-producer-consumer ./instrumentation/cloud.google.com/go ./instrumentation/instabeego ./example/beego ./instrumentation/instaawsv2" }
- { version: "1.14", exclude_dirs: "./instrumentation/instaecho ./instrumentation/instaredigo ./internal/bin/sql ./instrumentation/cloud.google.com/go ./example/gin ./instrumentation/instagorm ./example/grpc-client-server ./instrumentation/instafiber ./instrumentation/instaawsv2 ./example/sql-redis ./example/gorm-postgres ./example/gorm-sqlite ./instrumentation/instasarama ./instrumentation/instasarama/example ./example/kafka-producer-consumer ./instrumentation/instabeego ./example/beego" }
- { version: "1.13", exclude_dirs: "./instrumentation/instaecho ./instrumentation/instaredigo ./internal/bin/sql ./instrumentation/cloud.google.com/go ./example/gin ./instrumentation/instagorm ./example/grpc-client-server ./instrumentation/instafiber ./instrumentation/instaawsv2 ./example/sql-redis ./example/gorm-postgres ./example/gorm-sqlite ./instrumentation/instasarama ./instrumentation/instasarama/example ./example/kafka-producer-consumer ./instrumentation/instabeego ./example/beego" }
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go_version.version }}
- name: Restore Cache
uses: actions/cache@v2
with:
path: /go/pkg/mod
key: go-mod-v4-${{ runner.os }}-${{ hashFiles('go.sum') }}
- name: Setup databases and other things
run: |
#!/bin/bash
echo "Starting Couchbase"
docker-compose -f docker-compose-integration.yaml up -d
echo "Starting Postgres"
sudo systemctl start postgresql.service
sudo -u postgres psql -c "ALTER USER postgres PASSWORD 'mysecretpassword'"
echo "After starting Postgres"
sudo apt-get --allow-releaseinfo-change-suite update -y && sudo apt-get install ca-certificates libgnutls30 -y || true
go install golang.org/x/tools/cmd/goimports@latest || true
- name: Check fmt
run: sudo make fmtcheck
- name: Check imports
run: sudo make importcheck
- name: Run unit tests
run: sudo make test
env:
RUN_LINTER: yes
EXCLUDE_DIRS: ${{ matrix.go_version.exclude_dirs }}
GO111MODULE: "auto"
VENDOR_DEPS: no
- name: Run integration tests
run: sudo make integration
env:
EXCLUDE_DIRS: ${{ matrix.go_version.exclude_dirs }}
GO111MODULE: "auto"
VENDOR_DEPS: no
- name: Save Cache
uses: actions/cache@v2
with:
path: /go/pkg/mod
key: go-mod-v4-${{ runner.os }}-${{ hashFiles('go.sum') }}