Skip to content

Commit

Permalink
Merge commit '5a3ba95095ce2e30c3bf224d921d4e32633a0b6a'
Browse files Browse the repository at this point in the history
  • Loading branch information
flemzord committed Apr 19, 2023
2 parents 57e7a2a + 5a3ba95 commit 05bf723
Show file tree
Hide file tree
Showing 19 changed files with 587 additions and 45 deletions.
9 changes: 9 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/api/ @formancehq/dev-backend
/cmd/ @formancehq/dev-backend
/config/ @formancehq/dev-backend
/core/ @formancehq/dev-backend
/ledger/ @formancehq/dev-backend
*.go @formancehq/dev-backend

/.devcontainer @flemzord
/.github @flemzord
27 changes: 27 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: bug
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:

**Expected behavior**
A clear and concise description of what you expected to happen.

**Logs**
If applicable, add logs to help explain your problem.

**Environment (please complete the following information):**
- OS: [e.g. ubuntu 20.04]
- Numary Version [e.g. 1.0.0-beta.4]

**Additional context**
Add any other context about the problem here.
22 changes: 22 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: enhancement, rfc
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Summary**

**Solution proposal**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
8 changes: 8 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE/pull_request_sdk_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# SDK : OPEN API GENERATOR NAME

__Please add a description to this PR.__

## How to deploy

__Please provide steps to deploy the generated sdk to official channels.__
__Please be as exhaustive as possible__
22 changes: 22 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Title

__Please add a description to this PR.__

## Type of change

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Refactoring / Technical debt

## What parts of the code are impacted ?
__Please describe the impacted parts of the code.__

# Checklist:

- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] New and existing unit tests pass locally with my changes
8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: 2
updates:

- package-ecosystem: "github-actions"
directory: "/"
schedule:
# Check for updates to GitHub Actions every weekday
interval: "daily"
23 changes: 23 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
'@domain/core':
- core/*
- core/**/*

'@domain/api':
- api/*
- api/**/*

'@domain/ledger':
- ledger/*
- ledger/**/*

'@domain/storage':
- storage/*
- storage/**/*

'@domain/cmd':
- cmd/*
- cmd/**/*

'@domain/ci':
- .github/*
- .github/**/*
18 changes: 18 additions & 0 deletions .github/workflows/benchmarks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Benchmarks
on:
workflow_dispatch

jobs:
bench:
runs-on: ubuntu-latest
steps:
- name: Install task
uses: arduino/setup-task@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version-file: 'go.mod'
- name: Run bench
run: task install:perf bench
33 changes: 33 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: "CodeQL"

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
schedule:
- cron: '35 21 * * 5'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [ 'go' ]
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
- name: Autobuild
uses: github/codeql-action/autobuild@v2
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
75 changes: 75 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
on:
push:
branches:
- main
pull_request:
types: [ assigned, opened, synchronize, reopened ]
release:
types: [ prereleased, released ]

name: Main
jobs:
Pr:
if: github.event_name == 'pull_request'
uses: formancehq/gh-workflows/.github/workflows/pr-style.yml@main

Control:
name: 'Control'
uses: ./.github/workflows/template_build-control.yaml
secrets:
NUMARY_GITHUB_TOKEN: ${{ secrets.NUMARY_GITHUB_TOKEN }}

GoReleaserBuild:
if: github.event_name != 'release'
name: 'GoReleaser Build'
uses: ./.github/workflows/template_goreleaser-build.yaml
secrets:
NUMARY_GITHUB_TOKEN: ${{ secrets.NUMARY_GITHUB_TOKEN }}
SEGMENT_WRITE_KEY_OSS: ${{ secrets.SEGMENT_WRITE_KEY_OSS }}

GoReleaserRelease:
if: github.event_name == 'release'
name: 'GoReleaser Release'
uses: ./.github/workflows/template_goreleaser-release.yaml
secrets:
NUMARY_GITHUB_TOKEN: ${{ secrets.NUMARY_GITHUB_TOKEN }}
SEGMENT_WRITE_KEY_OSS: ${{ secrets.SEGMENT_WRITE_KEY_OSS }}
FURY_TOKEN: ${{ secrets.FURY_TOKEN }}

SdkGenerate:
needs:
- GoReleaserBuild
uses: ./.github/workflows/template_sdk-generate.yaml
secrets:
NUMARY_GITHUB_TOKEN: ${{ secrets.NUMARY_GITHUB_TOKEN }}

