Skip to content

Commit 723a0d2

Browse files
Merge pull request #1 from tahzeer/3.0
Add staff portal api and related workflows
2 parents 6ef01d4 + a156348 commit 723a0d2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+2851
-2
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: OpenAPI Generate - Bene Portal API
2+
3+
on:
4+
push:
5+
branches:
6+
- "**"
7+
tags-ignore:
8+
- '**'
9+
workflow_dispatch:
10+
11+
jobs:
12+
openapi-publish:
13+
name: OpenAPI Generate - Bene Portal API
14+
runs-on: ubuntu-latest
15+
defaults:
16+
run:
17+
working-directory: openg2p-pbms-bene-portal-api
18+
steps:
19+
- uses: actions/checkout@v3
20+
- name: Get branch name (merge)
21+
run: |
22+
echo "BRANCH_NAME=$(echo ${{ github.ref }} | sed -e 's,.*/\(.*\),\1,')" >> $GITHUB_ENV
23+
- name: Setup python for openapi generate
24+
uses: actions/setup-python@v4
25+
with:
26+
python-version: "3.10"
27+
- name: Install app
28+
run: |
29+
python -m pip install git+https://github.com/openg2p/openg2p-fastapi-common@1.1\#subdirectory=openg2p-fastapi-common
30+
python -m pip install git+https://github.com/openg2p/openg2p-fastapi-common@1.1\#subdirectory=openg2p-fastapi-auth
31+
python -m pip install ../openg2p-pbms-models
32+
python -m pip install ../openg2p-bg-task-models
33+
python -m pip install .
34+
- name: Generate openapi json
35+
run: |
36+
mkdir -p api-docs/generated
37+
python3 main.py getOpenAPI api-docs/generated/openapi.json
38+
if ! [ -z "$(git status --porcelain=v1 2>/dev/null -- openg2p-pbms-bene-portal-api/api-docs/generated/openapi.json)" ]; then
39+
shopt -s nocasematch
40+
if [[ ${{ github.repository_owner }} == 'OpenG2P' ]]; then
41+
export OPENAPI_CHANGED="true"
42+
echo OPENAPI_CHANGED=$OPENAPI_CHANGED >> $GITHUB_ENV
43+
fi
44+
fi
45+
- name: Commit Changes
46+
uses: EndBug/add-and-commit@v7
47+
with:
48+
default_author: github_actions
49+
message: "Generated new openapi.json for Bene Portal API on push to ${{ github.event.inputs.git-ref }}"
50+
add: "openg2p-pbms-bene-portal-api/api-docs/generated/openapi.json"
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: OpenAPI Generate - Staff Portal API
2+
3+
on:
4+
push:
5+
branches:
6+
- "**"
7+
tags-ignore:
8+
- '**'
9+
workflow_dispatch:
10+
11+
jobs:
12+
openapi-publish:
13+
name: OpenAPI Generate - Staff Portal API
14+
runs-on: ubuntu-latest
15+
defaults:
16+
run:
17+
working-directory: openg2p-pbms-staff-portal-api
18+
steps:
19+
- uses: actions/checkout@v3
20+
- name: Get branch name (merge)
21+
run: |
22+
echo "BRANCH_NAME=$(echo ${{ github.ref }} | sed -e 's,.*/\(.*\),\1,')" >> $GITHUB_ENV
23+
- name: Setup python for openapi generate
24+
uses: actions/setup-python@v4
25+
with:
26+
python-version: "3.10"
27+
- name: Install app
28+
run: |
29+
python -m pip install git+https://github.com/openg2p/openg2p-fastapi-common@1.1\#subdirectory=openg2p-fastapi-common
30+
python -m pip install git+https://github.com/openg2p/openg2p-fastapi-common@1.1\#subdirectory=openg2p-fastapi-auth
31+
python -m pip install ../openg2p-pbms-models
32+
python -m pip install ../openg2p-bg-task-models
33+
python -m pip install .
34+
- name: Generate openapi json
35+
run: |
36+
mkdir -p api-docs/generated
37+
python3 main.py getOpenAPI api-docs/generated/openapi.json
38+
if ! [ -z "$(git status --porcelain=v1 2>/dev/null -- openg2p-pbms-staff-portal-api/api-docs/generated/openapi.json)" ]; then
39+
shopt -s nocasematch
40+
if [[ ${{ github.repository_owner }} == 'OpenG2P' ]]; then
41+
export OPENAPI_CHANGED="true"
42+
echo OPENAPI_CHANGED=$OPENAPI_CHANGED >> $GITHUB_ENV
43+
fi
44+
fi
45+
- name: Commit Changes
46+
uses: EndBug/add-and-commit@v7
47+
with:
48+
default_author: github_actions
49+
message: "Generated new openapi.json for Staff Portal API on push to ${{ github.event.inputs.git-ref }}"
50+
add: "openg2p-pbms-staff-portal-api/api-docs/generated/openapi.json"

