Skip to content

Commit

Permalink
add "lint and test" workflow
Browse files Browse the repository at this point in the history
* First golangci-lint
* Then ensure we do not have atomic alignment problems on 32 bit
  • Loading branch information
twmb committed Oct 12, 2022
1 parent 5bc6923 commit b76183a
Showing 1 changed file with 88 additions and 0 deletions.
88 changes: 88 additions & 0 deletions .github/workflows/lint-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: lint and test

on:
push:
branches: ["*"]
pull_request:
branches: ["*"]

concurrency:
group: ${{ github.ref }}
cancel-in-progress: true

jobs:
golangci:
if: github.repository == 'twmb/franz-go'
runs-on: ubuntu-latest
name: 'golangci-lint on amd64'
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.19.2
- uses: golangci/golangci-lint-action@v3
with:
version: latest

vet-arm:
if: github.repository == 'twmb/franz-go'
needs: golangci
runs-on: ubuntu-latest
name: 'vet on arm'
steps:
- uses: actions/checkout@v3
with:
path: "repo"
- uses: uraimo/run-on-arch-action@v2
with:
arch: armv6
distro: bullseye
githubToken: ${{ github.token }}
run: |
echo "updating"
apt-get -qq -y update
echo "installing wget"
apt-get -qq -y install wget
echo "downloading go"
wget --quiet https://go.dev/dl/go1.19.2.linux-armv6l.tar.gz
tar xzf go1.19.2.linux-armv6l.tar.gz
mkdir bins
export PATH=$(pwd)/go/bin:$(pwd)/bins:$PATH
export GOBIN=$(pwd)/bins
export CGO_ENABLED=0
cd repo
echo "go vet ./..."
go vet ./...
echo "installing staticcheck"
go install honnef.co/go/tools/cmd/staticcheck@latest
echo "staticcheck ./..."
staticcheck -checks 'all,-ST1003,-SA1012,-ST1016,-SA1019,-SA2001' ./... # actually contains atomicalign check
# TODO: fix
# integration-test:
# if: github.repository == 'twmb/franz-go'
# needs: golangci
# runs-on: ubuntu-latest
# name: 'integration test kafka'
# container: golang:1.19.2
# services:
# zk:
# image: bitnami/zookeeper:latest
# ports:
# - 2181:2181
# env:
# ALLOW_ANONYMOUS_LOGIN: yes
# kafka:
# image: bitnami/kafka:latest
# ports:
# - 9092:9092
# env:
# ALLOW_PLAINTEXT_LISTENER: yes
# KAFKA_CFG_ZOOKEEPER_CONNECT: zk:2181
# steps:
# - uses: actions/checkout@v3
# - run: go test ./...
# env:
# KGO_TEST_RF: 1
# KGO_SEEDS: kafka:9092
# KGO_TEST_RECORDS: 50000

0 comments on commit b76183a

Please sign in to comment.