From 1e5b6e40adb9966127c09ee67966878f5ac6fe7b Mon Sep 17 00:00:00 2001 From: Brenan Kelley Date: Mon, 20 May 2024 20:27:51 -0700 Subject: [PATCH 1/4] add: contributing.md --- CONTRIBUTING.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..87d0e00 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,17 @@ +# Contributing + +## Linting +Make sure your code has been linted using [golangci-lint](https://github.com/golangci/golangci-lint?tab=readme-ov-file#install-golangci-lint) + +```shell +$ golangci-lint run +``` + +## Tests + +If you want to submit a bug fix or new feature, make sure that all tests are passing. +```shell +$ go test ./... +``` + + From 27bb2dde85660ba1bc79a6123c4b230d236d022e Mon Sep 17 00:00:00 2001 From: Brenan Kelley Date: Mon, 20 May 2024 20:47:59 -0700 Subject: [PATCH 2/4] fix: simplify & update ghas --- .github/workflows/golangci-lint.yml | 20 +++++++------------- .github/workflows/test.yml | 27 ++++++++++----------------- 2 files changed, 17 insertions(+), 30 deletions(-) diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index fcf128a..596edad 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -9,21 +9,15 @@ on: pull_request: jobs: golangci: - name: lint + name: Lint runs-on: ubuntu-latest + permissions: + contents: read # allow read access to the content for analysis. + checks: write # allow write access to checks to allow the action to annotate code in the PR. steps: - - uses: actions/checkout@v2 - - name: Cache-Go - uses: actions/cache@v1 - with: - path: | - ~/go/pkg/mod # Module download cache - ~/.cache/go-build # Build cache (Linux) - ~/Library/Caches/go-build # Build cache (Mac) - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + - name: Checkout + uses: actions/checkout@v4 - name: golangci-lint - uses: golangci/golangci-lint-action@v2 + uses: golangci/golangci-lint-action@v6 with: version: latest diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 05effc0..07ae067 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,27 +2,20 @@ on: [push, pull_request] name: Test jobs: test: + name: Test + permissions: + contents: read strategy: matrix: - go-version: [1.14.x, 1.15.x, 1.16.x, 1.17.x] + go-version: ['1.14', '1.15', '1.16', '1.17', '1.22'] os: [ubuntu-latest, macos-latest, windows-latest] runs-on: ${{ matrix.os }} steps: - - name: Install Go - uses: actions/setup-go@v2 + - name: Checkout + uses: actions/checkout@v4 + - name: Setup Golang + uses: actions/setup-go@v5 with: - go-version: ${{ matrix.go-version }} - - name: Cache-Go - uses: actions/cache@v1 - with: - path: | - ~/go/pkg/mod # Module download cache - ~/.cache/go-build # Build cache (Linux) - ~/Library/Caches/go-build # Build cache (Mac) - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - - name: Checkout code - uses: actions/checkout@v2 - - name: Test + go-version: "${{ matrix.go-version }}" + - name: Go Test run: go test ./... From 909bd3b609dd1a6f91c1832c8b3eb4bde0726524 Mon Sep 17 00:00:00 2001 From: Brenan Kelley Date: Mon, 20 May 2024 22:13:23 -0700 Subject: [PATCH 3/4] fix: explicitly list golang versions --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 07ae067..d8f8986 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,7 +7,7 @@ jobs: contents: read strategy: matrix: - go-version: ['1.14', '1.15', '1.16', '1.17', '1.22'] + go-version: ['1.14.15', '1.15.15', '1.16.15', '1.17.13', '1.22.3'] os: [ubuntu-latest, macos-latest, windows-latest] runs-on: ${{ matrix.os }} steps: From 3e4aba3bf61befd362919aca69537d03a002f44a Mon Sep 17 00:00:00 2001 From: Brenan Kelley Date: Mon, 20 May 2024 22:48:33 -0700 Subject: [PATCH 4/4] fix: use macos-13, arm is not supported by setup-go --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d8f8986..9fdae94 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,7 +8,7 @@ jobs: strategy: matrix: go-version: ['1.14.15', '1.15.15', '1.16.15', '1.17.13', '1.22.3'] - os: [ubuntu-latest, macos-latest, windows-latest] + os: [ubuntu-latest, macos-13, windows-latest] runs-on: ${{ matrix.os }} steps: - name: Checkout