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
32 changes: 15 additions & 17 deletions .github/workflows/conformance.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
name: Python Conformance CI
on: [push, pull_request]
on:
push:
branches:
- 'master'
pull_request:

# Declare default permissions as read only.
permissions: read-all
Expand Down Expand Up @@ -39,67 +43,61 @@ jobs:
- name: Setup Go
uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
with:
go-version: '1.16'
go-version: '1.20'

- name: Run HTTP conformance tests
uses: GoogleCloudPlatform/functions-framework-conformance/action@1975792fb34ebbfa058d690666186d669d3a5977 # v1.8.0
uses: GoogleCloudPlatform/functions-framework-conformance/action@5f2a796b58f099d749e70ecc83f531f6701c64af # v1.8.3
with:
version: 'v1.6.0'
functionType: 'http'
useBuildpacks: false
validateMapping: false
cmd: "'functions-framework --source tests/conformance/main.py --target write_http --signature-type http'"

- name: Run event conformance tests
uses: GoogleCloudPlatform/functions-framework-conformance/action@1975792fb34ebbfa058d690666186d669d3a5977 # v1.8.0
uses: GoogleCloudPlatform/functions-framework-conformance/action@5f2a796b58f099d749e70ecc83f531f6701c64af # v1.8.3
with:
version: 'v1.6.0'
functionType: 'legacyevent'
useBuildpacks: false
validateMapping: true
cmd: "'functions-framework --source tests/conformance/main.py --target write_legacy_event --signature-type event'"

- name: Run CloudEvents conformance tests
uses: GoogleCloudPlatform/functions-framework-conformance/action@1975792fb34ebbfa058d690666186d669d3a5977 # v1.8.0
uses: GoogleCloudPlatform/functions-framework-conformance/action@5f2a796b58f099d749e70ecc83f531f6701c64af # v1.8.3
with:
version: 'v1.6.0'
functionType: 'cloudevent'
useBuildpacks: false
validateMapping: true
cmd: "'functions-framework --source tests/conformance/main.py --target write_cloud_event --signature-type cloudevent'"

- name: Run HTTP conformance tests declarative
uses: GoogleCloudPlatform/functions-framework-conformance/action@1975792fb34ebbfa058d690666186d669d3a5977 # v1.8.0
uses: GoogleCloudPlatform/functions-framework-conformance/action@5f2a796b58f099d749e70ecc83f531f6701c64af # v1.8.3
with:
version: 'v1.6.0'
functionType: 'http'
useBuildpacks: false
validateMapping: false
cmd: "'functions-framework --source tests/conformance/main.py --target write_http_declarative'"

- name: Run CloudEvents conformance tests declarative
uses: GoogleCloudPlatform/functions-framework-conformance/action@1975792fb34ebbfa058d690666186d669d3a5977 # v1.8.0
uses: GoogleCloudPlatform/functions-framework-conformance/action@5f2a796b58f099d749e70ecc83f531f6701c64af # v1.8.3
with:
version: 'v1.6.0'
functionType: 'cloudevent'
useBuildpacks: false
validateMapping: true
cmd: "'functions-framework --source tests/conformance/main.py --target write_cloud_event_declarative'"

- name: Run HTTP concurrency tests declarative
uses: GoogleCloudPlatform/functions-framework-conformance/action@1975792fb34ebbfa058d690666186d669d3a5977 # v1.8.0
uses: GoogleCloudPlatform/functions-framework-conformance/action@5f2a796b58f099d749e70ecc83f531f6701c64af # v1.8.3
with:
version: 'v1.6.0'
functionType: 'http'
useBuildpacks: false
validateConcurrency: true
cmd: "'functions-framework --source tests/conformance/main.py --target write_http_declarative_concurrent'"

- name: Run Typed tests declarative
uses: GoogleCloudPlatform/functions-framework-conformance/action@1975792fb34ebbfa058d690666186d669d3a5977 # v1.8.0
uses: GoogleCloudPlatform/functions-framework-conformance/action@5f2a796b58f099d749e70ecc83f531f6701c64af # v1.8.3
with:
version: 'v1.6.0'
functionType: 'http'
declarativeType: 'typed'
useBuildpacks: false
validateMapping: false
cmd: "'functions-framework --source tests/conformance/main.py --target write_typed_event_declarative'"
cmd: "'functions-framework --source tests/conformance/main.py --target typed_conformance_test'"
22 changes: 12 additions & 10 deletions tests/conformance/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,18 @@
filename = "function_output.json"


class ConformanceType:
json_request: str
class RawJson:
data: dict

def __init__(self, json_request: str) -> None:
self.json_request = json_request
def __init__(self, data):
self.data = data

@staticmethod
def from_dict(obj: dict) -> "ConformanceType":
return ConformanceType(json.dumps(obj))
def from_dict(obj: dict) -> "RawJson":
return RawJson(obj)

def to_dict(self) -> dict:
return self.data


def _write_output(content):
Expand Down Expand Up @@ -66,7 +69,6 @@ def write_http_declarative_concurrent(request):
return "OK", 200


@functions_framework.typed(ConformanceType)
def write_typed_event_declarative(x):
_write_output(x.json_request)
return "OK"
@functions_framework.typed(RawJson)
def typed_conformance_test(x):
return RawJson({"payload": x.data})