Skip to content

Commit 06d8fcb

Browse files
Merge pull request #1 from pseudomuto/master
Fetch HEAD
2 parents b983450 + 6d097b8 commit 06d8fcb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+1650
-603
lines changed

.dockerignore

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
1-
/
2-
!/script
1+
.git/
2+
.github/
3+
dist/
4+
examples/
5+
fixtures/
6+
tmp/

.github/workflows/ci.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
test:
11+
strategy:
12+
matrix:
13+
go: [ '1.17.2' ]
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v2
17+
- uses: actions/setup-go@v2
18+
with:
19+
go-version: ${{ matrix.go }}
20+
21+
- name: Dependencies
22+
run: go get github.com/golang/protobuf/{proto,protoc-gen-go} github.com/haya14busa/goverage
23+
24+
- name: Tests
25+
run: |
26+
goverage -race -coverprofile=coverage.txt -covermode=atomic
27+
make test/bench test/lint
28+
29+
- name: Upload coverage to Codecov
30+
uses: codecov/codecov-action@v2

.github/workflows/release.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Login to Docker Hub
13+
uses: docker/login-action@v1
14+
with:
15+
username: pseudomuto
16+
password: ${{ secrets.DOCKER_TOKEN }}
17+
- name: Checkout
18+
uses: actions/checkout@v2
19+
with:
20+
fetch-depth: 0
21+
- name: Setup Go
22+
uses: actions/setup-go@v2
23+
with:
24+
go-version: 1.17
25+
- name: Release
26+
uses: goreleaser/goreleaser-action@v2
27+
with:
28+
version: latest
29+
args: release --rm-dist
30+
env:
31+
GITHUB_TOKEN: ${{ secrets.GH_RELEASE_TOKEN }}

