From fc46c33d803f52d5dd3c94855c2cacee42ca0cab Mon Sep 17 00:00:00 2001 From: Mark Ayers Date: Tue, 26 Sep 2023 12:37:10 -0400 Subject: [PATCH] Improve GitHub workflows - use the same Go version everywhere - standardize YAML whitespacve and quoting - add missing strategy (job level item) --- .github/workflows/golangci-lint.yml | 4 +-- .github/workflows/release.yml | 6 ++-- .github/workflows/test.yml | 51 +++++++++++++++-------------- 3 files changed, 32 insertions(+), 29 deletions(-) diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index cd7b780..f4ced9e 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -13,9 +13,9 @@ jobs: steps: - uses: actions/setup-go@v3 with: - go-version: 1.19 + go-version: 1.18 - uses: actions/checkout@v3 - name: golangci-lint uses: golangci/golangci-lint-action@v3 with: - version: v1.48 \ No newline at end of file + version: v1.48 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5faeafc..0dd1e70 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,7 +3,7 @@ on: workflow_dispatch: inputs: release_id: - description: 'Release id (tag name)' + description: "Release id (tag name)" required: true jobs: create_release: @@ -25,7 +25,7 @@ jobs: - [**MacOS** Intel](https://github.com/skatkov/stoic/releases/download/${{ github.event.inputs.release_id }}/stoic-mac-intel.zip) - [**MacOS** M1 (ARM)](https://github.com/skatkov/stoic/releases/download/${{ github.event.inputs.release_id }}/stoic-mac-arm.zip) - [**Linux**](https://github.com/skatkov/stoic/releases/download/${{ github.event.inputs.release_id }}/stoic-linux.zip) - + release_name: ${{ github.event.inputs.release_id }} prerelease: true draft: true @@ -52,7 +52,7 @@ jobs: - uses: actions/checkout@v2 - uses: actions/setup-go@v2 with: - go-version: '1.18' + go-version: "1.18" - name: Build binary env: GOOS: ${{ matrix.go_os }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0cab965..4f407a1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,31 +8,34 @@ jobs: os: [ubuntu-latest, macos-latest] runs-on: ${{ matrix.os }} steps: - - uses: actions/setup-go@v3 - with: - go-version: ${{ matrix.go-version }} - - uses: actions/checkout@v3 - - run: go test ./... + - uses: actions/setup-go@v3 + with: + go-version: ${{ matrix.go-version }} + - uses: actions/checkout@v3 + - run: go test ./... test-cache: + strategy: + matrix: + go-version: [1.18.x] runs-on: ubuntu-latest steps: - - uses: actions/setup-go@v3 - with: - go-version: 1.18.x - - uses: actions/checkout@v3 - - uses: actions/cache@v2 - with: - # In order: - # * Module download cache - # * Build cache (Linux) - # * Build cache (Mac) - 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 + - uses: actions/setup-go@v3 + with: + go-version: 1.18.x + - uses: actions/checkout@v3 + - uses: actions/cache@v2 + with: + # In order: + # * Module download cache + # * Build cache (Linux) + # * Build cache (Mac) + 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 ./...