run go fmt & go mod tidy on project #40
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Test go-codec | |
on: | |
workflow_dispatch: {} | |
push: | |
branches: [ master ] | |
paths: [ '**.go' ] | |
pull_request: | |
branches: [ master ] | |
paths: [ '**.go' ] | |
jobs: | |
tests: | |
strategy: | |
fail-fast: false | |
matrix: | |
go: [ '1.19', '1.17', '1.11', '1.20.0-rc.1' ] | |
arch: [ amd64 ] | |
os: [ ubuntu-latest ] | |
include: | |
- go: '1.19' | |
arch: '386' | |
os: ubuntu-latest | |
runs-on: ${{ matrix.os }} | |
env: | |
GO111MODULE: 'on' | |
COVER_GO_VERSION: '1.19' | |
GOARCH: ${{ matrix.arch }} | |
name: go ${{ matrix.go }} on ${{ matrix.arch }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-go@v3 | |
with: | |
go-version: ${{ matrix.go }} | |
- name: Run tests | |
shell: bash | |
run: | | |
cd codec | |
go mod edit -droprequire github.com/ugorji/go | |
t=( "" "safe" "notfastpath" "codecgen" ) | |
for i in "${t[@]}"; do go test "-tags=alltests ${i}" "-run=Suite" "-coverprofile=coverage.${{ matrix.go }}.${{ matrix.arch }}.${i}.txt"; done | |
- uses: codecov/codecov-action@v3 | |
if: matrix.go == env.COVER_GO_VERSION | |
with: | |
directory: ./codec | |
# No need to go get, as github knows its working out of this folder. | |
# | |
# Most of our code is the same since go1.12; before that we selectively compile files using build constraints. | |
# | |
# We test against the following go releases | |
# - latest production release | |
# - 2 releases before that | |
# - an archive version (go 1.11) | |
# - and a beta/rc of development release (so github can just download an archive of it and use) | |
# | |
# Pre-release versions must use semver e.g. as of 20221220, it's '1.20.0-rc.1' | |
# TODO: add this back once we resolve the issue with go-codec failing on development branch. | |
# | |
# We test amd64 on all releases, and i386 (32-bit) on last production release. | |
# | |
# We previously had each tag be its own matrix, but that exploded the number of runs. | |
# Instead, since the environment is consistent, we just use a bash script to run through all | |
# the tags for that run. | |
# | |
# Finally, we do a go mod edit -droprequire github.com/ugorji/go to circumvent the "missing go.sum entry" error. | |
# We put a requirements cycle with github.com/ugorji/go to allow folks requiring .../ugorji/go in 2019 to work ok. | |
# Now, everyone should have updated to a go-codec version >= 1.17 or preferably >= 1.2.0. | |
# Now is a good time to remove that requirements cycle. | |
# | |
# | |
# | |
# | |
# --- SCRATCH --- | |
# coverage: | |
# if: ${{ always() }} | |
# needs: [ tests] | |
# steps: | |
# - uses: codecov/codecov-action@v3 | |
# directory: ./codec | |
# | |
# steps: | |
# - uses: actions/checkout@v3 | |
# with: | |
# fetch-depth: 0 # required for new-from-rev option in .golangci.yml |