Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Refactor checks to remove more asdf stuff #253

Merged
merged 1 commit into from
Nov 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 27 additions & 20 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,6 @@ jobs:
- name: Install asdf
uses: asdf-vm/actions/setup@v1

- name: Install go
run: make install-tool.golang

- name: Run e2e tests
run: make e2e-test

Expand All @@ -58,37 +55,47 @@ jobs:
- name: Check out code
uses: actions/checkout@v3

- name: Output required tool versions
id: tool-versions
run: |
echo "go=$(grep -E '^golang ' .tool-versions | cut -d' ' -f2 | sed -e 's/^\([0-9]\+\.[0-9]\+\)$/\1.0/')" >> $GITHUB_OUTPUT
echo "golangci-lint=v$(grep -E '^golangci-lint ' .tool-versions | cut -d' ' -f2)" >> $GITHUB_OUTPUT

- uses: actions/setup-go@v3
with:
go-version: ${{ steps.tool-versions.outputs.go }}
check-latest: false
cache: true

- name: Ensure dummy skopeo files
run: make ensure-static-skopeo
env:
SKIP_ASDF_CHECK: 1

- name: Gather tool versions
uses: endorama/asdf-parse-tool-versions@v1
id: versions

- name: golangci-lint
uses: golangci/golangci-lint-action@v3
uses: reviewdog/action-golangci-lint@v2
with:
version: ${{ steps.tool-versions.outputs.golangci-lint }}
only-new-issues: ${{ github.event_name == 'pull_request' }}
fail_on_error: true
reporter: github-pr-review
go_version: ${{ fromJson(steps.versions.outputs.tools).golangci }}
golangci_lint_version: v${{ fromJson(steps.versions.outputs.tools).golangci-lint }}

pre-commit:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3

- name: Install asdf
uses: asdf-vm/actions/setup@v1
- name: Ensure dummy skopeo files
run: make ensure-static-skopeo
env:
SKIP_ASDF_CHECK: 1

- name: Gather tool versions
uses: endorama/asdf-parse-tool-versions@v1
id: versions

- uses: actions/setup-go@v3
with:
go-version: ${{ fromJson(steps.versions.outputs.tools).golang }}
check-latest: false
cache: true

- uses: mfinelli/setup-shfmt@v2
with:
shfmt-version: ${{ fromJson(steps.versions.outputs.tools).shfmt }}

- uses: pre-commit/[email protected]
with:
Expand Down
11 changes: 4 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,16 @@
repos:
- repo: local
hooks:
- id: go-mod-tidy
name: go mod tidy
entry: make mod-tidy
files: "(.*\\.go|go.mod|go.sum)$"
language: system
stages: [commit]
pass_filenames: false
- id: golangci-lint
name: golangci-lint
entry: make lint
language: system
files: "(.*\\.go|go.mod|go.sum)$"
pass_filenames: false
- repo: https://github.com/tekwizely/pre-commit-golang
rev: v1.0.0-rc.1
hooks:
- id: go-mod-tidy-repo
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
Expand Down
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ golang 1.19.2
helm 3.10.1
pre-commit 2.20.0
upx 3.96
shfmt 3.5.1