.github/workflows/pre-commit.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: pre-commit
2+
3+
on:
4+
pull_request:
5+
push:
6+
workflow_dispatch:
7+
8+
jobs:
9+
pre-commit:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v3
13+
- uses: actions/setup-python@v3
14+
- uses: pre-commit/action@v3.0.0
15+
with:
16+
extra_args: --all-files --show-diff-on-failure

.github/workflows/tag.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Tag the repo
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
new-tag:
6+
description: Tag in "vN.N.N" format
7+
required: true
8+
type: string
9+
previous-tag:
10+
description: Previous tag. "None" if no previous tag
11+
required: true
12+
type: string
13+
default: latest
14+
jobs:
15+
tag-repo:
16+
uses: openg2p/openg2p-packaging/.github/workflows/tag.yml@main
17+
with:
18+
new-tag: ${{ inputs.new-tag }}
19+
previous-tag: ${{ inputs.previous-tag }}
20+
secrets:
21+
OPENG2P_BOT_GITHUB_PAT: ${{ secrets.OPENG2P_BOT_GITHUB_PAT }}

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,9 +182,9 @@ cython_debug/
182182
.abstra/
183183

184184
# Visual Studio Code
185-
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
185+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
186186
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
187-
# and can be added to the global gitignore or merged into this file. However, if you prefer,
187+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
188188
# you could uncomment the following to ignore the entire vscode folder
189189
# .vscode/
190190

.pre-commit-config.yaml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
exclude: |
2+
(?x)
3+
# We don't want to mess with tool-generated files
4+
.svg$|/tests/([^/]+/)?cassettes/|^.copier-answers.yml$|^.github/|
5+
# Maybe reactivate this when all README files include prettier ignore tags?
6+
^README\.md$|
7+
# Repos using Sphinx to generate docs don't need prettying
8+
^docs/_templates/.*\.html$|
9+
# You don't usually want a bot to modify your legal texts
10+
(LICENSE.*|COPYING.*)
11+
default_language_version:
12+
python: python3
13+
repos:
14+
- repo: https://github.com/pre-commit/pre-commit-hooks
15+
rev: v4.4.0
16+
hooks:
17+
- id: trailing-whitespace
18+
- id: end-of-file-fixer
19+
- id: debug-statements
20+
- id: fix-encoding-pragma
21+
args: ["--remove"]
22+
- id: check-case-conflict
23+
- id: check-docstring-first
24+
- id: check-executables-have-shebangs
25+
- id: check-merge-conflict
26+
- id: check-symlinks
27+
- id: check-toml
28+
- id: check-yaml
29+
args:
30+
- --unsafe
31+
- id: mixed-line-ending
32+
args: ["--fix=lf"]
33+
- repo: https://github.com/asottile/pyupgrade
34+
rev: v3.11.0
35+
hooks:
36+
- id: pyupgrade
37+
args:
38+
- --py3-plus
39+
- --keep-runtime-typing
40+
- repo: https://github.com/psf/black
41+
rev: 23.9.1
42+
hooks:
43+
- id: black
44+
- repo: https://github.com/astral-sh/ruff-pre-commit
45+
rev: v0.0.289
46+
hooks:
47+
- id: ruff
48+
args:
49+
- --fix

