-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #41 from clly/workflows
Create GitHub Workflows
- Loading branch information
Showing
13 changed files
with
236 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/usr/bin/env python3 | ||
|
||
from sys import stdin | ||
import json | ||
|
||
lines = [] | ||
for line in stdin: | ||
lines.append(line.strip()) | ||
|
||
|
||
print(json.dumps(lines)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euf pipefail | ||
|
||
WORK="go.work" | ||
if [[ -e $WORK ]]; then | ||
S=1 | ||
while IFS= read -r line; do | ||
if [[ $line == ')' ]]; then | ||
S=1 | ||
fi | ||
# echo "$S $line" | ||
if [ $S -eq 0 ]; then | ||
echo -e "${line}" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' | ||
fi | ||
|
||
if [[ $line == 'use (' ]]; then | ||
S=0 | ||
fi | ||
done < $WORK | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
name: "Go Checks" | ||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
# It's important that the action also runs on merge to main | ||
- main | ||
|
||
jobs: | ||
mods: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
go-mods: ${{ steps.get-go-mods.outputs.go-mods }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- id: get-go-mods | ||
run: | | ||
f=$(./.github/mods.sh | ./.github/in-to-json.py) | ||
echo "go-mods=${f}" >> $GITHUB_OUTPUT | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Setup Go environment | ||
uses: actions/setup-go@v4.0.1 | ||
- name: test | ||
run: | | ||
make test | ||
lint: | ||
runs-on: ubuntu-latest | ||
needs: [mods] | ||
strategy: | ||
matrix: | ||
mod: ${{ fromJson(needs.mods.outputs.go-mods)}} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Setup Go environment | ||
uses: actions/setup-go@v4.0.1 | ||
- name: lint | ||
uses: golangci/golangci-lint-action@v3 | ||
with: | ||
# Require: The version of golangci-lint to use. | ||
# When `install-mode` is `binary` (default) the value can be v1.2 or v1.2.3 or `latest` to use the latest version. | ||
# When `install-mode` is `goinstall` the value can be v1.2.3, `latest`, or the hash of a commit. | ||
version: v1.53 | ||
skip-pkg-cache: true | ||
working-directory: ${{ matrix.mod }} | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Setup Go environment | ||
uses: actions/setup-go@v4.0.1 | ||
- name: build | ||
run: | | ||
make build | ||
coverage: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
# default fetch-depth is insufficent to find previous coverage notes | ||
fetch-depth: 10 | ||
|
||
- uses: gwatts/go-coverage-action@v1 | ||
id: coverage | ||
with: | ||
# Optional coverage threshold | ||
# use fail-coverage to determine what should happen below this threshold | ||
coverage-threshold: 20 | ||
|
||
# collect coverage for all packages beyond the one under test | ||
cover-pkg: ./... | ||
|
||
# Ignore code-generated files when calculating coverage totals | ||
ignore-pattern: | | ||
\.pb\.go$ | ||
\_string\.go$ | ||
# A url that the html report will be accessible at, once your | ||
# workflow uploads it. Used in the pull request comment. | ||
#report-url: https://artifacts.example.com/go-coverage/${{ github.ref_name}}.html | ||
|
||
#- name: Upload coverage to s3 | ||
# ensure this runs regardless of whether the threshold is met using always() | ||
#if: always() && steps.coverage.outputs.report-pathname != '' | ||
#run: | | ||
# aws s3 cp ${{ steps.coverage.outputs.report-pathname }} s3://artifacts.example.com-bucket/go-coverage/${{ github.ref_name}}.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: goreleaser | ||
|
||
on: | ||
push: | ||
# run only against tags | ||
tags: | ||
- '*' | ||
|
||
permissions: | ||
contents: write | ||
packages: write | ||
# issues: write | ||
|
||
jobs: | ||
goreleaser: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- run: git fetch --force --tags | ||
- uses: actions/setup-go@v4 | ||
with: | ||
go-version: stable | ||
# More assembly might be required: Docker logins, GPG, etc. It all depends | ||
# on your needs. | ||
- uses: goreleaser/goreleaser-action@v4 | ||
with: | ||
# either 'goreleaser' (default) or 'goreleaser-pro': | ||
distribution: goreleaser | ||
version: latest | ||
args: release --clean | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
# Your GoReleaser Pro key, if you are using the 'goreleaser-pro' | ||
# distribution: | ||
# GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,6 @@ examples/example-otel/server | |
|
||
examples/example-oc/client | ||
examples/example-oc/server | ||
protoc-gen-go-telemetry | ||
|
||
dist/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# This is an example .goreleaser.yml file with some sensible defaults. | ||
# Make sure to check the documentation at https://goreleaser.com | ||
before: | ||
hooks: | ||
# You may remove this if you don't use go modules. | ||
- go mod tidy | ||
# you may remove this if you don't need go generate | ||
- go generate ./... | ||
builds: | ||
- main: ./cmd/protoc-gen-go-telemetry | ||
env: | ||
- CGO_ENABLED=0 | ||
goos: | ||
- linux | ||
- windows | ||
- darwin | ||
|
||
archives: | ||
- format: tar.gz | ||
# this name template makes the OS and Arch compatible with the results of uname. | ||
name_template: >- | ||
{{ .ProjectName }}_ | ||
{{- title .Os }}_ | ||
{{- if eq .Arch "amd64" }}x86_64 | ||
{{- else if eq .Arch "386" }}i386 | ||
{{- else }}{{ .Arch }}{{ end }} | ||
{{- if .Arm }}v{{ .Arm }}{{ end }} | ||
# use zip for windows archives | ||
format_overrides: | ||
- goos: windows | ||
format: zip | ||
checksum: | ||
name_template: 'checksums.txt' | ||
snapshot: | ||
name_template: "{{ incpatch .Version }}-next" | ||
changelog: | ||
sort: asc | ||
filters: | ||
exclude: | ||
- '^docs:' | ||
- '^test:' | ||
|
||
# The lines beneath this are called `modelines`. See `:help modeline` | ||
# Feel free to remove those if you don't want/use them. | ||
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json | ||
# vim: set ts=2 sw=2 tw=0 fo=cnqoj |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.