-
Notifications
You must be signed in to change notification settings - Fork 3
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 #2 from u-ways/2.32.3.0
2.32.3.0
- Loading branch information
Showing
32 changed files
with
2,422 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,12 @@ | ||
### Summary | ||
|
||
<!-- Please provide a brief summary of changes made (optional for small changes) --> | ||
|
||
#### Definition of Done Checklist: | ||
|
||
- [ ] Unit tests are added for new features. (newer projects) | ||
- [ ] Linting and formatting checks have passed. | ||
- [ ] CI/CD pipeline has been successfully executed. | ||
- [ ] If an interface has changed, documentation should be updated. | ||
|
||
___ |
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: CICD | ||
|
||
on: | ||
pull_request: | ||
types: [ opened, synchronize, edited ] | ||
paths-ignore: | ||
- '**.md' | ||
|
||
jobs: | ||
CI: | ||
uses: ./.github/workflows/ci-workflow.yml | ||
secrets: inherit | ||
CD: | ||
needs: [CI] | ||
uses: ./.github/workflows/cd-workflow.yml | ||
secrets: inherit |
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,56 @@ | ||
name: CD | ||
|
||
on: [ | ||
workflow_call, | ||
workflow_dispatch | ||
] | ||
|
||
env: | ||
APP_VERSION: latest | ||
APP_NAME: ${{ github.event.repository.name }} | ||
APP_OWNER: ${{ github.repository_owner }} | ||
|
||
jobs: | ||
Export-Package: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: 'Checkout to current branch' | ||
uses: actions/checkout@v3 | ||
- name: 'Build library package' | ||
run: echo "TODO..." | ||
- name: 'Uploading library artifacts' | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: library-artifacts | ||
path: ./build/library | ||
|
||
Publish-Package: | ||
needs: Export-Package | ||
if: github.ref == 'refs/heads/main' | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: 'Downloading library artifacts' | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: library-artifacts | ||
- name: 'Log in to Python Package Index (PyPI)' | ||
run: echo "TODO..." | ||
- name: 'Pushing library package to Python Package Index (PyPI)' | ||
run: | | ||
echo "TODO..." | ||
Update-Documentation: | ||
needs: Publish-Package | ||
if: github.ref == 'refs/heads/main' | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: 'Updating release version in README.md' | ||
run: echo "TODO..." | ||
|
||
Create-Release: | ||
needs: Update-Documentation | ||
if: github.ref == 'refs/heads/main' | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: 'Creating release' | ||
run: echo "TODO..." |
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,31 @@ | ||
name: CI | ||
|
||
on: [ | ||
workflow_call, | ||
workflow_dispatch | ||
] | ||
|
||
jobs: | ||
Check-Format: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: 'Checkout to current branch' | ||
uses: actions/checkout@v3 | ||
- name: 'Run format check' | ||
run: make check-format-docker | ||
|
||
Check-Linter: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: 'Checkout to current branch' | ||
uses: actions/checkout@v3 | ||
- name: 'Run lint check' | ||
run: make check-lint-docker | ||
|
||
Check-Tests: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: 'Checkout to current branch' | ||
uses: actions/checkout@v3 | ||
- name: 'Run acceptance tests' | ||
run: make check-test-docker |
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
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,28 @@ | ||
#!/bin/sh | ||
|
||
# This script is a pre-commit hook that runs the code quality checks before | ||
# allowing a commit to be made. If any of the checks fail, the commit is | ||
# aborted and the user is informed of the error. | ||
|
||
# TIP: you can enable this hook by running the following command: | ||
# make enable-pre-commit-hook | ||
|
||
if ! make check-format; then | ||
echo "|" | ||
echo "|" | ||
echo "Code quality pre-commit hook error:" | ||
echo "Black formatting failed! Please fix the errors before committing." | ||
echo "TIP: you can run \"make format-code\" to try resolving the error automatically." | ||
exit 1 | ||
fi | ||
|
||
if ! make check-lint; then | ||
echo "|" | ||
echo "|" | ||
echo "Code quality pre-commit hook error:" | ||
echo "Flake8 linting failed! Please fix the errors before committing." | ||
echo "TIP: you can run \"make lint-code\" to try resolving the error automatically." | ||
exit 1 | ||
fi | ||
|
||
exit 0 |
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,18 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<module type="PYTHON_MODULE" version="4"> | ||
<component name="NewModuleRootManager"> | ||
<content url="file://$MODULE_DIR$"> | ||
<sourceFolder url="file://$MODULE_DIR$/logging_http_client" isTestSource="false" /> | ||
<sourceFolder url="file://$MODULE_DIR$/tests" isTestSource="true" /> | ||
</content> | ||
<orderEntry type="inheritedJdk" /> | ||
<orderEntry type="sourceFolder" forTests="false" /> | ||
</component> | ||
<component name="PyDocumentationSettings"> | ||
<option name="format" value="PLAIN" /> | ||
<option name="myDocStringFormat" value="Plain" /> | ||
</component> | ||
<component name="TestRunnerService"> | ||
<option name="PROJECT_TEST_RUNNER" value="py.test" /> | ||
</component> | ||
</module> |
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,11 @@ | ||
{ | ||
"python.analysis.extraPaths": [ | ||
"./logging_http_client", | ||
"./tests" | ||
], | ||
"python.testing.pytestArgs": [ | ||
"tests" | ||
], | ||
"python.testing.unittestEnabled": false, | ||
"python.testing.pytestEnabled": true | ||
} |
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 @@ | ||
3.12 |
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,90 @@ | ||
# An optimised multistaged Dockerfile for Poetry. | ||
# Based of https://github.com/python-poetry/poetry/discussions/1879?sort=top#discussioncomment-216865 | ||
|
||
################################ | ||
# PYTHON-BASE | ||
# Sets up all our shared environment variables | ||
################################ | ||
FROM python:3.12-slim as python-base | ||
LABEL python-base=true | ||
|
||
ENV PYTHONUNBUFFERED=1 \ | ||
# prevents python creating .pyc files | ||
PYTHONDONTWRITEBYTECODE=1 \ | ||
\ | ||
# pip | ||
PIP_DISABLE_PIP_VERSION_CHECK=on \ | ||
PIP_DEFAULT_TIMEOUT=100 \ | ||
\ | ||
# poetry | ||
# see: https://python-poetry.org/docs/configuration/#using-environment-variables | ||
POETRY_VERSION=1.8.3 \ | ||
POETRY_HOME="/opt/poetry" \ | ||
POETRY_VIRTUALENVS_IN_PROJECT=true \ | ||
POETRY_NO_INTERACTION=1 \ | ||
# paths this is where our requirements + virtual environment will live | ||
PYSETUP_PATH="/opt/pysetup" \ | ||
# where the virtual environment will be created | ||
VENV_PATH="/opt/pysetup/.venv" | ||
|
||
# prepend poetry and venv to path | ||
ENV PATH="$POETRY_HOME/bin:$VENV_PATH/bin:$PATH" | ||
|
||
################################ | ||
# BUILDER-BASE | ||
# Used to build deps + create our virtual environment | ||
################################ | ||
FROM python-base as builder-base | ||
LABEL builder-base=true | ||
|
||
RUN apt-get update \ | ||
&& apt-get install --no-install-recommends -y \ | ||
# deps for installing poetry | ||
curl \ | ||
# deps for building python deps | ||
build-essential | ||
|
||
# Installs poetry - respects $POETRY_VERSION & $POETRY_HOME | ||
# The --mount will mount the buildx cache directory to where | ||
# Poetry and Pip store their cache so that they can re-use it | ||
RUN --mount=type=cache,target=/root/.cache \ | ||
curl -sSL https://install.python-poetry.org | python3 - | ||
|
||
# Switch to the directory with our poetry files | ||
WORKDIR $PYSETUP_PATH | ||
|
||
# Copy project requirement files here to ensure they will be cached. | ||
COPY poetry.lock pyproject.toml ./ | ||
|
||
# Install runtime deps - uses $POETRY_VIRTUALENVS_IN_PROJECT internally | ||
RUN --mount=type=cache,target=/root/.cache \ | ||
poetry install --without dev,test --no-root | ||
|
||
|
||
################################ | ||
# DEVELOPMENT | ||
# Image used during development / testing | ||
################################ | ||
FROM python-base as development | ||
LABEL development=true | ||
|
||
ENV FASTAPI_ENV=development | ||
ENV PYTHONPATH="/app/src:$PYTHONPATH" | ||
|
||
# Switch to the directory with our poetry files | ||
WORKDIR $PYSETUP_PATH | ||
|
||
# It's important to note that the development stage does not | ||
# include the project source code. (i.e. you're responsible | ||
# for volume mounting the code when you run the container as | ||
# development source shouldn't be part of the image) | ||
|
||
# Copy in our built poetry + venv | ||
COPY --from=builder-base $POETRY_HOME $POETRY_HOME | ||
COPY --from=builder-base $PYSETUP_PATH $PYSETUP_PATH | ||
|
||
# Quicker install as runtime deps are already installed | ||
RUN --mount=type=cache,target=/root/.cache \ | ||
poetry install --with dev,test | ||
|
||
WORKDIR /app |
Oops, something went wrong.