| 1 | name: Build and Test go-codec |
| 2 | on: |
| 3 | workflow_dispatch: {} |
| 4 | push: |
| 5 | branches: [ master ] |
| 6 | paths: [ '**.go' ] |
| 7 | pull_request: |
| 8 | branches: [ master ] |
| 9 | paths: [ '**.go' ] |
| 10 | jobs: |
| 11 | tests: |
| 12 | strategy: |
| 13 | fail-fast: false |
| 14 | matrix: |
| 15 | go: [ '1.19', '1.17', '1.11', '1.20.0-rc.1' ] |
| 16 | arch: [ amd64 ] |
| 17 | os: [ ubuntu-latest ] |
| 18 | include: |
| 19 | - go: '1.19' |
| 20 | arch: '386' |
| 21 | os: ubuntu-latest |
| 22 | runs-on: ${{ matrix.os }} |
| 23 | env: |
| 24 | GO111MODULE: 'on' |
| 25 | COVER_GO_VERSION: '1.19' |
| 26 | GOARCH: ${{ matrix.arch }} |
| 27 | name: go ${{ matrix.go }} on ${{ matrix.arch }} |
| 28 | steps: |
| 29 | - uses: actions/checkout@v3 |
| 30 | - uses: actions/setup-go@v3 |
| 31 | with: |
| 32 | go-version: ${{ matrix.go }} |
| 33 | - name: Run tests |
| 34 | shell: bash |
| 35 | run: | |
| 36 | cd codec |
| 37 | go mod edit -droprequire github.com/ugorji/go |
| 38 | t=( "" "safe" "notfastpath" "codecgen" ) |
| 39 | for i in "${t[@]}"; do go test "-tags=alltests ${i}" "-run=Suite" "-coverprofile=coverage.${{ matrix.go }}.${{ matrix.arch }}.${i}.txt"; done |
| 40 | - uses: codecov/codecov-action@v3 |
| 41 | if: matrix.go == env.COVER_GO_VERSION |
| 42 | with: |
| 43 | directory: ./codec |
| 44 | |
| 45 | |
| 46 | # No need to go get, as github knows its working out of this folder. |
| 47 | # |
| 48 | # Most of our code is the same since go1.12; before that we selectively compile files using build constraints. |
| 49 | # |
| 50 | # We test against the following go releases |
| 51 | # - latest production release |
| 52 | # - 2 releases before that |
| 53 | # - an archive version (go 1.11) |
| 54 | # - and a beta/rc of development release (so github can just download an archive of it and use) |
| 55 | # |
| 56 | # Pre-release versions must use semver e.g. as of 20221220, it's '1.20.0-rc.1' |
| 57 | # TODO: add this back once we resolve the issue with go-codec failing on development branch. |
| 58 | # |
| 59 | # We test amd64 on all releases, and i386 (32-bit) on last production release. |
| 60 | # |
| 61 | # We previously had each tag be its own matrix, but that exploded the number of runs. |
| 62 | # Instead, since the environment is consistent, we just use a bash script to run through all |
| 63 | # the tags for that run. |
| 64 | # |
| 65 | # Finally, we do a go mod edit -droprequire github.com/ugorji/go to circumvent the "missing go.sum entry" error. |
| 66 | # We put a requirements cycle with github.com/ugorji/go to allow folks requiring .../ugorji/go in 2019 to work ok. |
| 67 | # Now, everyone should have updated to a go-codec version >= 1.17 or preferably >= 1.2.0. |
| 68 | # Now is a good time to remove that requirements cycle. |
| 69 | # |
| 70 | # |
| 71 | # |
| 72 | # |
| 73 | # --- SCRATCH --- |
| 74 | # coverage: |
| 75 | # if: ${{ always() }} |
| 76 | # needs: [ tests] |
| 77 | # steps: |
| 78 | # - uses: codecov/codecov-action@v3 |
| 79 | # directory: ./codec |
| 80 | # |
| 81 | # steps: |
| 82 | # - uses: actions/checkout@v3 |
| 83 | # with: |
| 84 | # fetch-depth: 0 # required for new-from-rev option in .golangci.yml |