Skip to content

Commit

Permalink
chore(ci): clean up workflow jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
tie committed May 27, 2022
1 parent e1c5393 commit 6fd1f35
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 81 deletions.
19 changes: 4 additions & 15 deletions .github/workflows/ci.yml
Expand Up @@ -17,22 +17,11 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v3.0.2
- name: Install Go
- name: Setup Go
uses: actions/setup-go@v3.2.0
with:
go-version: 1.18.0
- name: Get Go cache paths
id: go-env
run: |
echo "::set-output name=cache::$(go env GOCACHE)"
echo "::set-output name=modcache::$(go env GOMODCACHE)"
- name: Set up Go cache
uses: actions/cache@v3.0.2
with:
key: test-${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: test-${{ runner.os }}-go-
path: |
${{ steps.go-env.outputs.cache }}
${{ steps.go-env.outputs.modcache }}
go-version-file: .go-version
cache: true
cache-dependency-path: '**/go.sum'
- name: Run tests
run: go test -race go.pact.im/x/...
53 changes: 5 additions & 48 deletions .github/workflows/lint.yml
Expand Up @@ -13,22 +13,11 @@ jobs:
- name: Install Go
uses: actions/setup-go@v3.2.0
with:
go-version: 1.18.0
- name: Get Go cache paths
id: go-env
run: |
echo "::set-output name=cache::$(go env GOCACHE)"
echo "::set-output name=modcache::$(go env GOMODCACHE)"
- name: Set up Go cache
uses: actions/cache@v3.0.2
with:
key: golangci-lint-${{ runner.os }}-go-${{ hashFiles('**/go.mod') }}
restore-keys: golangci-lint-${{ runner.os }}-go-
path: |
${{ steps.go-env.outputs.cache }}
${{ steps.go-env.outputs.modcache }}
go-version-file: .go-version
cache: true
cache-dependency-path: '**/go.sum'
- name: Install golangci-lint
run: go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.45.2
run: go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.46.2
- name: Get golangci-lint cache path
id: golangci-lint-cache-status
run: |
Expand All @@ -40,44 +29,12 @@ jobs:
restore-keys: golangci-lint-${{ runner.os }}-golangci-lint-
path: ${{ steps.golangci-lint-cache-status.outputs.dir }}
- name: Run golangci-lint
# Note that we filter some packages since they use type parameters and
# currently they are not supported in Go SSA analysis tooling. See also
# https://github.com/golangci/golangci-lint/issues/2649
run: |
golangci-lint run --out-format=github-actions -- \
$(go work edit -json | jq -c -r '[.Use[].DiskPath | select(. != "syncx" and . != "process")] | map_values(. + "/...")[]')
go-mod-tidy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3.0.2
- name: Install Go
uses: actions/setup-go@v3.2.0
with:
go-version: 1.18.0
- name: Get Go cache paths
id: go-env
run: |
echo "::set-output name=cache::$(go env GOCACHE)"
echo "::set-output name=modcache::$(go env GOMODCACHE)"
- name: Set up Go cache
uses: actions/cache@v3.0.2
with:
key: go-mod-tidy-${{ runner.os }}-go-${{ hashFiles('**/go.mod') }}
restore-keys: |
go-mod-tidy-${{ runner.os }}-go-
path: |
${{ steps.go-env.outputs.cache }}
${{ steps.go-env.outputs.modcache }}
- name: Run go mod tidy
run: eval "$(go list -m -f '(cd {{printf "%q" .Dir}} && go mod tidy)')"
- name: Check git diff
run: git diff --exit-code
$(go work edit -json | jq -c -r '[.Use[].DiskPath] | map_values(. + "/...")[]')
commitlint:
runs-on: ubuntu-latest
if: github.actor != 'dependabot[bot]'
steps:
- name: Checkout code
uses: actions/checkout@v3.0.2
Expand Down
22 changes: 4 additions & 18 deletions .github/workflows/pages.yml
Expand Up @@ -17,27 +17,13 @@ jobs:
- name: Install Go
uses: actions/setup-go@v3.2.0
with:
go-version: 1.18.0
- name: Get Go cache paths
id: go-env
run: |
echo "::set-output name=cache::$(go env GOCACHE)"
echo "::set-output name=modcache::$(go env GOMODCACHE)"
- name: Set up Go cache
uses: actions/cache@v3.0.2
with:
key: gocache-${{ runner.os }}
restore-keys: gocache-
path: |
${{ steps.go-env.outputs.cache }}
${{ steps.go-env.outputs.modcache }}
go-version-file: .go-version
cache: true
cache-dependency-path: '**/go.sum'
- name: Install vangen
run: go install 4d63.com/vangen@v1.2.0
- name: Install golds
run: go install go101.org/golds@v0.4.8
# See https://github.com/go101/golds/issues/28
- name: Warm up Go modules cache
run: go work sync
run: go install go101.org/golds@v0.4.9
- name: Build pages
run: |
vangen -out build
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/sums.yml
@@ -0,0 +1,24 @@
name: Sums
on:
push:
pull_request:
workflow_dispatch:

jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3.0.2
- name: Install Go
uses: actions/setup-go@v3.2.0
with:
go-version-file: .go-version
cache: true
cache-dependency-path: '**/go.sum'
- name: Update go.sum
run: eval "$(go list -m -f '(cd {{printf "%q" .Dir}} && go mod tidy)')"
- name: Update go.work.sum
run: go work sync
- name: Check git diff
run: git diff --exit-code
1 change: 1 addition & 0 deletions .go-version
@@ -0,0 +1 @@
1.18.2

0 comments on commit 6fd1f35

Please sign in to comment.