Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.sh text=auto eol=lf
49 changes: 49 additions & 0 deletions .github/workflows/ci-grants-shared-backend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Grants Shared Backend Checks

on:
workflow_call:
inputs:
skip_checks:
type: boolean
default: false
description: Skip the guts of this workflow, but we have to run the workflow for dependency reasons when calling from CD workflows
pull_request:
paths:
- backend/grants_shared/**
- .github/workflows/ci-grants-shared-backend.yml

defaults:
run:
working-directory: ./backend/grants_shared

jobs:
lint-test:
if: ${{ inputs.skip_checks == null || inputs.skip_checks == false }}
name: Grants Shared Lint, Format & Tests
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4

- name: Initialize the docker containers
run: make init

- name: Run format check
run: make format-check

- name: Run linting
run: make lint

- name: Run security linting
run: make lint-security

- name: Start tests
run: make test-coverage

skip-checks:
if: ${{ inputs.skip_checks != null && inputs.skip_checks == true }}
name: Skip Checks
runs-on: ubuntu-22.04
steps:
- name: Checks skipped
working-directory: ./
run: exit 0
102 changes: 102 additions & 0 deletions .github/workflows/publish-grants-shared-backend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
name: Publish Grants Shared Backend Package to PyPi
on:
workflow_dispatch:

defaults:
run:
working-directory: ./backend/grants_shared

jobs:
build-grants-shared:
name: Build grants_shared for PyPi
runs-on: ubuntu-22.04
env:
PY_RUN_APPROACH: "local"
DB_HOST: "localhost"
DB_PORT: 5489
steps:
- name: Checkout
uses: actions/checkout@v6

- name: Install uv
uses: astral-sh/setup-uv@v6

- name: Install Python 3.14
run: uv python install 3.14

- name: Init
run: make setup-local

- name: Init DB
run: make init-db

- name: Run format check
run: make format-check

- name: Run linting
run: make lint

- name: Run security linting
run: make lint-security

- name: Start tests
run: make test-coverage

- name: Build
run: uv build

- name: Get Project Version
id: get-version
run: |
PROJECT_VERSION=$(grep '^version' pyproject.toml | head -1 | sed 's/.*= *"\(.*\)"/\1/')
echo "grants_shared project version is currently: ${PROJECT_VERSION}"
echo "project_version=$PROJECT_VERSION" >> "$GITHUB_OUTPUT"

# Verify we built the package in the right shape to use as a module
- name: Smoke Test (wheel)
run: |
uv run --isolated --with dist/grants_shared-${{steps.get-version.outputs.project_version}}-py3-none-any.whl tests/grants_shared/smoke_test.py

- name: Smoke Test (source distribution)
run: |
uv run --isolated --with dist/grants_shared-${{steps.get-version.outputs.project_version}}.tar.gz tests/grants_shared/smoke_test.py

# Upload the dist so the PyPi integration is isolated from the build.
- name: Upload dist
uses: actions/upload-artifact@v7
with:
name: grants-shared-dist
path: /home/runner/work/grants-shared/grants-shared/backend/grants_shared/dist
if-no-files-found: error
retention-days: 1
overwrite: true

publish-grants-shared:
# Separate dedicated job as we have to grant this one additional write
# privileges against our repo for the id-token, want to isolate that.
# This uses trusted publishing which relies on an OIDC connection
# between Github and PyPi. The PyPi package is configured to only
# allow publishing in this way from exactly this workflow.
#
# https://docs.astral.sh/uv/guides/integration/github/#publishing-to-pypi
# https://docs.pypi.org/trusted-publishers/
name: Publish grants_shared to PyPi
runs-on: ubuntu-22.04
needs:
- build-grants-shared
# The PyPi configuration setup will only allow this environment
# to publish to PyPi, any others, including the default will be blocked.
environment: pypi-publish
permissions:
id-token: write

steps:
- name: Retrieve dist
uses: actions/download-artifact@v7
with:
name: grants-shared-dist
path: dist/

# https://github.com/pypa/gh-action-pypi-publish
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
161 changes: 161 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
# Files ignored because they're binary/unnecessary
.DS_STORE
.idea

# Files generated by local Mermaid development
documentation/milestones/milestone_dependency_diagram.pdf
documentation/deliverables/deliverable_dependency_diagram.pdf

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
!api/tests/lib
!backend/grants_management_api/tests/lib
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.envrc
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# asdf
.tool-versions

# vscode
.vscode/settings.json

# vim
*.swp

# Terraform plan outputs
*.tfplan

# Python testing stuff
*__pycache__*

# Artilery
frontend/tests/artillery/params.json

# XML validation results
api/src/services/xml_generation/xsds/validation_results.json
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ An up-to-date list of core team members can be found in [MAINTAINERS.md](./MAINT
## Repository Structure

- [./.github](./.github) contains Github specific settings files and testing, linting, and CI/CD workflows
- [./api](./api) contains an API built in Python using the Flask library
- [./backend](./backend) contains backend Python code
- [./documentation](./documentation) contains project guides, documentation, and decision records
- [./frontend](./frontend) contains a web application built using Next.js

## Development

### API
### Backend (Grants Shared)

Documentation for the API is linked to from the [API README.md](./api/README.md).
Documentation for the backend grants shared library is provided in [grants_shared README.md](./backend/grants_shared/README.md).

### Front-end

Expand Down
1 change: 0 additions & 1 deletion api/README.md

This file was deleted.

34 changes: 34 additions & 0 deletions backend/grants_shared/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Python compiled/optimized files
__pycache__/
*.py[cod]
*$py.class

# Python packaging stuff
dist/
*.egg-info

# Python testing stuff
.coverage*
coverage.*
.testmondata
.pytest_cache/

# Python virtual environments
.venv

# Environment variables
.env
.envrc
override.env

# mypy
.mypy_cache

# VSCode Workspace
*.code-workspace
.vscode

# All pem/pub/secret keys
*.key
*.pub
*.pem
Loading
Loading