ci: bump to go 1.20 (#375)

* Update CI Go version to 1.20/1.19
* Update `golangci-lint` to v1.51.2
* Update coverage collection to use new Go 1.20 tools
* Update coverage job to only run on latest Go version

Fixes #367
This commit is contained in:
Michael McLoughlin
2023-03-05 14:22:23 -08:00
committed by GitHub
parent 881df56d21
commit 1bba0bed7f
13 changed files with 98 additions and 86 deletions

View File

@@ -1,7 +1,17 @@
#!/bin/bash -ex
#!/bin/bash
set -euo pipefail
ext=".coverprofile"
# Temporary working directory.
workdir=$(mktemp -d)
function cleanup() {
rm -rf "${workdir}"
}
trap cleanup EXIT
# Clean existing coverage files.
find . -name '*'${ext} | xargs rm -f
@@ -9,16 +19,27 @@ find . -name '*'${ext} | xargs rm -f
go test -covermode=count -coverprofile=unittests${ext} ./...
# Integration test coverage.
coverprofiles=()
#
# Collect for each individual avo assembly generator.
coverbase="${workdir}/cover"
coversingle="${coverbase}/test"
mkdir -p "${coversingle}"
coverdirs=()
for main in $(find . -name 'asm.go'); do
dir=$(dirname ${main})
name=$(basename ${dir})
coverprofile="${dir}/${name}${ext}"
./script/covermain ${main} ${coverprofile} > /dev/null
coverprofiles+=(${coverprofile})
coverdir="${coversingle}/${name}"
mkdir "${coverdir}"
GOCOVERDIR="${coverdir}" go run -tags=integration -cover "${main}" -out /dev/null
coverdirs+=("${coverdir}")
done
covertool merge --output integration${ext} ${coverprofiles[@]}
# Merge.
covertool merge --output all${ext} unittests${ext} integration${ext}
# Merge integration test coverage.
covermergeinputs=$(IFS=","; echo "${coverdirs[*]}")
covermergeoutput="${coverbase}/merge"
mkdir "${covermergeoutput}"
go tool covdata merge -i="${covermergeinputs}" -o="${covermergeoutput}"
go tool covdata textfmt -i="${covermergeoutput}" -o="integration${ext}"