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: Charles Shin <[email protected]>
  • Loading branch information
2 people authored and marwen-abid committed Aug 14, 2023
0 parents commit 4970031
Show file tree
Hide file tree
Showing 223 changed files with 26,725 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
dist
.tmp
13 changes: 13 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
babel.config.js
webpack.config.js
webpack.common.js
webpack.dev.js
webpack.prod.js
node_modules/
dist/
build/
.prettierrc.json
.eslintrc.json
prettier.config.js
.eslintrc.js
env.d.ts
51 changes: 51 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"extends": [
// By extending from a plugin config, we can get recommended rules without having to add them manually.
"eslint:recommended",
// "plugin:react/recommended",
// React v17+ doesn't need to have React imported in every file, it works globaly.
// "plugin:react/jsx-runtime",
"plugin:react-hooks/recommended",
"plugin:import/recommended",
"plugin:jsx-a11y/recommended",
"plugin:@typescript-eslint/recommended",
// This disables the formatting rules in ESLint that Prettier is going to be responsible for handling.
// Make sure it's always the last config, so it gets the chance to override other configs.
"eslint-config-prettier"
],
"settings": {
"react": {
// Tells eslint-plugin-react to automatically detect the version of React to use.
"version": "detect"
},
"import/parsers": {
"@typescript-eslint/parser": [".ts", ".tsx"]
},
// Tells eslint how to resolve imports
"import/resolver": {
"node": {
"paths": ["src"],
"extensions": [".js", ".jsx", ".ts", ".tsx"]
},
"typescript": {
"project": "@stellar/*/tsconfig.json"
}
}
},
"rules": {
"@typescript-eslint/ban-ts-comment": [
"error",
{ "ts-ignore": "allow-with-description" }
],
// TODO: ideally, these should be removed
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"jsx-a11y/click-events-have-key-events": "off",
"jsx-a11y/interactive-supports-focus": "off",
"jsx-a11y/label-has-associated-control": "off",
"react/prop-types": "off",
"react/jsx-key": "off",
"react/no-unescaped-entities": "off",
"import/named": "off"
}
}
97 changes: 97 additions & 0 deletions .github/workflows/docker_image_public_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# This workflow publishes a new docker image to 'https://hub.docker.com/r/stellar/stellar-disbursement-platform-frontend'
# when a new release is created or when we merge something to the develop branch.
name: Docker Image Public Release

on:
release:
types:
- published
push:
branches:
- develop

jobs:
test-build:
uses: ./.github/workflows/test-build.yml # execute the callable test-build.yml
secrets: inherit # pass all secrets

build_and_push_docker_image_on_release:
if: github.event_name == 'release'
name: Push to DockerHub (release prd) # stellar/stellar-disbursement-platform-frontend:{VERSION}
runs-on: ubuntu-latest
needs:
- test-build
steps:
- name: Check if tag is not empty
run: |
if [[ -z "${{ github.event.release.tag_name }}" ]]; then
echo "Release tag name cannot be empty."
exit 1
fi
- uses: actions/checkout@v3

- name: Login to DockerHub
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push to DockerHub (release prd)
uses: docker/[email protected]
with:
push: true
build-args: |
GIT_COMMIT=${{ github.event.release.tag_name }}
tags: stellar/stellar-disbursement-platform-frontend:${{github.event.release.tag_name}},stellar/stellar-disbursement-platform-frontend:latest
file: Dockerfile

build_and_push_docker_image_on_dev_push:
if: github.event_name == 'push' && github.ref == 'refs/heads/develop'
name: Push to DockerHub (release develop branch) # stellar/stellar-disbursement-platform-frontend:edge-{DATE}-{SHA}
runs-on: ubuntu-latest
needs:
- test-build
steps:
- uses: actions/checkout@v3

- name: Login to DockerHub
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Get current date
id: get_date
run: echo "DATE=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT

- name: Get SHA
shell: bash
id: get_sha
run:
echo "SHA=$(git rev-parse --short ${{ github.sha }} )" >>
$GITHUB_OUTPUT

- name: Build and push to DockerHub (develop branch)
uses: docker/[email protected]
with:
push: true
build-args: |
GIT_COMMIT=${{ steps.get_sha.outputs.SHA }}
tags:
stellar/stellar-disbursement-platform-frontend:edge,stellar/stellar-disbursement-platform-frontend:edge-${{steps.get_date.outputs.DATE
}}-${{ steps.get_sha.outputs.SHA }}
file: Dockerfile

complete:
if: always()
needs:
- build_and_push_docker_image_on_release
- build_and_push_docker_image_on_dev_push
runs-on: ubuntu-latest
steps:
- if:
contains(needs.*.result, 'failure') || contains(needs.*.result,
'cancelled')
run: exit 1
# TODO: figure out which job failed and print the logs
28 changes: 28 additions & 0 deletions .github/workflows/test-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Test and build

on:
push:
branches: [main]
pull_request:
workflow_call: # allows this workflow to be called from another workflow

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v2
with:
node-version: 18
- run: yarn install
- run: yarn build

complete:
if: always()
needs: [build]
runs-on: ubuntu-latest
steps:
- if:
contains(needs.*.result, 'failure') || contains(needs.*.result,
'cancelled')
run: exit 1
30 changes: 30 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js
.idea/

# testing
/coverage

# production
/build

# misc
.DS_Store
.env
.env.local
.env.development.local
.env.test.local
.env.production.local
.nvmrc

npm-debug.log*
yarn-debug.log*
yarn-error.log*
.eslintcache

# env variables
/public/settings/env-config.js
1 change: 1 addition & 0 deletions .husky/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_
4 changes: 4 additions & 0 deletions .husky/post-merge
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn install-if-package-changed
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn pre-commit
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Ignore artifacts:
dist
build
coverage
12 changes: 12 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"arrowParens:": "always",
"bracketSpacing": true,
"jsxBracketSameLine": false,
"printWidth": 80,
"proseWrap": "always",
"semi": true,
"singleQuote": false,
"tabWidth": 2,
"trailingComma": "all",
"useTabs": false
}
25 changes: 25 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

## [1.0.0](https://github.com/stellar/stellar-relief-backoffice/tree/1.0.0)

### Added

- The payment detail to display the cash-out status per payment.
- The account status to be able to track the cash-out status per account.

### Updated

- The account & disbursement detail pages to display the amount cashed-out per
account and per disbursement.

## {version} < 1.0.0

### Added:

- Disbursements list & detail.
- Beneficiaries (accounts) list & detail.
- Payments per disbursement detail and per account detail.
24 changes: 24 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FROM ubuntu:20.04 as build

LABEL maintainer="SDF Ops Team <[email protected]>"

RUN mkdir -p /app
WORKDIR /app

ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install --no-install-recommends -y gpg curl git make g++ ca-certificates apt-transport-https && \
curl -sSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key|gpg --dearmor >/etc/apt/trusted.gpg.d/nodesource.gpg && \
echo "deb https://deb.nodesource.com/node_18.x focal main" | tee /etc/apt/sources.list.d/nodesource.list && \
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg |gpg --dearmor >/etc/apt/trusted.gpg.d/yarnpkg.gpg && \
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \
apt-get update && apt-get install -y nodejs yarn && apt-get clean


COPY . /app/
RUN yarn install
RUN yarn build

FROM nginx:1.17

COPY --from=build /app/build/ /usr/share/nginx/html/
COPY --from=build /app/nginx.conf /etc/nginx/conf.d/default.conf
Loading

0 comments on commit 4970031

Please sign in to comment.