From 173d0762af0dcce6e2d639c56bdd0984049f4faa Mon Sep 17 00:00:00 2001 From: Aiden <12055114+aidenwallis@users.noreply.github.com> Date: Fri, 11 Nov 2022 02:05:33 +0000 Subject: [PATCH] Run CI against multiple go versions (#17) * CI against multiple go versions * improve ci naming * convert both jobs into single ci file --- .github/workflows/ci.yaml | 70 +++++++++++++++++++++++++++++++++++++ .github/workflows/lint.yaml | 39 --------------------- .github/workflows/test.yaml | 30 ---------------- 3 files changed, 70 insertions(+), 69 deletions(-) create mode 100644 .github/workflows/ci.yaml delete mode 100644 .github/workflows/lint.yaml delete mode 100644 .github/workflows/test.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..8ca2099 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,70 @@ +name: CI + +on: [push, pull_request] + +permissions: + contents: read + # Optional: allow read access to pull request. Use with `only-new-issues` option. + pull-requests: read + +jobs: + lint: + runs-on: ubuntu-latest + name: lint | ${{ matrix.go_version }} + strategy: + matrix: + go_version: [1.18, 1.19] + 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: 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 + test: + name: test | ${{ matrix.go_version }} + strategy: + matrix: + go_version: [1.18, 1.19] + runs-on: ubuntu-latest + steps: + - name: Setup go ${{ matrix.go_version }} + uses: actions/setup-go@v1 + with: + go-version: ${{ matrix.go_version }} + id: go + + - name: Checkout code + uses: actions/checkout@v1 + + - name: Make out dir + run: | + mkdir out + + - name: Run tests + run: | + go test -race ./... -coverprofile=out/coverage.txt -covermode=atomic + + - name: Upload coverage + uses: codecov/codecov-action@v2 + with: + files: out/coverage.txt diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml deleted file mode 100644 index 2aa7370..0000000 --- a/.github/workflows/lint.yaml +++ /dev/null @@ -1,39 +0,0 @@ -name: Lint Go Code - -on: [push, pull_request] - -permissions: - contents: read - # Optional: allow read access to pull request. Use with `only-new-issues` option. - pull-requests: read - -jobs: - lint: - name: lint - runs-on: ubuntu-latest - steps: - - uses: actions/setup-go@v3 - with: - go-version: 1.18 - - uses: actions/checkout@v3 - - name: golangci-lint - uses: golangci/golangci-lint-action@v3 - with: - # 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 diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml deleted file mode 100644 index cb915b5..0000000 --- a/.github/workflows/test.yaml +++ /dev/null @@ -1,30 +0,0 @@ -name: Test Go Code - -on: [push, pull_request] - -jobs: - test: - name: test - runs-on: ubuntu-latest - steps: - - name: Setup go 1.18 - uses: actions/setup-go@v1 - with: - go-version: 1.18 - id: go - - - name: Checkout code - uses: actions/checkout@v1 - - - name: Make out dir - run: | - mkdir out - - - name: Run tests - run: | - go test -race ./... -coverprofile=out/coverage.txt -covermode=atomic - - - name: Upload coverage - uses: codecov/codecov-action@v2 - with: - files: out/coverage.txt