Skip to content

Commit

Permalink
Merge pull request #268 from hashicorp/upgrade-sys-module
Browse files Browse the repository at this point in the history
Move CI job to github action; Upgrade golang.org/x/sys to make it work on go1.18
  • Loading branch information
huikang committed Jul 29, 2022
2 parents 696ff46 + a87a7dd commit 05405d0
Show file tree
Hide file tree
Showing 4 changed files with 122 additions and 57 deletions.
56 changes: 0 additions & 56 deletions .circleci/config.yml

This file was deleted.

119 changes: 119 additions & 0 deletions .github/workflows/check.yml
@@ -0,0 +1,119 @@
name: Checks

on:
pull_request:

# This workflow runs for not-yet-reviewed external contributions and so it
# intentionally has no write access and only limited read access to the
# repository.
permissions:
contents: read

jobs:
unit-tests:
name: "Unit Tests"
runs-on: ubuntu-latest
strategy:
matrix:
GO_VERSION: [ "1.16","1.17","1.18" ]
steps:
- name: "Fetch source code"
uses: actions/checkout@v2

- name: Install Go toolchain
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.GO_VERSION }}

# NOTE: This cache is shared so the following step must always be
# identical across the unit-tests, e2e-tests, and consistency-checks
# jobs, or else weird things could happen.
- name: Cache Go modules
uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: go-mod-${{ matrix.GO_VERSION }}-${{ hashFiles('go.sum') }}
restore-keys: |
go-mod-${{ matrix.GO_VERSION }}
- name: "Unit tests"
run: |
go test ./...
unit-tests-race:
name: "Unit Tests Race"
runs-on: ubuntu-latest
strategy:
matrix:
GO_VERSION: [ "1.16","1.17","1.18" ]
steps:
- name: "Fetch source code"
uses: actions/checkout@v2

- name: Install Go toolchain
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.GO_VERSION }}

# NOTE: This cache is shared so the following step must always be
# identical across the unit-tests, e2e-tests, and consistency-checks
# jobs, or else weird things could happen.
- name: Cache Go modules
uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: go-mod-${{ matrix.GO_VERSION }}-${{ hashFiles('go.sum') }}
restore-keys: |
go-mod-${{ matrix.GO_VERSION }}
- name: "Race Unit tests"
run: |
go test -race ./...
consistency-checks:
name: "Code Consistency Checks"
runs-on: ubuntu-latest
strategy:
matrix:
GO_VERSION: [ "1.16","1.17","1.18" ]
steps:
- name: "Fetch source code"
uses: actions/checkout@v2

- name: Install Go toolchain
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.GO_VERSION }}

# NOTE: This cache is shared so the following step must always be
# identical across the unit-tests and consistency-checks
# jobs, or else weird things could happen.
- name: Cache Go modules
uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: go-mod-${{ matrix.GO_VERSION }}-${{ hashFiles('go.sum') }}
restore-keys: |
go-mod-${{ matrix.GO_VERSION }}
- name: "go.mod and go.sum consistency check"
run: |
go mod tidy
if [[ -n "$(git status --porcelain)" ]]; then
echo >&2 "ERROR: go.mod/go.sum are not up-to-date. Run 'go mod tidy' and then commit the updated files."
exit 1
fi
- name: "go vet"
run: |
go vet ./...
- name: "go fmt check"
run: |
files=$(go fmt ./...)
if [ -n "$files" ]; then
echo "The following file(s) do not conform to go fmt:"
echo "$files"
exit 1
fi
1 change: 1 addition & 0 deletions go.mod
Expand Up @@ -15,4 +15,5 @@ require (
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529
github.com/stretchr/testify v1.2.2
golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10 // indirect
)
3 changes: 2 additions & 1 deletion go.sum
Expand Up @@ -39,8 +39,9 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEha
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190922100055-0a153f010e69/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe h1:6fAMxZRR6sl1Uq8U61gxU+kPTs2tR8uOySCbBP7BN/M=
golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10 h1:WIoqL4EROvwiPdUtaip4VcDdpZ4kha7wBWZrbVKCIZg=
golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
Expand Down

0 comments on commit 05405d0

Please sign in to comment.