.gitignore

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
/_tools
1+
/bin
22
/coverage.txt
33
/dist
4-
/gen_fixtures
5-
/protoc-gen-doc
6-
/test/*.dat
7-
/vendor
84
/tmp/

.gofmtignore

Lines changed: 0 additions & 2 deletions
This file was deleted.

.goreleaser.yaml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
project_name: protoc-gen-doc
2+
3+
before:
4+
hooks:
5+
- go mod tidy
6+
7+
builds:
8+
- main: ./cmd/protoc-gen-doc
9+
env:
10+
- CGO_ENABLED=0
11+
goos:
12+
- darwin
13+
- linux
14+
- windows
15+
goarch:
16+
- amd64
17+
- arm64
18+
19+
dockers:
20+
- image_templates:
21+
- pseudomuto/{{.ProjectName}}:latest
22+
- pseudomuto/{{.ProjectName}}:{{.Version}}
23+
- pseudomuto/{{.ProjectName}}:{{.Major}}
24+
- pseudomuto/{{.ProjectName}}:{{.Major}}.{{.Minor}}
25+
build_flag_templates:
26+
- "--pull"
27+
- "--label=org.opencontainers.image.created={{.Date}}"
28+
- "--label=org.opencontainers.image.title={{.ProjectName}}"
29+
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
30+
- "--label=org.opencontainers.image.version={{.Version}}"
31+
- "--platform=linux/amd64"
32+
extra_files:
33+
- LICENSE.md
34+
- README.md
35+
- script/entrypoint.sh
36+
37+
checksum:
38+
name_template: 'checksums.txt'
39+
40+
snapshot:
41+
name_template: "{{ incpatch .Version }}-next"
42+
43+
changelog:
44+
sort: asc
45+
filters:
46+
exclude:
47+
- '^docs:'
48+
- '^test:'

.travis.yml

Lines changed: 0 additions & 44 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,36 @@ All noteworthy changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) (as of Feb 2018)
66
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
77

8-
## [Unreleased](https://github.com/pseudomuto/protoc-gen-doc/compare/v1.3.0...master)
8+
## [Unreleased](https://github.com/pseudomuto/protoc-gen-doc/compare/v1.5.0...master)
9+
10+
_**CHANGELOG is now available with each release rather than in this file**_
11+
12+
### Changed
13+
14+
* Escape special characters in markdown anchors [#460](https://github.com/pseudomuto/protoc-gen-doc/pull/460)
15+
* Bump go to 1.17, protoc to 3.18.1, and leverage go:embed [#461](https://github.com/pseudomuto/protoc-gen-doc/pull/461)
16+
17+
## [v1.5.0](https://github.com/pseudomuto/protoc-gen-doc/compare/v1.4.1...v1.5.0)
18+
19+
* Add `source_relative` flag [#450](https://github.com/pseudomuto/protoc-gen-doc/pull/450)
20+
21+
## [v1.4.1](https://github.com/pseudomuto/protoc-gen-doc/compare/v1.3.2...v1.4.1)
22+
23+
* Add support for OneOf in templates [#436](https://github.com/pseudomuto/protoc-gen-doc/pull/436)
24+
* Note deprecated fields in HTML, Markdown, and Docbook outputs [#426](https://github.com/pseudomuto/protoc-gen-doc/pull/426)
25+
* Tidy up modules
26+
27+
## [v1.3.2](https://github.com/pseudomuto/protoc-gen-doc/compare/v1.3.1...v1.3.2) - May 7, 2020
28+
29+
### Changed
30+
31+
* Stripped unnecessary whitespace from markdown templates [#410](https://github.com/pseudomuto/protoc-gen-doc/pull/410)
32+
* Renamed `lyft_validate` extension to `envoyproxy_validate`
33+
[#392](https://github.com/pseudomuto/protoc-gen-doc/pull/392)
34+
* Fixed `envoyproxy_validate` rules with slice values such as `in` and `not_in`
35+
[#392](https://github.com/pseudomuto/protoc-gen-doc/pull/392)
36+
37+
## [v1.3.1](https://github.com/pseudomuto/protoc-gen-doc/compare/v1.3.0...v1.3.1) - March 3, 2020
938

1039
### Changed
1140

CONTRIBUTING.md

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ First off, glad you're here and want to contribute! :heart:
77
In order to work on this project, you'll need to install a few things:
88

99
1. A recent version of [Go](https://golang.org/doc/install)
10-
1. [protoc](https://github.com/google/protobuf#protocol-compiler-installation) - The protobuf compiler
11-
1. [Docker](https://www.docker.com/) (only required to if you need/want to build the docker container via `make docker`)
10+
1. [Docker](https://www.docker.com/) (only required to use `make dev/docker`, `make test/docker`, or release targets).
11+
1. [unzip](http://infozip.sourceforge.net/)
1212

13-
Once those are installed, running `make setup` should get you the rest of the way.
13+
Everything else that's needed will be installed as needed and put in `./bin`.
1414

1515
When writing tests, be sure that the package in the test file is suffixed with `_test`. Eg. `protoc_gen_doc_test`. This
1616
ensures that you'll only be testing the public interface.
@@ -19,13 +19,14 @@ ensures that you'll only be testing the public interface.
1919

2020
Here are some general guidelines for making PRs for this repo.
2121

22-
1. [Fork this repo](https://github.com/pseudomuto/protoc-gen-doc/fork)
23-
1. Make a branch off of master (`git checkout -b <your_branch_name>`)
24-
1. Make focused commits with descriptive messages
25-
1. Add tests that fail without your code, and pass with it
26-
1. GoFmt your code! (see <https://blog.golang.org/go-fmt-your-code> to setup your editor to do this for you)
27-
1. Be sure to run `make examples` so your changes are reflected in the example docs
28-
1. **Ping someone on the PR** (Lots of people, including myself, won't get a notification unless pinged directly)
22+
1. [Fork this repo](https://github.com/pseudomuto/protoc-gen-doc/fork).
23+
1. Make a branch off of master (`git checkout -b <your_branch_name>`).
24+
1. Make focused commits with descriptive messages.
25+
1. Add tests that fail without your code, and pass with it.
26+
1. GoFmt your code! (see <https://blog.golang.org/go-fmt-your-code> to setup your editor to do this for you).
27+
1. Be sure to run `make build/examples` so your changes are reflected in the example docs.
28+
1. Running `make test/docker` should produce the same output as `make build/examples`.
29+
1. **Ping someone on the PR** (Lots of people, including myself, won't get a notification unless pinged directly).
2930

3031
Every PR should have a well detailed summary of the changes being made and the reasoning behind them. Make sure to add
3132
at least three sections.
@@ -47,10 +48,10 @@ How has this change been tested? In your opinion what is the risk, if any, of me
4748
#### Reviewers should:
4849

4950
1. Identify anything that the PR author may have missed from above.
50-
2. Test the PR through whatever means necessary, including manually, to verify it is safe to be deployed.
51-
3. Question everything. Never assume that something was tested or fully understood, always question and ask if there is
51+
1. Test the PR through whatever means necessary, including manually, to verify it is safe to be deployed.
52+
1. Question everything. Never assume that something was tested or fully understood, always question and ask if there is
5253
any uncertainty.
53-
4. Before merging the PR make sure it has _**one**_ of the `Major release`, `Minor release`, or `Patch release` labels
54+
1. Before merging the PR make sure it has _**one**_ of the `Major release`, `Minor release`, or `Patch release` labels
5455
applied to it (useful for the changelog and determining the version for the next release).
5556

5657
## Release Process
@@ -66,14 +67,12 @@ Look through the new (since the last release) PRs that are included in this rele
6667

6768
### Now that we've got the version:
6869

69-
* Run `make docker_test` to build the image and generate the examples. There should be no diff after this.
70-
* Update the version in `version.go`
71-
* Update CHANGELOG.md. Be sure to include links to PRs and highlight new features, bug fixes, and any breaking changes.
72-
* Run `make release`
70+
From an up-to-date master, do the following:
7371

74-
Now that the tag is on GitHub, we have a couple more things to do:
72+
1. Run `make test/docker` to build the image and generate the examples. There should be no diff after this.
73+
1. Update the version in `version.go` appropriately.
74+
1. `git commit -am "Bump to version v<version>`.
75+
1. `git tag -s v<version>`.
76+
1. `git push origin master --tags`.
7577

76-
* Create a release based on the tag and copy the entry in CHANGELOG.md into the notes.
77-
* Run `make dist` and add the tar files (in `./dist`) to the release.
78-
79-
Once CI has run for the tag, Travis will push the image to DockerHub.
78+
Once the tag is on GitHub, the release action will handle pushing to docker and creating a release in GitHub.

Dockerfile

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,13 @@
1-
FROM debian:jessie-slim
2-
LABEL maintainer="pseudomuto <[email protected]>" protoc_version="3.6.1"
3-
1+
FROM alpine:3.15.0
42
WORKDIR /
53

6-
ADD https://github.com/google/protobuf/releases/download/v3.6.1/protoc-3.6.1-linux-x86_64.zip ./
7-
RUN apt-get -q -y update && \
8-
apt-get -q -y install unzip && \
9-
unzip protoc-3.6.1-linux-x86_64.zip -d ./usr/local && \
10-
rm protoc-3.6.1-linux-x86_64.zip && \
11-
apt-get remove --purge -y unzip && \
12-
apt-get autoremove && \
13-
rm -rf /var/lib/apt/lists/*
4+
RUN apk --update add bash protoc protobuf-dev && rm -rf /var/cache/apk/*
145

15-
ADD dist/protoc-gen-doc /usr/local/bin/
16-
ADD script/entrypoint.sh ./
6+
COPY LICENSE.md README.md script/entrypoint.sh ./
7+
COPY protoc-gen-doc /usr/bin/
178

18-
VOLUME ["/out", "/protos"]
9+
VOLUME ["/out"]
10+
VOLUME ["/protos"]
1911

20-
ENTRYPOINT ["/entrypoint.sh"]
12+
ENTRYPOINT ["./entrypoint.sh"]
2113
CMD ["--doc_opt=html,index.html"]

0 commit comments

Comments
 (0)