.ruff.toml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
select = [
2+
"E", # pycodestyle errors
3+
"W", # pycodestyle warnings
4+
"F", # pyflakes
5+
"I", # isort
6+
"C", # flake8-comprehensions
7+
"B", # flake8-bugbear
8+
]
9+
ignore = [
10+
"E501", # line too long, handled by black
11+
"B008", # do not perform function calls in argument defaults
12+
"C901", # too complex
13+
]
14+
15+
[per-file-ignores]
16+
"__init__.py" = ["F401"]
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Social Registry Database
2+
PBMS_BENE_PORTAL_API_DB_USERNAME_PBMS='postgres'
3+
PBMS_BENE_PORTAL_API_DB_PASSWORD_PBMS='password'
4+
PBMS_BENE_PORTAL_API_DB_HOSTNAME_PBMS='localhost'
5+
PBMS_BENE_PORTAL_API_DB_PORT_PBMS='5432'
6+
PBMS_BENE_PORTAL_API_DB_DBNAME_PBMS='pbmsdb'
7+
8+
# Background Task Database
9+
PBMS_BENE_PORTAL_API_DB_USERNAME_BG_TASK='postgres'
10+
PBMS_BENE_PORTAL_API_DB_PASSWORD_BG_TASK='password'
11+
PBMS_BENE_PORTAL_API_DB_HOSTNAME_BG_TASK='localhost'
12+
PBMS_BENE_PORTAL_API_DB_PORT_BG_TASK='5432'
13+
PBMS_BENE_PORTAL_API_DB_DBNAME_BG_TASK='bgtaskdb'
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
# Code of Conduct
2+
3+
## Contributor Covenant Code of Conduct
4+
5+
### Preamble
6+
7+
OpenG2P was created to foster an open, innovative and inclusive community around open source & open standard.
8+
To clarify expected behaviour in our communities we have adopted the Contributor Covenant. This code of
9+
conduct has been adopted by many other open source communities and we feel it expresses our values well.
10+
11+
### Our Pledge
12+
13+
We as members, contributors, and leaders pledge to make participation in our community a harassment-free
14+
experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex
15+
characteristics, gender identity and expression, level of experience, education, socio-economic status,
16+
nationality, personal appearance, race, caste, color, religion, or sexual identity and orientation.
17+
18+
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy
19+
community.
20+
21+
### Our Standards
22+
23+
Examples of behavior that contributes to a positive environment for our community include:
24+
25+
- Demonstrating empathy and kindness toward other people
26+
- Being respectful of differing opinions, viewpoints, and experiences
27+
- Giving and gracefully accepting constructive feedback
28+
- Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
29+
- Focusing on what is best not just for us as individuals, but for the overall community
30+
31+
Examples of unacceptable behavior include:
32+
33+
- The use of sexualized language or imagery, and sexual attention or advances of any kind
34+
- Trolling, insulting or derogatory comments, and personal or political attacks
35+
- Public or private harassment
36+
- Publishing others' private information, such as a physical or email address, without their explicit
37+
permission
38+
- Other conduct which could reasonably be considered inappropriate in a professional setting
39+
40+
### Enforcement Responsibilities
41+
42+
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will
43+
take appropriate and fair corrective action in response to any behavior that they deem inappropriate,
44+
threatening, offensive, or harmful.
45+
46+
Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki
47+
edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate
48+
reasons for moderation decisions when appropriate.
49+
50+
### Scope
51+
52+
This Code of Conduct applies within all community spaces, and also applies when an individual is officially
53+
representing the community in public spaces. Examples of representing our community include using an official
54+
e-mail address, posting via an official social media account, or acting as an appointed representative at an
55+
online or offline event.
56+
57+
### Enforcement
58+
59+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders
60+
responsible for enforcement at \[INSERT CONTACT METHOD]. All complaints will be reviewed and investigated
61+
promptly and fairly.
62+
63+
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
64+
65+
### Enforcement Guidelines
66+
67+
Community leaders will follow these Community Impact Guidelines in determining the consequences for any action
68+
they deem in violation of this Code of Conduct:
69+
70+
#### 1. Correction
71+
72+
**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in
73+
the community.
74+
75+
**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the
76+
violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
77+
78+
#### 2. Warning
79+
80+
**Community Impact**: A violation through a single incident or series of actions.
81+
82+
**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved,
83+
including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time.
84+
This includes avoiding interactions in community spaces as well as external channels like social media.
85+
Violating these terms may lead to a temporary or permanent ban.
86+
87+
#### 3. Temporary Ban
88+
89+
**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
90+
91+
**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a
92+
specified period of time. No public or private interaction with the people involved, including unsolicited
93+
interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may
94+
lead to a permanent ban.
95+
96+
#### 4. Permanent Ban
97+
98+
**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained
99+
inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of
100+
individuals.
101+
102+
**Consequence**: A permanent ban from any sort of public interaction within the community.
103+
104+
### Attribution
105+
106+
This Code of Conduct is adapted from the
107+
[Contributor Covenant version 2.1](https://www.contributor-covenant.org/version/2/1/code_of_conduct/).
108+
109+
Community Impact Guidelines were inspired by
110+
[Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
111+
112+
For answers to common questions about this code of conduct, see the
113+
[FAQ](https://www.contributor-covenant.org/faq). Translations are available
114+
[here](https://www.contributor-covenant.org/translations).
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Refer to contribution guidelines
2+
[here](https://github.com/OpenG2P/openg2p-documentation/blob/1.0.0/community/contributing-to-openg2p.md).

0 commit comments

Comments
 (0)