Skip to content

Commit

Permalink
Initial commit for open source release
Browse files Browse the repository at this point in the history
Co-authored-by: Caio Teixeira <[email protected]>
Co-authored-by: Erica Liu <[email protected]>
Co-authored-by: Cecília Romão <[email protected]>
Co-authored-by: Marwen Abid <[email protected]>
Co-authored-by: Stephen Fung <[email protected]>
Co-authored-by: Jake Urban <[email protected]>
Co-authored-by: Reece Markowsky <[email protected]>
Co-authored-by: Tori Samples <[email protected]>
  • Loading branch information
9 people committed Aug 14, 2023
0 parents commit d3251bd
Show file tree
Hide file tree
Showing 474 changed files with 78,300 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
name: Bug report
about: Tell us about a bug you found
title: ''
labels: bug
assignees: ''

---

<!-- Please answer these questions before submitting your issue. Thanks! -->

### What version are you using?

### What did you do?

### What happened?

### What did you expect to see instead?
14 changes: 14 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
blank_issues_enabled: true
contact_links:
- name: Frontend Project
url: https://github.com/stellar/stellar-disbursement-platform-frontend
about: The frontend project for this application.
- name: Stellar Laboratory
url: https://laboratory.stellar.org/#?network=test
about: The best place to experiment with the Stellar network.
- name: Docker Images
url: https://hub.docker.com/r/stellar/stellar-disbursement-platform-backend
about: Where to check the available Docker images that have been published.
- name: Stellar Ecosystem Proposals (SEPs)
url: https://github.com/stellar/stellar-protocol
about: The SEPs implemented in this project are defined here.
16 changes: 16 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
name: Feature request
about: Tell us what you'd like to see
title: 'Feature Request: '
labels: ''
assignees: ''

---

<!-- Please answer these questions before submitting your issue. Thanks! -->

### What problem does your feature solve?

### What would you like to see?

### What alternatives are there?
44 changes: 44 additions & 0 deletions .github/ISSUE_TEMPLATE/release_a_new_version.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
name: Release a New Version!
about: Prepare a release to be launched
title: ''
labels: release
---

<!-- Please Follow this checklist before making your release. Thanks! -->

## Release Checklist

> Attention: the examples below use the version `x.y.z` but you should update them to use the version you're releasing.
### Git Preparation

