Skip to content

Commit

Permalink
feat: initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
yvigara committed Dec 25, 2022
1 parent 43eff1b commit ca237d3
Show file tree
Hide file tree
Showing 22 changed files with 1,335 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .github/linters/ct.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# See https://github.com/helm/chart-testing#configuration
remote: origin
target-branch: main
chart-dirs:
- charts
helm-extra-args: --timeout 600s
45 changes: 45 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: build

on:
push:
branches:
- feature/workflows
- main
pull_request:
branches:
- main

env:
GO_VERSION: 1.19.3

jobs:
lint:
runs-on: ubuntu-latest
env:
GOPATH: /home/runner/work/open-feature/flagd
GOBIN: /home/runner/work/open-feature/flagd/bin
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup go
uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}

- name: Run linting
run: make lint

test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup go
uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}

- name: Run test
run: make test
68 changes: 68 additions & 0 deletions .github/workflows/image-on-push.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Build Docker image on push & release

on:
push:
branches:
- main
tags:
- v*
release:
types: [published]

env:
REGISTRY: ghcr.io

jobs:
build:
strategy:
matrix:
image:
- mimir-gateway
- loki-gateway

runs-on: ubuntu-latest
permissions:
packages: write
contents: read
id-token: write

steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ matrix.image }}

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@v3
with:
context: .
file: ./cmd/${{ matrix.image }}/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

- name: Install cosign
uses: sigstore/[email protected]

- name: Sign the published Docker image
env:
COSIGN_EXPERIMENTAL: 1
run: |
cosign sign ${{ steps.meta.outputs.tags }}
17 changes: 17 additions & 0 deletions .github/workflows/lint-pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: "Lint PR"

on:
pull_request_target:
types:
- opened
- edited
- synchronize

jobs:
main:
name: Validate PR title
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
54 changes: 54 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Release
on:
push:
branches:
- main

permissions:
contents: write # needed to write releases
id-token: write # needed for keyless signing
packages: write # needed for ghcr access

env:
GO_VERSION: 1.19.3

jobs:
release-please:
runs-on: ubuntu-latest
steps:
- uses: google-github-actions/release-please-action@v3
with:
command: manifest
token: ${{ secrets.GITHUB_TOKEN }}
default-branch: main
outputs:
release_created: ${{ steps.release.outputs.release_created }}
release_tag_name: ${{ steps.release.outputs.tag_name }}

go-release:
needs: release-please
runs-on: ubuntu-latest
if: ${{ needs.release-please.outputs.release_created }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ needs.release-please.outputs.release_tag_name }}

- name: Setup Cosign
uses: sigstore/[email protected]

- name: Setup Syft
uses: anchore/sbom-action/download-syft@v0

- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v3
with:
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30 changes: 30 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib

# Test binary, build with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# IDEs
.vscode
.idea

# Mac OS
.DS_STORE

cmd/cmd1/cmd1
cmd/cmd2/cmd2
dist/

# helm chart dependecies
charts/*/charts/
charts/*/Chart.lock

# release packages
.cr-release-packages/
71 changes: 71 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# This file contains all available configuration options
# with their default values.

# options for analysis running
run:
# define go version
go: "1.19"

# default concurrency is a available CPU number
#concurrency: 16

# timeout for analysis, e.g. 30s, 5m, default is 1m
timeout: 5m

# exit code when at least one issue was found, default is 1
issues-exit-code: 1

# include test files or not, default is true
tests: true

# list of build tags, all linters use it. Default is empty list.
build-tags:
- netgo

# output configuration options
output:
# colored-line-number|line-number|json|tab|checkstyle, default is "colored-line-number"
format: colored-line-number

# print lines of code with issue, default is true
print-issued-lines: true

# print linter name in the end of issue text, default is true
print-linter-name: true

linters-settings:
goimports:
local-prefixes: github.com/celest-io/go-release-please

errorlint:
# Check for plain error comparisons.
comparison: true

# Do not check for plain type assertions and type switches.
asserts: false

# Do not check whether fmt.Errorf uses the %w verb for formatting errors.
errorf: false

linters:
enable:
- goimports
- revive
- gofmt
- unused
- gosimple
- misspell
- errorlint
- goconst
- ineffassign
- unconvert
- govet
- typecheck
- staticcheck
- errcheck

issues:
exclude:
- Error return value of .*log\.Logger\)\.Log\x60 is not checked
- Error return value of .*.Log.* is not checked
- Error return value of `` is not checked
Loading

0 comments on commit ca237d3

Please sign in to comment.