-
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.
- Loading branch information
Showing
12 changed files
with
548 additions
and
1 deletion.
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,25 @@ | ||
coverage: | ||
status: | ||
project: | ||
default: | ||
informational: true | ||
patch: | ||
default: | ||
informational: true | ||
ignore: | ||
# All 'pb.go's. | ||
- "**/*.pb.go" | ||
# Tests and test related files. | ||
- "**/test" | ||
- "**/testdata" | ||
- "**/testutils" | ||
- "benchmark" | ||
- "interop" | ||
# Other submodules. | ||
- "cmd" | ||
- "examples" | ||
- "gcp" | ||
- "security" | ||
- "stats/opencensus" | ||
comment: | ||
layout: "header, diff, files" |
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,18 @@ | ||
# To get started with Dependabot version updates, you'll need to specify which | ||
# package ecosystems to update and where the package manifests are located. | ||
# Please see the documentation for all configuration options: | ||
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates | ||
|
||
version: 2 | ||
updates: | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "monthly" | ||
groups: | ||
github-actions: | ||
patterns: | ||
- "*" | ||
ignore: | ||
- dependency-name: "*" | ||
update-types: ["version-update:semver-major"] |
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,65 @@ | ||
name: Workflow for CI | ||
on: [ push, pull_request ] | ||
jobs: | ||
run: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
go-version: [ '1.19', '1.20', '1.22.x' ] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Setup Go ${{ matrix.go-version }} | ||
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 | ||
with: | ||
go-version: ${{ matrix.go-version }} | ||
|
||
- name: Ensure the Go module is nice and tidy | ||
run: | | ||
go mod tidy && git diff --exit-code go.mod go.sum | ||
# We set the shell explicitly, here, and in other golang test actions, | ||
# as by default multi-line shell scripts do not error out on the first | ||
# failed command. Since we want an error reported if any of the lines | ||
# fail, we set the shell explicitly: | ||
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions?ref=cloudtechsimplified.com#exit-codes-and-error-action-preference | ||
shell: bash | ||
|
||
- name: Install Tools | ||
run: | | ||
pushd "$(mktemp -d)" | ||
go mod init example.com/m # fake module | ||
go install github.com/onsi/ginkgo/v2/[email protected] | ||
go install honnef.co/go/tools/cmd/[email protected] | ||
popd | ||
shell: bash | ||
|
||
- name: Verify Go Modules Setup | ||
run: go mod verify | ||
shell: bash | ||
|
||
- name: Build | ||
run: go build -v ./... | ||
shell: bash | ||
|
||
- name: Sanity Check (staticcheck) | ||
run: staticcheck ./... | ||
shell: bash | ||
|
||
- name: Test | ||
run: ginkgo -v -race -coverprofile=coverage.out -coverpkg=./... ./... | ||
shell: bash | ||
|
||
- name: Run tests and collect coverage | ||
run: pytest --cov app ${{ env.CODECOV_ATS_TESTS }} | ||
|
||
- name: Upload coverage to Codecov | ||
uses: codecov/codecov-action@54bcd8715eee62d40e33596ef5e8f0f48dbbccab # v4.1.0 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
slug: maguro/gslog | ||
flags: smart-tests | ||
verbose: true | ||
|
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: "CodeQL" | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
schedule: | ||
- cron: '24 20 * * 3' | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
analyze: | ||
name: Analyze | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 30 | ||
|
||
permissions: | ||
security-events: write | ||
pull-requests: read | ||
actions: read | ||
|
||
strategy: | ||
fail-fast: false | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | ||
|
||
# Initializes the CodeQL tools for scanning. | ||
- name: Initialize CodeQL | ||
uses: github/codeql-action/init@928ff8c822d966a999092a6a35e32177899afb7c # v2.24.6 | ||
with: | ||
languages: go | ||
|
||
- name: Perform CodeQL Analysis | ||
uses: github/codeql-action/analyze@928ff8c822d966a999092a6a35e32177899afb7c # v2.24.6 |
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,23 @@ | ||
name: Workflow for Codecov | ||
on: [ push, pull_request ] | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
upload: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Install checkout | ||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | ||
|
||
- name: Install checkout | ||
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 | ||
with: | ||
go-version: "stable" | ||
|
||
- name: Run coverage | ||
run: go test -coverprofile=coverage.out -coverpkg=./... ./... | ||
|
||
- name: Upload coverage to Codecov | ||
uses: codecov/codecov-action@ab904c41d6ece82784817410c45d8b8c02684457 # v3.1.6 |
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,80 @@ | ||
name: Testing | ||
|
||
# Trigger on pushes, PRs (excluding documentation changes), and nightly. | ||
on: | ||
push: | ||
pull_request: | ||
schedule: | ||
- cron: 0 0 * * * # daily at 00:00 | ||
|
||
permissions: | ||
contents: read | ||
|
||
# Always force the use of Go modules | ||
env: | ||
GO111MODULE: on | ||
|
||
jobs: | ||
|
||
# Run the main gRPC-Go tests. | ||
tests: | ||
# Proto checks are run in the above job. | ||
env: | ||
VET_SKIP_PROTO: 1 | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 20 | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- type: tests | ||
goversion: '1.22' | ||
|
||
- type: tests | ||
goversion: '1.22' | ||
testflags: -race | ||
|
||
- type: tests | ||
goversion: '1.22' | ||
goarch: 386 | ||
|
||
- type: tests | ||
goversion: '1.22' | ||
goarch: arm64 | ||
|
||
- type: tests | ||
goversion: '1.21' | ||
|
||
- type: tests | ||
goversion: '1.20' | ||
steps: | ||
# Setup the environment. | ||
- name: Setup GOARCH | ||
if: matrix.goarch != '' | ||
run: echo "GOARCH=${{ matrix.goarch }}" >> $GITHUB_ENV | ||
|
||
- name: Setup qemu emulator | ||
if: matrix.goarch == 'arm64' | ||
# setup qemu-user-static emulator and register it with binfmt_misc so that aarch64 binaries | ||
# are automatically executed using qemu. | ||
run: docker run --rm --privileged multiarch/qemu-user-static:5.2.0-2 --reset --credential yes --persistent yes | ||
|
||
- name: Setup GRPC environment | ||
if: matrix.grpcenv != '' | ||
run: echo "${{ matrix.grpcenv }}" >> $GITHUB_ENV | ||
|
||
- name: Setup Go | ||
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 | ||
with: | ||
go-version: ${{ matrix.goversion }} | ||
|
||
- name: Checkout repo | ||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | ||
|
||
# Main tests run for everything except when testing "extras" | ||
# (where we run a reduced set of tests). | ||
- name: Run tests | ||
if: matrix.type == 'tests' | ||
run: | | ||
go version | ||
go test ${{ matrix.testflags }} -cpu 1,4 -timeout 7m m4o.io/gslog/... |
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 |
---|---|---|
@@ -1,2 +1,7 @@ | ||
# gslog | ||
An slog Handler for Google Cloud Logging | ||
|
||
[![Documentation](https://godoc.org/github.com/maguro/gslog?status.svg)](http://godoc.org/github.com/maguro/gslog) | ||
[![Go Report Card](https://goreportcard.com/badge/github.com/maguro/gslog)](https://goreportcard.com/report/github.com/maguro/gslog) | ||
[![codecov](https://codecov.io/gh/maguro/gslog/graph/badge.svg?token=3FAJJ2SIZB)](https://codecov.io/gh/maguro/gslog) | ||
|
||
A Google Cloud Logging [Handler](https://pkg.go.dev/log/slog#Handler) implementation for [slog](https://go.dev/blog/slog). |
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,16 @@ | ||
// Copyright 2024 The original author or authors. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
// Package gslog contains a GCP logging implementation of slog.Handler. | ||
package gslog |
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 @@ | ||
module m4o.io/gslog | ||
|
||
go 1.22 | ||
|
||
require ( | ||
cloud.google.com/go/logging v1.9.0 | ||
github.com/stretchr/testify v1.9.0 | ||
) | ||
|
||
require ( | ||
cloud.google.com/go v0.110.8 // indirect | ||
cloud.google.com/go/compute v1.23.1 // indirect | ||
cloud.google.com/go/compute/metadata v0.2.3 // indirect | ||
cloud.google.com/go/longrunning v0.5.2 // indirect | ||
github.com/davecgh/go-spew v1.1.1 // indirect | ||
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect | ||
github.com/golang/protobuf v1.5.4 // indirect | ||
github.com/google/s2a-go v0.1.7 // indirect | ||
github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect | ||
github.com/googleapis/gax-go/v2 v2.12.0 // indirect | ||
github.com/pmezard/go-difflib v1.0.0 // indirect | ||
go.opencensus.io v0.24.0 // indirect | ||
golang.org/x/crypto v0.18.0 // indirect | ||
golang.org/x/net v0.20.0 // indirect | ||
golang.org/x/oauth2 v0.13.0 // indirect | ||
golang.org/x/sync v0.6.0 // indirect | ||
golang.org/x/sys v0.16.0 // indirect | ||
golang.org/x/text v0.14.0 // indirect | ||
google.golang.org/api v0.149.0 // indirect | ||
google.golang.org/appengine v1.6.7 // indirect | ||
google.golang.org/genproto v0.0.0-20231016165738-49dd2c1f3d0b // indirect | ||
google.golang.org/genproto/googleapis/api v0.0.0-20231016165738-49dd2c1f3d0b // indirect | ||
google.golang.org/genproto/googleapis/rpc v0.0.0-20231016165738-49dd2c1f3d0b // indirect | ||
google.golang.org/grpc v1.59.0 // indirect | ||
google.golang.org/protobuf v1.33.0 // indirect | ||
gopkg.in/yaml.v3 v3.0.1 // indirect | ||
) |
Oops, something went wrong.