Skip to content

Commit

Permalink
chore: some gh actions
Browse files Browse the repository at this point in the history
  • Loading branch information
npazosmendez committed Jul 30, 2024
1 parent 6585efc commit 63a1c60
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 0 deletions.
66 changes: 66 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: "checks"

on:
push:
branches:
- main
pull_request:

env:
GO_VERSION: 1.21.8

jobs:
# shellcheck should be a dependency for jobs that run any scripts,
# as wrong shell scripts can be harmful.
shellcheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run ShellCheck
uses: ludeeus/action-shellcheck@master
with:
severity: warning

go-lint:
permissions:
contents: read # for actions/checkout to fetch code
pull-requests: read # for golangci/golangci-lint-action to fetch pull requests
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
args: --verbose
version: v1.59.1

go-mod-tidy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Check go mod tidy
run: |
go mod tidy
make assert-no-changed-files
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Run Tests
run: go test ./...
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,8 @@ packages-minor-autoupdate:
. != \"github.com/thanos-io/thanos\" \
))" \
| tr -d '\n' | tr -d ' '

.PHONY: assert-no-changed-files
assert-no-changed-files:
@git update-index --refresh
@git diff-index --quiet HEAD --

0 comments on commit 63a1c60

Please sign in to comment.