Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial codebase review for FireFly Transaction Manager #2

Merged
merged 16 commits into from
Apr 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
**/node_modules
**/coverage
**/.nyc_output
firefly-transaction-manager
7 changes: 7 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
root = true

[*.{yaml,yml,json}]
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 2
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.go licensefile=.githooks/license-maintainer/LICENSE-go
12 changes: 12 additions & 0 deletions .github/settings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
repository:
name: firefly-transaction-manager
default_branch: main
has_downloads: false
has_issues: true
has_projects: false
has_wiki: false
archived: false
private: false
allow_squash_merge: false
allow_merge_commit: false
allow_rebase_merge: true
43 changes: 43 additions & 0 deletions .github/workflows/docker_main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Docker Main Build

on:
push:
branches:
- main

jobs:
docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Set build tag
id: build_tag_generator
run: |
RELEASE_TAG=$(curl https://api.github.com/repos/hyperledger/firefly-transaction-manager/releases/latest -s | jq .tag_name -r)
BUILD_TAG=$RELEASE_TAG-$(date +"%Y%m%d")-$GITHUB_RUN_NUMBER
echo ::set-output name=BUILD_TAG::$BUILD_TAG

- name: Build
run: |
make BUILD_VERSION="${GITHUB_REF##*/}" DOCKER_ARGS="\
--label commit=$GITHUB_SHA \
--label build_date=$(date -u +"%Y-%m-%dT%H:%M:%SZ") \
--label tag=${{ steps.build_tag_generator.outputs.BUILD_TAG }} \
--tag ghcr.io/hyperledger/firefly-transaction-manager:${{ steps.build_tag_generator.outputs.BUILD_TAG }}" \
docker

- name: Tag release
run: docker tag ghcr.io/hyperledger/firefly-transaction-manager:${{ steps.build_tag_generator.outputs.BUILD_TAG }} ghcr.io/hyperledger/firefly-transaction-manager:head

- name: Push docker image
run: |
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin
docker push ghcr.io/hyperledger/firefly-transaction-manager:${{ steps.build_tag_generator.outputs.BUILD_TAG }}

- name: Push head tag
run: |
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin
docker push ghcr.io/hyperledger/firefly-transaction-manager:head
37 changes: 37 additions & 0 deletions .github/workflows/docker_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Docker Release Build

on:
release:
types: [released, prereleased]

jobs:
docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Build
run: |
make BUILD_VERSION="${GITHUB_REF##*/}" DOCKER_ARGS="\
--label commit=$GITHUB_SHA \
--label build_date=$(date -u +"%Y-%m-%dT%H:%M:%SZ") \
--label tag=${GITHUB_REF##*/} \
--tag ghcr.io/hyperledger/firefly-transaction-manager:${GITHUB_REF##*/}" \
docker

- name: Tag release
if: github.event.action == 'released'
run: docker tag ghcr.io/hyperledger/firefly-transaction-manager:${GITHUB_REF##*/} ghcr.io/hyperledger/firefly-transaction-manager:latest

- name: Push docker image
run: |
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin
docker push ghcr.io/hyperledger/firefly-transaction-manager:${GITHUB_REF##*/}

- name: Push latest tag
if: github.event.action == 'released'
run: |
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin
docker push ghcr.io/hyperledger/firefly-transaction-manager:latest
28 changes: 28 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Go

on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16

- name: Build and Test
run: make

- name: Upload coverage
run: bash <(curl -s https://codecov.io/bash)

6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
**/*.jar
firefly-transaction-manager
coverage.txt
**/debug.test
.DS_Store
__debug*
60 changes: 60 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
run:
tests: false
skip-dirs:
- "mocks"
linters-settings:
golint: {}
gocritic:
enabled-checks: []
disabled-checks:
- regexpMust
goheader:
values:
regexp:
COMPANY: .*
template: |-
Copyright © {{ YEAR }} {{ COMPANY }}

SPDX-License-Identifier: Apache-2.0

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.
linters:
disable-all: false
enable:
- bodyclose
- deadcode
- depguard
- dogsled
- errcheck
- goconst
- gocritic
- gocyclo
- gofmt
- goheader
- goimports
- goprintffuncname
- gosec
- gosimple
- govet
- ineffassign
- misspell
- nakedret
- revive
- staticcheck
- structcheck
- stylecheck
- typecheck
- unconvert
- unparam
- unused
- varcheck
63 changes: 63 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{
"go.formatFlags": [
"-s"
],
"go.lintTool": "golangci-lint",
"cSpell.words": [
"APIID",
"ccache",
"dataexchange",
"Debugf",
"devdocs",
"Devel",
"ethconnect",
"fabconnect",
"ffcapi",
"ffcapimocks",
"ffcore",
"FFDX",
"ffenum",
"ffexclude",
"ffexcludeinput",
"ffexcludeoutput",
"ffievents",
"FFIID",
"ffimethods",
"ffresty",
"ffstruct",
"fftm",
"fftypes",
"finalizers",
"GJSON",
"Infof",
"IPFS",
"mtxs",
"NATS",
"Nowarn",
"oapispec",
"optype",
"policyengine",
"protocolid",
"resty",
"santhosh",
"secp",
"sigs",
"stretchr",
"sysmessaging",
"tekuri",
"tmconfig",
"tmmsgs",
"Tracef",
"txcommon",
"txcommonmocks",
"txid",
"txtype",
"unflushed",
"upgrader",
"upserts",
"Warnf",
"wsclient",
"wsconfig"
],
"go.testTimeout": "10s"
}
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Changelog

[FireFly Transaction Manager Releases](https://github.com/hyperledger/firefly-transaction-manager/releases)
7 changes: 7 additions & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# SPDX-License-Identifier: Apache-2.0

# FireFly Core Maintainers
* @peterbroadhurst @nguyer @awrichar

# FireFly Documentation Maintainers
/docs @peterbroadhurst @nguyer @awrichar @nickgaski
7 changes: 7 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Code of Conduct Guidelines

Please review the Hyperledger [Code of
Conduct](https://wiki.hyperledger.org/community/hyperledger-project-code-of-conduct)
before participating. It is important that we keep things civil.

<a rel="license" href="http://creativecommons.org/licenses/by/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by/4.0/88x31.png" /></a><br />This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by/4.0/">Creative Commons Attribution 4.0 International License</a>.
10 changes: 10 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
## Contributing

We welcome contributions to the FireFly Project in many forms, and
there's always plenty to do!

Please visit the
[contributors guide](https://hyperledger.github.io/firefly//contributors/contributors.html) in the
docs to learn how to make contributions to this exciting project.

<a rel="license" href="http://creativecommons.org/licenses/by/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by/4.0/88x31.png" /></a><br />This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by/4.0/">Creative Commons Attribution 4.0 International License</a>.
12 changes: 12 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM golang:1.16-buster AS builder
ARG BUILD_VERSION
ENV BUILD_VERSION=${BUILD_VERSION}
ADD . /fftm
WORKDIR /fftm
RUN make

FROM debian:buster-slim
WORKDIR /fftm
COPY --from=builder /fftm/firefly-transaction-manager /usr/bin/fftm

ENTRYPOINT [ "/usr/bin/fftm" ]
Loading