SdkPublish:
needs:
- GoReleaserRelease
uses: ./.github/workflows/template_sdk-publish.yaml
with:
VERSION: ${{ github.event.release.tag_name }}
secrets:
NUMARY_GITHUB_TOKEN: ${{ secrets.NUMARY_GITHUB_TOKEN }}

DockerRelease:
if: github.event_name == 'release'
uses: ./.github/workflows/template_docker.yaml
with:
VERSION: ${{ github.event.release.tag_name }}
APP_SHA: ${{ github.sha }}
RELEASE: ${{ github.event.action }}
secrets:
NUMARY_GITHUB_TOKEN: ${{ secrets.NUMARY_GITHUB_TOKEN }}
SEGMENT_WRITE_KEY_OSS: ${{ secrets.SEGMENT_WRITE_KEY_OSS }}

DockerBranch:
if: github.event_name != 'release'
uses: ./.github/workflows/template_docker.yaml
with:
VERSION: develop
APP_SHA: ${{ github.sha }}
RELEASE: ${{ github.event.action }}
secrets:
NUMARY_GITHUB_TOKEN: ${{ secrets.NUMARY_GITHUB_TOKEN }}
SEGMENT_WRITE_KEY_OSS: ${{ secrets.SEGMENT_WRITE_KEY_OSS }}
12 changes: 12 additions & 0 deletions .github/workflows/pr_open_target.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: "Pull Request Labeler"
on:
- pull_request_target
# - pull_request

jobs:
Triage:
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v3
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
20 changes: 20 additions & 0 deletions .github/workflows/template_build-control.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Build for Control
on:
workflow_call:
secrets:
NUMARY_GITHUB_TOKEN:
required: true
description: GitHub token with access to the repo

jobs:
build:
name: 'Build Control'
runs-on: ubuntu-latest
steps:
- run: curl -OL https://github.com/numary/control/releases/download/1.2.0/numary-control-1.2.0.tar.gz
- run: tar -zxvf numary-control-1.2.0.tar.gz
- run: rm -rf numary-control-1.2.0.tar.gz
- uses: actions/upload-artifact@v2
with:
name: control-dist
path: ./**
81 changes: 81 additions & 0 deletions .github/workflows/template_docker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Docker Build & Publish
on:
workflow_call:
inputs:
VERSION:
type: string
required: true
description: The tag name to use for Docker.
APP_SHA:
type: string
required: true
description: The sha to use for Docker.
RELEASE:
type: string
required: true
description: Whether to release the Docker image.
secrets:
NUMARY_GITHUB_TOKEN:
required: true
description: GitHub token with access to the repo
SEGMENT_WRITE_KEY_OSS:
required: true
description: Segment write key for the OSS repo

jobs:
Docker:
name: 'Build & Publish Docker'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: fetch numary control
uses: actions/download-artifact@v2
with:
name: control-dist
path: cmd/control/
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: "NumaryBot"
password: ${{ secrets.NUMARY_GITHUB_TOKEN }}
- name: Build and push Released
if: inputs.RELEASE == 'released'
uses: docker/build-push-action@v2
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ghcr.io/formancehq/ledger:latest,ghcr.io/formancehq/ledger:${{ inputs.VERSION }}
build-args: |
APP_SHA=${{ inputs.APP_SHA }}
VERSION=${{ inputs.VERSION }}
SEGMENT_WRITE_KEY=${{ secrets.SEGMENT_WRITE_KEY_OSS }}
- name: Build and push PreReleased
if: inputs.RELEASE == 'prereleased'
uses: docker/build-push-action@v2
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ghcr.io/formancehq/ledger:${{ inputs.VERSION }}
build-args: |
APP_SHA=${{ inputs.APP_SHA }}
VERSION=${{ inputs.VERSION }}
SEGMENT_WRITE_KEY=${{ secrets.SEGMENT_WRITE_KEY_OSS }}
- name: Build and push
if: inputs.RELEASE != 'released' || inputs.RELEASE != 'prereleased'
uses: docker/build-push-action@v2
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ghcr.io/formancehq/ledger:${{ inputs.APP_SHA }}
build-args: |
APP_SHA=${{ inputs.APP_SHA }}
VERSION=${{ inputs.VERSION }}
SEGMENT_WRITE_KEY=${{ secrets.SEGMENT_WRITE_KEY_OSS }}
Loading

0 comments on commit 05bf723

Please sign in to comment.