Skip to content

Commit

Permalink
Initial code for merge CSV cloud function. Also, refactor github work…
Browse files Browse the repository at this point in the history
…flows.
  • Loading branch information
sylmak committed Jun 11, 2024
1 parent c9dd0c6 commit 202509c
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: Python application
name: climateiq_data_export_cf

on:
push:
branches: [ "main" ]
paths:
- "cloud_functions/climateiq_data_export_cf/**"
pull_request:
branches: [ "main" ]

Expand Down
43 changes: 43 additions & 0 deletions .github/workflows/climateiq_merge_output_cf.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: climateiq_merge_output_cf

on:
push:
branches: [ "main" ]
paths:
- "cloud_functions/climateiq_merge_output_cf/**"
pull_request:
branches: [ "main" ]

permissions:
contents: read

jobs:
climateiq_merge_output_cf:
name: climateiq_merge_output_cf CI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.11
uses: actions/setup-python@v3
with:
python-version: "3.11"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
cd cloud_functions/climateiq_merge_output_cf
pip install -r requirements.txt
- name: Lint with flake8
run: |
flake8 cloud_functions/climateiq_merge_output_cf --show-source --statistics
- name: Ensure black auto-formatter has run
run: |
black cloud_functions/climateiq_merge_output_cf --check
- name: MyPy Type Checking
run: |
mypy cloud_functions/climateiq_merge_output_cf
- name: Test with pytest
run: |
pytest cloud_functions/climateiq_merge_output_cf
7 changes: 7 additions & 0 deletions cloud_functions/climateiq_merge_output_cf/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from cloudevents import http
import functions_framework


@functions_framework.cloud_event
def merge_predictions(cloud_event: http.CloudEvent) -> None:
return
10 changes: 10 additions & 0 deletions cloud_functions/climateiq_merge_output_cf/main_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from cloudevents import http

import main


def test_merge_predictions() -> None:
cloud_event = http.CloudEvent(
{"type": "google.cloud.storage.object.v1.finalized", "source": "source"}, {}
)
assert main.merge_predictions(cloud_event) is None
26 changes: 26 additions & 0 deletions cloud_functions/climateiq_merge_output_cf/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
black==24.4.2
blinker==1.8.2
click==8.1.7
cloudevents==1.10.1
deprecation==2.1.0
flake8==7.0.0
Flask==3.0.3
functions-framework==3.7.0
gunicorn==22.0.0
iniconfig==2.0.0
itsdangerous==2.2.0
Jinja2==3.1.4
MarkupSafe==2.1.5
mccabe==0.7.0
mypy==1.10.0
mypy-extensions==1.0.0
packaging==24.1
pathspec==0.12.1
platformdirs==4.2.2
pluggy==1.5.0
pycodestyle==2.11.1
pyflakes==3.2.0
pytest==8.2.2
typing_extensions==4.12.2
watchdog==4.0.1
Werkzeug==3.0.3

0 comments on commit 202509c

Please sign in to comment.