- [ ] Decide on a version number based on the current version number and the common rules defined in [Semantic Versioning](https://semver.org). E.g. `x.y.z`.
- [ ] Update this ticket name to reflect the new version number, following the pattern "Release `x.y.z`".
- [ ] Cut a branch for the new release out of the `develop` branch, following the gitflow naming pattern `release/x.y.z`.

### Code Preparation

- [ ] Update the code to use this version number.
- [ ] Update `version` and `appVersion` in [helmchart/sdp/Chart.yaml].
- [ ] Update the constant `Version` in [main.go]
- [ ] Update the [CHANGELOG.md] file with the new version number and release notes.
- [ ] Update the version and optionally the status in the header of the [README.md] file.
- [ ] Run tests and linting, and make sure the version running in the nain branch is working end-to-end. At least the minimal end-to-end manual tests is mandatory.
- [ ] 🚨 DO NOT RELEASE before holidays or weekends! Mondays and Tuesdays are preferred.

### Merging the Branches

- [ ] When the team is confident the release is stable, you'll need to create two pull requests:
- [ ] `release/x.y.z -> main`: 🚨 Do not squash-and-merge! This PR should be merged with a merge commit.
- [ ] `release/x.y.z -> develop`: this should be merged after the `main` branch is merged. 🚨 Do not squash-and-merge! This PR should be merged with a merge commit.

### Publishing the Release

- [ ] After the release branch is merged to `main`, create a new release on GitHub with the name `x.y.z` and the use the same changes from the [CHANGELOG.md] file.
- [ ] The release should automatically publish a new version of the docker image to Docker Hub. Double check if that happened.

[main.go]: ../../main.go
[README.md]: ../../README.md
[helmchart/sdp/Chart.yaml]: ../../helmchart/sdp/Chart.yaml
[CHANGELOG.md]: ../../CHANGELOG.md
48 changes: 48 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
### What

[TODO: Short statement about what is changing.]

### Why

[TODO: Why this change is being made. Include any context required to understand the why.]

### Known limitations

[TODO or N/A]

### Checklist

#### PR Structure

* [ ] This PR has reasonably narrow scope (if not, break it down into smaller PRs).
* [ ] This PR does not mix refactoring changes with feature changes (split into two PRs otherwise).
* [ ] This PR's title starts with the name of the package, area, or subject affected by the change.

#### Thoroughness

* [ ] This PR adds tests for the new functionality or fixes.
* [ ] This PR contains the link to the Jira ticket it addresses.

#### Configs and Secrets

* [ ] No new CONFIG variables are required -OR- the new required ones were added to the helmchart's [`values.yaml`] file.
* [ ] No new CONFIG variables are required -OR- the new required ones were added to the deployments ([`pr-preview`], [`dev`], [`demo`], `prd`).
* [ ] No new SECRETS variables are required -OR- the new required ones were mentioned in the helmchart's [`values.yaml`] file.
* [ ] No new SECRETS variables are required -OR- the new required ones were added to the deployments ([`pr-preview secrets`], [`dev secrets`], [`demo secrets`], `prd secrets`).

#### Release

* [ ] This is not a breaking change.
* [ ] **This is ready for production.**. If your PR is not ready for production, please consider opening additional complementary PRs using this one as the base. Only merge this into `develop` or `main` after it's ready for production!

#### Deployment

* [ ] Does the deployment work after merging?

[`values.yaml`]: ../helmchart/sdp/values.yaml
[`pr-preview`]: https://github.com/stellar/kube/blob/d3e4f5dd8aa4c13b45a31a5a937f3e98841171a7/kube001-dev/namespaces/common-previews/stellar-disbursement-platform/backend-helm-values
[`dev`]: https://github.com/stellar/kube/blob/d3e4f5dd8aa4c13b45a31a5a937f3e98841171a7/kube001-dev/namespaces/stellar-disbursement-platform/backend-helm-values
[`demo`]: https://github.com/stellar/kube/blob/d3e4f5dd8aa4c13b45a31a5a937f3e98841171a7/kube001-dev/namespaces/stellar-disbursement-platform/demo/demo-backend-helm-values
[`pr-preview secrets`]: https://github.com/stellar/kube/blob/d3e4f5dd8aa4c13b45a31a5a937f3e98841171a7/kube001-dev/namespaces/common-previews/externalsecrets-common-previews.yaml#L241-L346
[`dev secrets`]: https://github.com/stellar/kube/blob/d3e4f5dd8aa4c13b45a31a5a937f3e98841171a7/kube001-dev/namespaces/stellar-disbursement-platform/stellar-disbursement-platform-externalsecrets.yaml
[`demo secrets`]: https://github.com/stellar/kube/blob/d3e4f5dd8aa4c13b45a31a5a937f3e98841171a7/kube001-dev/namespaces/stellar-disbursement-platform/demo/demo-sdp-externalsecrets.yaml
56 changes: 56 additions & 0 deletions .github/workflows/anchor_platform_integration_check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: SDP<>AnchorPlatform Integration

on:
push:
branches:
- main
- develop
- "release/**"
- "releases/**"
- "hotfix/**"
pull_request:
workflow_call: # allows this workflow to be called from another workflow

jobs:
anchor-integration:
runs-on: ubuntu-latest
environment: "Anchor Integration Tests"
env:
DISTRIBUTION_PUBLIC_KEY: ${{ secrets.DISTRIBUTION_PUBLIC_KEY }}
DISTRIBUTION_SEED: ${{ secrets.DISTRIBUTION_SEED }}
SEP10_SIGNING_PUBLIC_KEY: ${{ secrets.SEP10_SIGNING_PUBLIC_KEY }}
SEP10_SIGNING_PRIVATE_KEY: ${{ secrets.SEP10_SIGNING_PRIVATE_KEY }}
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Run Docker Compose for SDP and Anchor Platform
working-directory: dev
run: docker-compose -f docker-compose-sdp-anchor.yml down && docker-compose -f docker-compose-sdp-anchor.yml up --build -d

- name: Install curl
run: sudo apt-get update && sudo apt-get install -y curl

- name: Wait for localhost:8080/health
timeout-minutes: 5
run: |
until curl --output /dev/null --silent --head --fail http://localhost:8080/health; do
echo 'Waiting for anchor-platform to be up and running...'
sleep 15
done
echo 'Anchor-platform is up and running.'
- name: Install NodeJs
uses: actions/setup-node@v2
with:
node-version: 14

- name: Anchor Validation Tests (@stellar/anchor-tests)
run: |
npm install -g @stellar/anchor-tests
stellar-anchor-tests --home-domain http://localhost:8080 --seps 1 10
- name: Docker logs
if: always()
working-directory: dev
run: docker-compose -f docker-compose-sdp-anchor.yml logs && docker-compose -f docker-compose-sdp-anchor.yml down
111 changes: 111 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
name: Go

on:
push:
branches:
- main
- develop
- "release/**"
- "releases/**"
- "hotfix/**"
pull_request:
workflow_call: # allows this workflow to be called from another workflow

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

- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.19

- name: golangci-lint
uses: golangci/golangci-lint-action@08e2f20817b15149a52b5b3ebe7de50aff2ba8c5 # version v3.4.0
with:
version: v1.52.2 # this is the golangci-lint version
args: --timeout 5m0s

- name: Run ./gomod.sh
run: ./gomod.sh

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

- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.19

- name: Build Project
run: go build ./...

test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:12-alpine
env:
POSTGRES_USER: postgres
POSTGRES_DB: postgres
POSTGRES_PASSWORD: postgres
PGHOST: localhost
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
env:
PGHOST: localhost
PGPORT: 5432
PGUSER: postgres
PGPASSWORD: postgres
PGDATABASE: postgres
DATABASE_URL: postgres://postgres:postgres@localhost:5432/postgres?sslmode=disable

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

- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: 1.19

- name: Run tests
run: go test -race -coverpkg=./... -coverprofile=c.out ./...

- name: Validate Test Coverage Threshold
env:
TESTCOVERAGE_THRESHOLD: 83 # percentage
run: |
echo "Quality Gate: Checking if test coverage is above threshold..."
echo "Threshold: $TESTCOVERAGE_THRESHOLD%"
totalCoverage=`./scripts/exclude_from_coverage.sh && go tool cover -func=c.out | grep total: | grep -Eo '[0-9]+\.[0-9]+'`
echo "Test Coverage: $totalCoverage%"
echo "-------------------------"
if (( $(echo "$totalCoverage $TESTCOVERAGE_THRESHOLD" | awk '{print ($1 >= $2)}') )); then
echo " $totalCoverage% > $TESTCOVERAGE_THRESHOLD%"
echo "Current test coverage is above threshold 🎉🎉🎉! Please keep up the good work!"
else
echo " $totalCoverage% < $TESTCOVERAGE_THRESHOLD%"
echo "🚨 Current test coverage is below threshold 😱! Please add more unit tests or adjust threshold to a lower value."
echo "Failed 😭"
exit 1
fi
complete:
if: always()
needs: [check, build, test]
runs-on: ubuntu-latest
steps:
- if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
run: exit 1
Loading

0 comments on commit d3251bd

Please sign in to comment.