Skip to content

Commit

Permalink
Refresh CI tooling (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
anuraaga authored Jun 27, 2024
1 parent ec97abb commit ea1e0fb
Show file tree
Hide file tree
Showing 18 changed files with 193 additions and 144 deletions.
19 changes: 19 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: "daily"
groups:
gha:
patterns:
- "*"

- package-ecosystem: gomod
directory: /
schedule:
interval: daily
groups:
go:
patterns:
- "*"
27 changes: 2 additions & 25 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,5 @@ on:

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- macos-13
- macos-14
- ubuntu-22.04
- windows-2022
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-go@v5
with:
go-version-file: go.work
cache-dependency-path: "**/go.sum"

- name: run checks
run: go run build check

- name: build snapshot
if: ${{ startsWith(matrix.os, 'ubuntu-') }}
run: go run build snapshot
uses: wasilibs/actions/.github/workflows/ci.yaml@eeee5d072ee283c12eb68e2c4969012fae3d6dd0
secrets: inherit
24 changes: 8 additions & 16 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,12 @@ on:
tags:
- v*

jobs:
build:
name: Release
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-go@v5
with:
go-version-file: go.work
cache-dependency-path: "**/go.sum"
permissions:
id-token: write
attestations: write
contents: write

- run: go run build release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
release:
uses: wasilibs/actions/.github/workflows/release.yaml@eeee5d072ee283c12eb68e2c4969012fae3d6dd0
secrets: inherit
41 changes: 0 additions & 41 deletions .github/workflows/update-upstream.yaml

This file was deleted.

15 changes: 15 additions & 0 deletions .github/workflows/update.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: "Update Upstream"

on:
schedule:
- cron: "5 4 * * *"
workflow_dispatch:

permissions:
id-token: write
attestations: write

jobs:
build:
uses: wasilibs/actions/.github/workflows/update.yaml@eeee5d072ee283c12eb68e2c4969012fae3d6dd0
secrets: inherit
43 changes: 43 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
linters:
enable:
# We opt-in to style linters without the preset since many
# are too strict (e.g., no init functions allowed).
- decorder
- dupword
- gci
- gocritic
- gofumpt
- goprintffuncname
- inamedparam
- mirror
- revive
- stylecheck
- tenv
- unconvert
- usestdlibvars
- wastedassign
presets:
- bugs
- performance

linters-settings:
gci:
sections:
- standard
- default
- prefix(github.com/wasilibs/go-protoc-gen-builtins)
gosec:
config:
G306: "0644"

issues:
exclude:
- don't use an underscore in package name
- should not use underscores in package names
exclude-rules:
- path: _test\.go
linters:
- errcheck
- errchkjson
- gosec
- noctx
83 changes: 42 additions & 41 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -1,49 +1,50 @@
project_name: protoc-gen-prost
builds:
- main: ./cmd/protoc-gen-prost
id: prost
binary: protoc-gen-prost
env:
- CGO_ENABLED=0
targets:
- linux_amd64
- linux_arm64
- darwin_amd64
- darwin_arm64
- windows_amd64
- windows_arm64
- main: ./cmd/protoc-gen-prost-crate
id: prost-crate
binary: protoc-gen-prost-crate
env:
- CGO_ENABLED=0
targets:
- linux_amd64
- linux_arm64
- darwin_amd64
- darwin_arm64
- windows_amd64
- windows_arm64
- main: ./cmd/protoc-gen-prost-serde
id: prost-serde
binary: protoc-gen-prost-serde
env:
- CGO_ENABLED=0
targets:
- linux_amd64
- linux_arm64
- darwin_amd64
- darwin_arm64
- windows_amd64
- windows_arm64
- main: ./cmd/protoc-gen-prost
id: prost
binary: protoc-gen-prost
env:
- CGO_ENABLED=0
targets:
- linux_amd64
- linux_arm64
- darwin_amd64
- darwin_arm64
- windows_amd64
- windows_arm64
- main: ./cmd/protoc-gen-prost-crate
id: prost-crate
binary: protoc-gen-prost-crate
env:
- CGO_ENABLED=0
targets:
- linux_amd64
- linux_arm64
- darwin_amd64
- darwin_arm64
- windows_amd64
- windows_arm64
- main: ./cmd/protoc-gen-prost-serde
id: prost-serde
binary: protoc-gen-prost-serde
env:
- CGO_ENABLED=0
targets:
- linux_amd64
- linux_arm64
- darwin_amd64
- darwin_arm64
- windows_amd64
- windows_arm64
archives:
- format_overrides:
- goos: windows
format: zip
- format_overrides:
- goos: windows
format: zip
release:
mode: append
checksum:
name_template: 'checksums.txt'
name_template: "checksums.txt"
snapshot:
name_template: "{{ incpatch .Version }}-next"
changelog:
skip: true
disable: true
4 changes: 4 additions & 0 deletions .yamllint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
rules:
document-start: disable
truthy:
check-keys: false
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# go-protoc-gen-prost

go-protoc-gen-prost is a distribution of the code generator of [prost][1].
go-protoc-gen-prost is a distribution of the code generator of [prost][1].
It does not actually reimplement any functionality of prost in Go, instead compiling it
to WebAssembly, and executing with the pure Go Wasm runtime [wazero][2].
This means that `go install` or `go run` can be used to execute it, with no need to rely on external
Expand Down Expand Up @@ -28,7 +28,10 @@ version: v1
plugins:
- plugin: prost
out: out/rust
path: ["go", "run", "github.com/wasilibs/go-protoc-gen-prost/cmd/protoc-gen-prost@latest"]
path:
- "go"
- "run"
- "github.com/wasilibs/go-protoc-gen-prost/cmd/protoc-gen-prost@latest"
```

This makes it possible to have full protobuf/gRPC generation with no installation of tools,
Expand Down
3 changes: 2 additions & 1 deletion build/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ go 1.22

require (
github.com/goyek/x v0.1.7
github.com/wasilibs/tools v0.0.0-20240501081123-9453b4e4849b
github.com/wasilibs/tools v0.0.0-20240606073112-95e68538d401
)

require (
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
github.com/cli/go-gh/v2 v2.9.0 // indirect
github.com/cli/safeexec v1.0.0 // indirect
github.com/cli/shurcooL-graphql v0.0.4 // indirect
github.com/curioswitch/go-build v0.0.0-20240606064955-be261ad22091 // indirect
github.com/fatih/color v1.16.0 // indirect
github.com/google/go-github v17.0.0+incompatible // indirect
github.com/google/go-querystring v1.1.0 // indirect
Expand Down
4 changes: 4 additions & 0 deletions build/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ github.com/cli/safeexec v1.0.0 h1:0VngyaIyqACHdcMNWfo6+KdUYnqEr2Sg+bSP1pdF+dI=
github.com/cli/safeexec v1.0.0/go.mod h1:Z/D4tTN8Vs5gXYHDCbaM1S/anmEDnJb1iW0+EJ5zx3Q=
github.com/cli/shurcooL-graphql v0.0.4 h1:6MogPnQJLjKkaXPyGqPRXOI2qCsQdqNfUY1QSJu2GuY=
github.com/cli/shurcooL-graphql v0.0.4/go.mod h1:3waN4u02FiZivIV+p1y4d0Jo1jc6BViMA73C+sZo2fk=
github.com/curioswitch/go-build v0.0.0-20240606064955-be261ad22091 h1:uQuAhPoaAFpx7eAbKDxZSlfSgTO/nF/Oga07Ks5RZs4=
github.com/curioswitch/go-build v0.0.0-20240606064955-be261ad22091/go.mod h1:1reBtVlh1bRKD/d1OymtuKnXIF1aKn6ncY+dxF9uA7Q=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM=
Expand Down Expand Up @@ -50,6 +52,8 @@ github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5Cc
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/thlib/go-timezone-local v0.0.0-20210907160436-ef149e42d28e h1:BuzhfgfWQbX0dWzYzT1zsORLnHRv3bcRcsaUk0VmXA8=
github.com/thlib/go-timezone-local v0.0.0-20210907160436-ef149e42d28e/go.mod h1:/Tnicc6m/lsJE0irFMA0LfIwTBo4QP7A8IfyIv4zZKI=
github.com/wasilibs/tools v0.0.0-20240606073112-95e68538d401 h1:jNgFNGO+i1E6RD+9v99eCIatDv0ZTvZ/aRovsfVgQqY=
github.com/wasilibs/tools v0.0.0-20240606073112-95e68538d401/go.mod h1:756c6OtTEJS3KAetfQ1zDlNv4zTvOFkLPgFoTQmhoUk=
golang.org/x/sys v0.0.0-20210831042530-f4d43177bf5e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
Expand Down
2 changes: 1 addition & 1 deletion buildtools/wasm/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v0.12.6
v0.12.5
32 changes: 32 additions & 0 deletions go-protoc-gen-prost.code-workspace
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"folders": [
{
"name": "/",
"path": "."
}
],
"extensions": {
"recommendations": ["esbenp.prettier-vscode"]
},
"settings": {
"editor.tabSize": 2,
"[github-actions-workflow]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"go.lintFlags": ["--fix"],
"go.lintOnSave": "package",
"go.lintTool": "golangci-lint",
"gopls": {
"formatting.gofumpt": true
},
"[markdown]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[yaml]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
}
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ module github.com/wasilibs/go-protoc-gen-prost

go 1.22

require github.com/tetratelabs/wazero v1.7.0
require github.com/tetratelabs/wazero v1.7.1
3 changes: 1 addition & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
github.com/tetratelabs/wazero v1.7.0 h1:jg5qPydno59wqjpGrHph81lbtHzTrWzwwtD4cD88+hQ=
github.com/tetratelabs/wazero v1.7.0/go.mod h1:ytl6Zuh20R/eROuyDaGPkp82O9C/DJfXAwJfQ3X6/7Y=
github.com/tetratelabs/wazero v1.7.1 h1:QtSfd6KLc41DIMpDYlJdoMc6k7QTN246DM2+n2Y/Dx8=
2 changes: 1 addition & 1 deletion internal/runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func Run(name string, args []string, wasm []byte, stdin io.Reader, stdout io.Wri

_, err := rt.InstantiateWithConfig(ctx, wasm, cfg)
if err != nil {
if sErr, ok := err.(*sys.ExitError); ok {
if sErr, ok := err.(*sys.ExitError); ok { //nolint:errorlint
return int(sErr.ExitCode())
}
log.Fatal(err)
Expand Down
Loading

0 comments on commit ea1e0fb

Please sign in to comment.