From 9a015daa0f58108c59a555a7743303ad840502c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20Mengu=C3=A9?= Date: Sat, 7 May 2022 22:40:12 +0200 Subject: [PATCH 1/5] Add CI job running with GitHub Actions --- .github/workflows/test.yml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..462bd65 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,30 @@ +on: [push, pull_request] +name: Test +jobs: + test: + strategy: + matrix: + go-version: [1.17.x, 1.18.x] + os: [ubuntu-latest, macos-latest, windows-latest] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/setup-go@v3 + with: + go-version: ${{ matrix.go-version }} + - uses: actions/checkout@v3 + - uses: actions/cache@v2 + with: + # In order: + # * Module download cache + # * Build cache (Linux) + # * Build cache (Mac) + # * Build cache (Windows) + path: | + ~/go/pkg/mod + ~/.cache/go-build + ~/Library/Caches/go-build + ~\AppData\Local\go-build + key: ${{ runner.os }}-go-${{ matrix.go-version }}-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go-${{ matrix.go-version }}- + - run: go test ./... \ No newline at end of file From dd2d386d703c6ae4bf3f30f8fe39de5a3324630d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20Mengu=C3=A9?= Date: Sat, 7 May 2022 22:55:33 +0200 Subject: [PATCH 2/5] CI: add golangci-lint job running on GitHub Actions --- .github/workflows/golangci-lint.yml | 40 +++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 .github/workflows/golangci-lint.yml diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml new file mode 100644 index 0000000..7d251cd --- /dev/null +++ b/.github/workflows/golangci-lint.yml @@ -0,0 +1,40 @@ + + +# See https://github.com/golangci/golangci-lint-action + +on: [push, pull_request] +name: golangci-lint +permissions: + contents: read +jobs: + golangci: + runs-on: ubuntu-latest + steps: + - uses: actions/setup-go@v3 + with: + go-version: ${{ matrix.go-version }} + - uses: actions/checkout@v3 + - name: golangci-lint + uses: golangci/golangci-lint-action@v3 + with: + # Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version + version: latest + + # Optional: working directory, useful for monorepos + # working-directory: somedir + + # Optional: golangci-lint command line arguments. + # args: --issues-exit-code=0 + + # Optional: show only new issues if it's a pull request. The default value is `false`. + # only-new-issues: true + + # Optional: if set to true then the all caching functionality will be complete disabled, + # takes precedence over all other caching options. + # skip-cache: true + + # Optional: if set to true then the action don't cache or restore ~/go/pkg. + # skip-pkg-cache: true + + # Optional: if set to true then the action don't cache or restore ~/.cache/go-build. + # skip-build-cache: true \ No newline at end of file From 2aca837c742ce739e4c1f870b24d5d8284f12e66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20Mengu=C3=A9?= Date: Fri, 13 May 2022 00:12:26 +0200 Subject: [PATCH 3/5] Add initial configuration for golangci-lint Linters which produce false positives are disabled. We have known errors to fix, so for now the linter result is marked as non-blocking (continue-on-error: true). --- .golangci.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 .golangci.yml diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 0000000..a3bf33d --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,11 @@ +# Doc: https://golangci-lint.run/usage/configuration/ + +linters: + disable: + # Too many false positive + - deadcode + - unused + - varcheck + - errcheck + +linters-settings: From c41c99facc0edf4fe073d35633d15616f85a207e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20Mengu=C3=A9?= Date: Mon, 16 May 2022 21:02:05 +0200 Subject: [PATCH 4/5] CI: do not fail on golangci-lint errors We have to fix errors before enabling strong failures. --- .github/workflows/golangci-lint.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 7d251cd..cd5cb8b 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -16,6 +16,8 @@ jobs: - uses: actions/checkout@v3 - name: golangci-lint uses: golangci/golangci-lint-action@v3 + # Do not block because there are many errors to fix + continue-on-error: true with: # Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version version: latest @@ -37,4 +39,4 @@ jobs: # skip-pkg-cache: true # Optional: if set to true then the action don't cache or restore ~/.cache/go-build. - # skip-build-cache: true \ No newline at end of file + # skip-build-cache: true From 581eebf6cdcc28f4f29fc702ee7fa62d983cf050 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20Mengu=C3=A9?= Date: Mon, 16 May 2022 22:16:03 +0200 Subject: [PATCH 5/5] CI: disable tests on Windows Tests do not pass on Windows. --- .github/workflows/test.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 462bd65..6d34202 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -5,7 +5,9 @@ jobs: strategy: matrix: go-version: [1.17.x, 1.18.x] - os: [ubuntu-latest, macos-latest, windows-latest] + # Test do not (yet) pass on Windows + # os: [ubuntu-latest, macos-latest, windows-latest] + os: [ubuntu-latest, macos-latest] runs-on: ${{ matrix.os }} steps: - uses: actions/setup-go@v3 @@ -27,4 +29,4 @@ jobs: key: ${{ runner.os }}-go-${{ matrix.go-version }}-${{ hashFiles('**/go.sum') }} restore-keys: | ${{ runner.os }}-go-${{ matrix.go-version }}- - - run: go test ./... \ No newline at end of file + - run: go test ./...