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

*: migrate to netip #567

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
58 changes: 25 additions & 33 deletions .github/workflows/build.yaml → .github/workflows/build-test.yaml
Original file line number Diff line number Diff line change
@@ -1,43 +1,49 @@
---
name: "Build & Test"
on:
on: # yamllint disable-line rule:truthy
push:
branches:
- "!dependabot/*"
- "main"
- "*"
pull_request:
branches: ["*"]
branches:
- "*"
jobs:
build:
name: "Go Build"
name: "Build Binary"
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v2"
- uses: "actions/setup-go@v2"
- uses: "actions/checkout@v3"
- uses: "actions/setup-go@v3"
with:
go-version: "^1.17"
- name: "Build"
run: "go build ./cmd/..."
- uses: "authzed/actions/go-build@main"

image-build:
name: "Build Container Image"
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v3"
- uses: "authzed/actions/docker-build@main"

unit:
name: "Run Unit Tests"
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v2"
- uses: "actions/setup-go@v2"
- uses: "actions/checkout@v3"
- uses: "actions/setup-go@v3"
with:
go-version: "^1.17"
- name: "Run `go test`"
run: "go test -race ./..."
go-version: "^1.18"
- uses: "authzed/actions/go-test@main"

e2e-mem:
name: "E2E Memory Tests"
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v2"
- uses: "actions/setup-go@v2"
- uses: "actions/checkout@v3"
- uses: "actions/setup-go@v3"
with:
go-version: "^1.17"
go-version: "^1.18"
- name: "Install and configure chihaya"
run: |
go install ./cmd/chihaya
Expand All @@ -59,10 +65,10 @@ jobs:
ports: ["6379:6379"]
options: "--entrypoint redis-server"
steps:
- uses: "actions/checkout@v2"
- uses: "actions/setup-go@v2"
- uses: "actions/checkout@v3"
- uses: "actions/setup-go@v3"
with:
go-version: "^1.17"
go-version: "^1.18"
- name: "Install and configure chihaya"
run: |
go install ./cmd/chihaya
Expand All @@ -78,20 +84,6 @@ jobs:
chihaya e2e --debug
kill $pid

image-build:
name: "Docker Build"
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v2"
- uses: "docker/setup-qemu-action@v1"
- uses: "docker/setup-buildx-action@v1"
with:
driver-opts: "image=moby/buildkit:master"
- uses: "docker/build-push-action@v1"
with:
push: false
tags: "latest"

helm:
name: "Helm Template"
runs-on: "ubuntu-latest"
Expand Down
67 changes: 13 additions & 54 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -1,70 +1,33 @@
---
name: "Lint"
on:
on: # yamllint disable-line rule:truthy
push:
branches:
- "!dependabot/*"
- "main"
pull_request:
branches: ["*"]
jobs:
go-mod-tidy:
name: "Lint Go Modules"
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v2"
- uses: "actions/setup-go@v2"
with:
go-version: "^1.17"
- name: "Run `go mod tidy`"
run: "go mod tidy && bash -c '[ $(git status --porcelain | tee /dev/fd/2 | wc -c) -eq 0 ]'"

go-fmt:
name: "Format Go"
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v2"
- uses: "actions/setup-go@v2"
with:
go-version: "^1.17"
- name: "Install gofumpt"
run: "go install mvdan.cc/gofumpt@latest"
- name: "Run `gofumpt`"
run: |
GOFUMPT_OUTPUT="$(find . -iname '*.go' -type f | xargs gofumpt -d)"
if [ -n "$GOFUMPT_OUTPUT" ]; then
echo "The following files are not correctly formatted:"
echo "${GOFUMPT_OUTPUT}"
exit 1
fi

go-lint:
name: "Lint Go"
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v2"
- uses: "actions/setup-go@v2"
with:
go-version: "^1.17"
- uses: "golangci/golangci-lint-action@v2"
- uses: "actions/checkout@v3"
- uses: "actions/setup-go@v3"
with:
version: "v1.43"
skip-go-installation: true
skip-pkg-cache: true
skip-build-cache: false
go-version: "^1.18"
- uses: "authzed/actions/gofumpt@main"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will steal your github actions for my personal stuff :)

- uses: "authzed/actions/go-mod-tidy@main"
- uses: "authzed/actions/go-generate@main"
- uses: "authzed/actions/golangci-lint@main"

extra-lint:
name: "Lint YAML & Markdown"
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v2"
- uses: "bewuethr/yamllint-action@v1.1.1"
with:
config-file: ".yamllint"
- uses: "nosborn/github-action-markdown-cli@v2.0.0"
with:
files: "."
config_file: ".markdownlint.yaml"
- uses: "actions/checkout@v3"
- uses: "authzed/actions/yaml-lint@main"
- uses: "authzed/actions/markdown-lint@main"

codeql:
name: "Analyze with CodeQL"
Expand All @@ -78,9 +41,5 @@ jobs:
matrix:
language: ["go"]
steps:
- uses: "actions/checkout@v2"
- uses: "github/codeql-action/init@v1"
with:
languages: "${{ matrix.language }}"
- uses: "github/codeql-action/autobuild@v1"
- uses: "github/codeql-action/analyze@v1"
- uses: "actions/checkout@v3"
- uses: "authzed/actions/codeql@main"
4 changes: 4 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ output:
linters-settings:
goimports:
local-prefixes: "github.com/chihaya/chihaya"
staticcheck:
checks:
- "all"
- "-SA1019" # Allow netErr.Temporary
gosec:
excludes:
- "G404" # Allow the usage of math/rand
Expand Down
Loading