Skip to content

Merge pull request #19 from SolaceDev/dev #32

Merge pull request #19 from SolaceDev/dev

Merge pull request #19 from SolaceDev/dev #32

Workflow file for this run

name: Test
# Controls when the workflow will run
on: [push, pull_request, workflow_dispatch]
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains multiple jobs
# this job sets up the oldest version of go to check lang compatibility
CompatibilityCheck:
runs-on: ubuntu-20.04
#Steps for the compatiblity test
steps:
- uses: actions/checkout@v2
- name: Setup Go Environment
uses: actions/setup-go@v4
with:
go-version: '1.17.0'
- name: Check Go Version
run: go version
- name: Compiles
run: go build ./...
- name: Runs unit tests
if: ${{ success() }}
run: go test -coverprofile ./unitcoverage.out ./...
- name: Uploads artifacts
if: ${{ always() }}
uses: actions/upload-artifact@v2
with:
path: |
./unitcoverage.out
# this job runs linux based tests
Linux:
# The type of runner that the job will run on
runs-on: ubuntu-20.04
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: Setup Go environment
uses: actions/setup-go@v2.1.3
with:
go-version: '1.22'
check-latest: true
- name: Check Go Version
run: go version
- name: run go tool staticcheck
# use pinned version of staticcheck this need to match with the go version for compatibility
# Compatibility with go version is listed in the release description of https://github.com/dominikh/go-tools/releases
# need at least version v0.4.4 for go version 1.21
run: |
go install honnef.co/go/tools/cmd/staticcheck@v0.4.6
staticcheck -checks=all ./...
- name: Compiles
if: ${{ success() }}
run: go build ./...
- name: Runs go fmt
if: ${{ success() }}
run: |
OUTPUT=$(go fmt ./... 2>&1)
if [ ! -z "$OUTPUT" ]; then
echo "go fmt failed on the following files:"
echo "$OUTPUT"
exit 1
fi
- name: Runs go vet
if: ${{ success() }}
run: |
OUTPUT=$(go vet ./... 2>&1)
if [ ! -z "$OUTPUT" ]; then
echo "go vet failed on the following:"
echo "$OUTPUT"
exit 1
fi
- name: Runs staticcheck
if: ${{ success() }}
run: |
# use pinned version of the tool but check if this needs an update on go version bump
go install honnef.co/go/tools/cmd/staticcheck@v0.4.7
OUTPUT=$(staticcheck --checks=all ./...)
if [ ! -z "$OUTPUT" ]; then
echo "staticcheck failed on the following:"
echo "$OUTPUT"
exit 1
fi
- name: Runs unit tests
if: ${{ success() }}
run: go test -coverprofile ./unitcoverage.out ./...
- name: Generates the SEMPv2 client
if: ${{ success() }}
run: |
go generate .
working-directory: ./test/sempclient
- name: Runs the integration tests
if: ${{ success() }}
run: |
mkdir reports
go install github.com/onsi/ginkgo/v2/ginkgo@v2.1.3
ginkgo --junit-report=./reports/report.xml -coverprofile ./reports/coverage.out -coverpkg solace.dev/go/messaging/internal/...,solace.dev/go/messaging/pkg/... -tags enable_debug_logging
working-directory: ./test
- name: Uploads artifacts
if: ${{ always() }}
uses: actions/upload-artifact@v2
with:
path: |
./unitcoverage.out
./test/reports/report.xml
./test/reports/coverage.out
./test/diagnostics.tgz