Skip to content

Commit

Permalink
build: ci test
Browse files Browse the repository at this point in the history
  • Loading branch information
gbotrel committed Sep 13, 2024
1 parent cdc457a commit d9281ae
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 41 deletions.
67 changes: 32 additions & 35 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,39 @@ env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}

jobs:
staticcheck:
runs-on: ubuntu-latest
steps:
- name: checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: install Go
uses: actions/setup-go@v5
with:
go-version: 1.23.x
# staticcheck:
# runs-on: ubuntu-latest
# steps:
# - name: checkout code
# uses: actions/checkout@v4
# with:
# fetch-depth: 0
# - name: install Go
# uses: actions/setup-go@v5
# with:
# go-version: 1.23.x

- name: install deps
run: go install golang.org/x/tools/cmd/goimports@latest && go install github.com/klauspost/asmfmt/cmd/asmfmt@latest
- name: gofmt
run: if [[ -n $(gofmt -l .) ]]; then echo "please run gofmt"; exit 1; fi
- name: generated files should not be modified
run: |
go generate ./...
git update-index --assume-unchanged go.mod
git update-index --assume-unchanged go.sum
if [[ -n $(git status --porcelain) ]]; then echo "git repo is dirty after running go generate -- please don't modify generated files"; echo $(git diff);echo $(git status --porcelain); exit 1; fi
# - name: install deps
# run: go install golang.org/x/tools/cmd/goimports@latest && go install github.com/klauspost/asmfmt/cmd/asmfmt@latest
# - name: gofmt
# run: if [[ -n $(gofmt -l .) ]]; then echo "please run gofmt"; exit 1; fi
# - name: generated files should not be modified
# run: |
# go generate ./...
# git update-index --assume-unchanged go.mod
# git update-index --assume-unchanged go.sum
# if [[ -n $(git status --porcelain) ]]; then echo "git repo is dirty after running go generate -- please don't modify generated files"; echo $(git diff);echo $(git status --porcelain); exit 1; fi

# hack to ensure golanglint process generated files
- name: remove "generated by" comments from generated files
run: |
find . -type f -name '*.go' -exec sed -i 's/Code generated by .* DO NOT EDIT/FOO/g' {} \;
# on macos: find . -type f -name '*.go' -exec sed -i '' -E 's/Code generated by .* DO NOT EDIT/FOO/g' {} \;
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.60
args: -v --timeout=5m
# # hack to ensure golanglint process generated files
# - name: remove "generated by" comments from generated files
# run: |
# find . -type f -name '*.go' -exec sed -i 's/Code generated by .* DO NOT EDIT/FOO/g' {} \;
# # on macos: find . -type f -name '*.go' -exec sed -i '' -E 's/Code generated by .* DO NOT EDIT/FOO/g' {} \;
# - name: golangci-lint
# uses: golangci/golangci-lint-action@v6
# with:
# version: v1.60
# args: -v --timeout=5m

# test:
# runs-on: ubuntu-latest-128
Expand Down Expand Up @@ -93,8 +93,6 @@ jobs:

slack-notifications:
if: always()
needs:
- staticcheck
uses: ./.github/workflows/slack-notifications.yml
with:
status: ${{ needs.test.result }}
Expand All @@ -103,5 +101,4 @@ jobs:
pr_title: ${{ github.event.pull_request.title }}
branch: ${{ github.event.pull_request.head.ref }}
run_id: ${{ github.run_id }}
failures: ${{ needs.test.outputs.failures }}
bot_token: $SLACK_BOT_TOKEN
failures: ${{ needs.test.outputs.failures }}
3 changes: 1 addition & 2 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,5 +97,4 @@ jobs:
repository: ${{ github.repository }}
branch: ${{ github.ref_name }}
run_id: ${{ github.run_id }}
failures: ${{ needs.test.outputs.failures }}
bot_token: $SLACK_BOT_TOKEN
failures: ${{ needs.test.outputs.failures }}
4 changes: 0 additions & 4 deletions .github/workflows/slack-notifications.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ on:
description: 'Test failure details (if any)'
required: false
type: string
bot_token:
description: 'The Slack bot token'
required: true
type: string

jobs:
notify_slack:
Expand Down

0 comments on commit d9281ae

Please sign in to comment.