-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #38 from OpenG2P/1.0
1.0
- Loading branch information
Showing
80 changed files
with
4,215 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: Example Bank API Branch Workflow | ||
|
||
on: | ||
push: | ||
branches-ignore: | ||
- develop | ||
tags-ignore: | ||
- '*' | ||
|
||
jobs: | ||
docker-build-for-branch: | ||
name: Docker Build and Push For API Branch | ||
runs-on: ubuntu-latest | ||
env: | ||
NAMESPACE: ${{ secrets.docker_hub_organisation || 'openg2p' }} | ||
SERVICE_NAME: openg2p-g2p-bridge-example-bank-api | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Docker build | ||
run: | | ||
BRANCH_NAME=$(echo ${{ github.ref }} | sed -e 's,.*/\(.*\),\1,') | ||
IMAGE_ID=$NAMESPACE/$SERVICE_NAME | ||
# Change all uppercase to lowercase | ||
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') | ||
VERSION=$BRANCH_NAME | ||
echo IMAGE_ID=$IMAGE_ID | ||
echo VERSION=$VERSION | ||
echo IMAGE_ID=$IMAGE_ID >> $GITHUB_ENV | ||
echo VERSION=$VERSION >> $GITHUB_ENV | ||
docker build ./openg2p-g2p-bridge-example-bank-api -f ./openg2p-g2p-bridge-example-bank-api/Dockerfile-git \ | ||
--tag $IMAGE_ID:$VERSION | ||
if [[ '${{ secrets.docker_hub_token }}' != '' && '${{ secrets.docker_hub_actor }}' != '' ]]; then | ||
export DOCKER_PUSH="true" | ||
echo DOCKER_PUSH=$DOCKER_PUSH >> $GITHUB_ENV | ||
fi | ||
- name: Docker push | ||
if: env.DOCKER_PUSH == 'true' | ||
run: | | ||
echo "${{ secrets.docker_hub_token }}" | docker login -u ${{ secrets.docker_hub_actor }} --password-stdin | ||
docker push ${{ env.IMAGE_ID }}:${{ env.VERSION }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
name: Example Bank API Tag Workflow | ||
|
||
on: | ||
push: | ||
tags: | ||
- "*" | ||
branches-ignore: | ||
- '*' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
publish-to-pypi: | ||
name: Publish to PyPI For API Tag | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.10" | ||
- uses: actions/checkout@v3 | ||
- name: Install build dependencies | ||
run: pip install build | ||
- name: Build distribution | ||
run: python -m build ./openg2p-g2p-bridge-example-bank-api | ||
- name: Publish | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
password: ${{ secrets.PYPI_API_TOKEN }} | ||
packages-dir: ./openg2p-g2p-bridge-example-bank-api/dist/ | ||
|
||
openapi-publish: | ||
name: OpenAPI Generate and Publish For API Tag | ||
needs: publish-to-pypi | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Get branch name (merge) | ||
run: | | ||
echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | ||
- name: Setup python for openapi generate | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.10" | ||
- name: Install app | ||
run: | | ||
python -m pip install git+https://github.com/openg2p/openg2p-fastapi-common@v1.1.1\#subdirectory=openg2p-fastapi-common | ||
python -m pip install git+https://github.com/openg2p/openg2p-fastapi-common@v1.1.1\#subdirectory=openg2p-fastapi-auth | ||
python -m pip install git+https://github.com/openg2p/openg2p-g2p-bridge-example-bank@v1.0.0\#subdirectory=openg2p-g2p-bridge-example-bank-models | ||
python -m pip install openg2p-g2p-bridge-example-bank-api==1.0.0 | ||
- name: Generate openapi json | ||
run: | | ||
mkdir -p openg2p-g2p-bridge-example-bank-api/api-docs/generated | ||
python3 openg2p-g2p-bridge-example-bank-api/main.py getOpenAPI openg2p-g2p-bridge-example-bank-api/api-docs/generated/openapi.json | ||
- name: Setup nodejs | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '18' | ||
- name: Publish to stoplight | ||
run: | | ||
npx @stoplight/cli@5 push --ci-token ${{ secrets.STOPLIGHT_PROJECT_TOKEN }} --url https://openg2p.stoplight.io --branch ${{ env.TAG_NAME }} --directory openg2p-g2p-bridge-example-bank-api/api-docs/generated | ||
docker-build-for-tag: | ||
name: Docker Build and Push For API Tag | ||
needs: publish-to-pypi | ||
runs-on: ubuntu-latest | ||
env: | ||
NAMESPACE: ${{ secrets.docker_hub_organisation || 'openg2p' }} | ||
SERVICE_NAME: openg2p-g2p-bridge-example-bank-api | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Docker build | ||
run: | | ||
echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | ||
IMAGE_ID=$NAMESPACE/$SERVICE_NAME | ||
# Change all uppercase to lowercase | ||
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') | ||
VERSION=TAG_NAME | ||
echo IMAGE_ID=$IMAGE_ID | ||
echo VERSION=$VERSION | ||
echo IMAGE_ID=$IMAGE_ID >> $GITHUB_ENV | ||
echo VERSION=$VERSION >> $GITHUB_ENV | ||
docker build ./openg2p-g2p-bridge-example-bank-api -f ./openg2p-g2p-bridge-example-bank-api/Dockerfile-pypi \ | ||
--tag $IMAGE_ID:$VERSION | ||
if [[ '${{ secrets.docker_hub_token }}' != '' && '${{ secrets.docker_hub_actor }}' != '' ]]; then | ||
export DOCKER_PUSH="true" | ||
echo DOCKER_PUSH=$DOCKER_PUSH >> $GITHUB_ENV | ||
fi | ||
- name: Docker push | ||
if: env.DOCKER_PUSH == 'true' | ||
run: | | ||
echo "${{ secrets.docker_hub_token }}" | docker login -u ${{ secrets.docker_hub_actor }} --password-stdin | ||
docker push ${{ env.IMAGE_ID }}:${{ env.VERSION }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
name: Test and coverage | ||
|
||
on: | ||
pull_request: | ||
push: | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: check-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
test: | ||
name: test with ${{ matrix.py }} on ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
py: | ||
- "3.10" | ||
os: | ||
- ubuntu-latest | ||
services: | ||
postgres: | ||
image: postgres:9.6 | ||
env: | ||
POSTGRES_USER: openg2p | ||
POSTGRES_PASSWORD: openg2p | ||
POSTGRES_DB: openg2p | ||
ports: | ||
- 5432:5432 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Setup python for test ${{ matrix.py }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.py }} | ||
- name: Install test requirements | ||
run: | | ||
python -m pip install -r test-requirements.txt | ||
python -m pip install -e openg2p-g2p-bridge-example-bank-api | ||
# TODO: add other packages here | ||
- name: Run test suite | ||
run: | | ||
pytest --cov-branch --cov-report=term-missing --cov=openg2p-g2p-bridge-example-bank-api --cov=tests | ||
- name: Upload coverage to Codecov | ||
uses: codecov/codecov-action@v4 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Bank Models PyPI Publish | ||
|
||
on: | ||
push: | ||
tags: | ||
- "*" | ||
branches-ignore: | ||
- '*' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
publish-to-pypi: | ||
name: Publish to PyPI For Models Tag | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.10" | ||
- uses: actions/checkout@v3 | ||
- name: Install build dependencies | ||
run: pip install build | ||
- name: Build distribution | ||
run: python -m build ./openg2p-g2p-bridge-example-bank-models | ||
- name: Publish | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
password: ${{ secrets.PYPI_API_TOKEN }} | ||
packages-dir: ./openg2p-g2p-bridge-example-bank-models/dist/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: Example Bank Celery Branch Workflow | ||
|
||
on: | ||
push: | ||
branches-ignore: | ||
- develop | ||
tags-ignore: | ||
- '*' | ||
|
||
jobs: | ||
docker-build-for-branch: | ||
name: Docker Build and Push For Celery Branch | ||
runs-on: ubuntu-latest | ||
env: | ||
NAMESPACE: ${{ secrets.docker_hub_organisation || 'openg2p' }} | ||
SERVICE_NAME: openg2p-g2p-bridge-example-bank-celery | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Docker build | ||
run: | | ||
BRANCH_NAME=$(echo ${{ github.ref }} | sed -e 's,.*/\(.*\),\1,') | ||
IMAGE_ID=$NAMESPACE/$SERVICE_NAME | ||
# Change all uppercase to lowercase | ||
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') | ||
VERSION=$BRANCH_NAME | ||
echo IMAGE_ID=$IMAGE_ID | ||
echo VERSION=$VERSION | ||
echo IMAGE_ID=$IMAGE_ID >> $GITHUB_ENV | ||
echo VERSION=$VERSION >> $GITHUB_ENV | ||
docker build ./openg2p-g2p-bridge-example-bank-celery -f ./openg2p-g2p-bridge-example-bank-celery/Dockerfile-git \ | ||
--tag $IMAGE_ID:$VERSION | ||
if [[ '${{ secrets.docker_hub_token }}' != '' && '${{ secrets.docker_hub_actor }}' != '' ]]; then | ||
export DOCKER_PUSH="true" | ||
echo DOCKER_PUSH=$DOCKER_PUSH >> $GITHUB_ENV | ||
fi | ||
- name: Docker push | ||
if: env.DOCKER_PUSH == 'true' | ||
run: | | ||
echo "${{ secrets.docker_hub_token }}" | docker login -u ${{ secrets.docker_hub_actor }} --password-stdin | ||
docker push ${{ env.IMAGE_ID }}:${{ env.VERSION }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
name: Example Bank Celery Tag Workflow | ||
|
||
on: | ||
push: | ||
tags: | ||
- "*" | ||
branches-ignore: | ||
- '*' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
publish-to-pypi: | ||
name: Publish to PyPI For Celery Tag | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.10" | ||
- uses: actions/checkout@v3 | ||
- name: Install build dependencies | ||
run: pip install build | ||
- name: Build distribution | ||
run: python -m build ./openg2p-g2p-bridge-example-bank-celery | ||
- name: Publish | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
password: ${{ secrets.PYPI_API_TOKEN }} | ||
packages-dir: ./openg2p-g2p-bridge-example-bank-celery/dist/ | ||
|
||
docker-build-for-tag: | ||
name: Docker Build and Push For Celery Tag | ||
needs: publish-to-pypi | ||
runs-on: ubuntu-latest | ||
env: | ||
NAMESPACE: ${{ secrets.docker_hub_organisation || 'openg2p' }} | ||
SERVICE_NAME: openg2p-g2p-bridge-example-bank-celery | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Docker build | ||
run: | | ||
echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | ||
IMAGE_ID=$NAMESPACE/$SERVICE_NAME | ||
# Change all uppercase to lowercase | ||
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') | ||
VERSION=TAG_NAME | ||
echo IMAGE_ID=$IMAGE_ID | ||
echo VERSION=$VERSION | ||
echo IMAGE_ID=$IMAGE_ID >> $GITHUB_ENV | ||
echo VERSION=$VERSION >> $GITHUB_ENV | ||
docker build ./openg2p-g2p-bridge-example-bank-celery -f ./openg2p-g2p-bridge-example-bank-celery/Dockerfile-pypi \ | ||
--tag $IMAGE_ID:$VERSION | ||
if [[ '${{ secrets.docker_hub_token }}' != '' && '${{ secrets.docker_hub_actor }}' != '' ]]; then | ||
export DOCKER_PUSH="true" | ||
echo DOCKER_PUSH=$DOCKER_PUSH >> $GITHUB_ENV | ||
fi | ||
- name: Docker push | ||
if: env.DOCKER_PUSH == 'true' | ||
run: | | ||
echo "${{ secrets.docker_hub_token }}" | docker login -u ${{ secrets.docker_hub_actor }} --password-stdin | ||
docker push ${{ env.IMAGE_ID }}:${{ env.VERSION }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
name: pre-commit | ||
|
||
on: | ||
pull_request: | ||
push: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
pre-commit: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v3 | ||
- uses: pre-commit/action@v3.0.0 | ||
with: | ||
extra_args: --all-files --show-diff-on-failure |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: Tag the repo | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
new-tag: | ||
description: Tag in "vN.N.N" format | ||
required: true | ||
type: string | ||
previous-tag: | ||
description: Previous tag. "None" if no previous tag | ||
required: true | ||
type: string | ||
default: latest | ||
jobs: | ||
tag-repo: | ||
uses: openg2p/openg2p-packaging/.github/workflows/tag.yml@main | ||
with: | ||
new-tag: ${{ inputs.new-tag }} | ||
previous-tag: ${{ inputs.previous-tag }} | ||
secrets: | ||
OPENG2P_BOT_GITHUB_PAT: ${{ secrets.OPENG2P_BOT_GITHUB_PAT }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.