Skip to content

Commit a08f467

Browse files
authored
Merge branch 'main' into dependabot/npm_and_yarn/action/actions/core-1.9.1
2 parents 7052907 + 1041a97 commit a08f467

23 files changed

+4830
-5773
lines changed

.github/workflows/build.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Check compiled action script CI
22
on:
33
push:
44
branches:
5-
- master
5+
- main
66
pull_request:
77
jobs:
88
compile:
@@ -12,7 +12,7 @@ jobs:
1212
- name: Setup Node.js
1313
uses: actions/setup-node@v1
1414
with:
15-
node-version: 14.x
15+
node-version: 18.x
1616
- name: Build Action
1717
run: cd action && npm i && npm run all
1818
- name: Check if there's a diff
@@ -26,5 +26,5 @@ jobs:
2626
- name: Lint Code Base
2727
uses: github/super-linter@v4
2828
env:
29-
DEFAULT_BRANCH: master
29+
DEFAULT_BRANCH: main
3030
VALIDATE_JSON: true

.github/workflows/buildpack-integration-test.yml

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,16 @@ on:
2222
description: GCF runtime (e.g. 'go116')
2323
type: string
2424
required: true
25+
builder-runtime-version:
26+
description: GCF runtime version (e.g. 3.7.0 for python37 runtime or 1.16 for go116)
27+
type: string
28+
default: ''
29+
required: false
30+
builder-url:
31+
description: Builder image including builder tag to use while building. (e.g. gcr.io/gae-runtimes/buildpacks/go/builder:latest or gcr.io/buildpacks/builder:latest )
32+
type: string
33+
default: ''
34+
required: false
2535
event-builder-source:
2636
description: Background function source; relative to repo root
2737
type: string
@@ -61,7 +71,7 @@ on:
6171
# breaking changes
6272
description: Conformance GitHub Actions version by git ref
6373
type: string
64-
default: 'master'
74+
default: 'main'
6575
required: false
6676
jobs:
6777
# Download and cache the Functions Framework conformance test client
@@ -151,11 +161,20 @@ jobs:
151161
if: ${{ matrix.builder-source }}
152162
run: |
153163
client \
154-
-type=${{ matrix.type }} \
155-
-builder-source=${{ matrix.builder-source }} \
156-
-builder-target=${{ matrix.builder-target }} \
157-
-builder-runtime=${{ inputs.builder-runtime }} \
158-
-builder-tag=${{ inputs.builder-tag }} \
159-
-start-delay=${{ inputs.start-delay }} \
160-
-output-file=${{ inputs.output-file }} \
161-
-validate-mapping=false
164+
-type=${{ matrix.type }} \
165+
-builder-source=${{ matrix.builder-source }} \
166+
-builder-target=${{ matrix.builder-target }} \
167+
-builder-runtime=${{ inputs.builder-runtime }} \
168+
-builder-runtime-version=${{ inputs.builder-runtime-version }} \
169+
-builder-tag=${{ inputs.builder-tag }} \
170+
-builder-url=${{ inputs.builder-url }} \
171+
-start-delay=${{ inputs.start-delay }} \
172+
-output-file=${{ inputs.output-file }} \
173+
-validate-mapping=false
174+
- name: 'Upload Artifact'
175+
uses: actions/upload-artifact@v3
176+
if: always()
177+
with:
178+
name: ${{ matrix.type }}_buildpack_integ_logs
179+
path: /tmp/ff_*
180+
retention-days: 5
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Buildpack Integration Test Workflow Validation
2+
on:
3+
push:
4+
branches:
5+
- main
6+
pull_request:
7+
jobs:
8+
validate-workflow:
9+
strategy:
10+
matrix:
11+
builder-url: ['gcr.io/gae-runtimes/buildpacks/go/builder:latest', '']
12+
uses: ./.github/workflows/buildpack-integration-test.yml
13+
with:
14+
builder-runtime: 'go113'
15+
builder-runtime-version: '1.13'
16+
http-builder-source: 'testdata'
17+
http-builder-target: 'HTTP'
18+
cloudevent-builder-source: ''
19+
cloudevent-builder-target: ''
20+
builder-url: ${{ matrix.builder-url }}
21+
conformance-client-version: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}

.github/workflows/main.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Conformance test framework validation CI
22
on:
33
push:
44
branches:
5-
- master
5+
- main
66
pull_request:
77
jobs:
88
run-conformance:
@@ -39,4 +39,6 @@ jobs:
3939
-validate-mapping=false \
4040
-builder-source='testdata' \
4141
-builder-target='HTTP' \
42-
-builder-runtime='go113'
42+
-builder-runtime='go113' \
43+
-builder-runtime-version='1.13' \
44+
-builder-url='gcr.io/gae-runtimes/buildpacks/go/builder:latest'

.github/workflows/unit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Unit test CI
22
on:
33
push:
44
branches:
5-
- master
5+
- main
66
pull_request:
77
jobs:
88
test:

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ BUILD
77
action/node_modules
88
action/lib
99

10-
## From https://github.com/github/gitignore/blob/master/Go.gitignore
10+
## From https://github.com/github/gitignore/blob/main/Go.gitignore
1111

1212
# Binaries for programs and plugins
1313
*.exe
@@ -19,7 +19,7 @@ action/lib
1919
# Test binary, built with `go test -c`
2020
*.test
2121

22-
## From https://github.com/github/gitignore/blob/master/Node.gitignore
22+
## From https://github.com/github/gitignore/blob/main/Node.gitignore
2323

2424
# Logs
2525
logs

README.md

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ Frameworks to the Functions Framework contract.
1717
parameters to JSON in the format:
1818
`{"data": ...data..., "context": ...context...}`
1919
and write the resulting string.
20+
- The `typed` function should accept a JSON request object and should echo
21+
the request object back in the "payload" field of the response. I.e. if
22+
the request is `{"a":"b"}` the response should be `{"payload":{"a":
23+
"b"}}`.
2024

2125
1. Build the test client:
2226

@@ -58,6 +62,15 @@ Frameworks to the Functions Framework contract.
5862
-type=legacyevent \
5963
-buildpacks=false
6064
```
65+
- **Ruby __typed http__** function Example:
66+
67+
```sh
68+
$HOME/functions-framework-conformance/client/client \
69+
-cmd="bundle exec functions-framework-ruby --source test/conformance/app.rb --target typed_func --signature-type http" \
70+
--type=http \
71+
--declarative-type=typed \
72+
-buildpacks=false
73+
```
6174

6275
If there are validation errors, an error will be logged in the output, causing your conformance test to fail.
6376

@@ -68,15 +81,19 @@ Frameworks to the Functions Framework contract.
6881
| Configuration flag | Type | Default | Description |
6982
| --- | --- | --- | --- |
7083
| `-cmd` | string | `"''"` | A string with the command to run a Functions Framework server at `localhost:8080`. Must be wrapped in quotes. Ignored if `-buildpacks=true`. |
71-
| `-type` | string | `"http"` | Type of function to validate (must be `"http"`, `"cloudevent"`, or `"legacyevent"`). |
84+
| `-type` | string | `"http"` | The function signature to use (must be `"http"`, `"cloudevent"`, or `"legacyevent"`). |
85+
| `-declarative-type` | string | `""` | The declarative signature type of the function (must be 'http', 'cloudevent', 'legacyevent', or 'typed'), default matches -type |
7286
| `-validate-mapping` | boolean | `true` | Whether to validate mapping from legacy->cloud events and vice versa (as applicable). |
7387
| `-output-file` | string | `"function_output.json"` | Name of file output by function. |
7488
| `-buildpacks` | boolean | `true` | Whether to use the current release of buildpacks to run the validation. If `true`, `-cmd` is ignored and `--builder-*` flags must be set. |
7589
| `-builder-source` | string | `""` | Function source directory to use in building. Required if `-buildpacks=true`. |
7690
| `-builder-target` | string | `""` | Function target to use in building. Required if `-buildpacks=true`. |
7791
| `-builder-runtime` | string | `""` | Runtime to use in building. Required if `-buildpacks=true`. |
78-
| `-builder-tag` | string | `"latest"` | Builder image tag to use in building. |
92+
| `-builder-runtime-version` | string | `""` | Runtime version used while building. Buildpack will use the latest version if flag is not specified. |
93+
| `-builder-tag` | string | `"latest"` | Builder image tag to use in building. Ignored if `-builder-url` is specified. |
94+
| `-builder-url` | string | `""` | Builder image url to use in building including tag. Client defaults to `gcr.io/gae-runtimes/buildpacks/<language>/builder:<builder-tag>` if none is specified. |
7995
| `-start-delay` | uint | `1` | Seconds to wait before sending HTTP request to command process. |
96+
| `-envs` | string | `""` | A comma separated string of additional runtime environment variables. |
8097

8198
</nobr>
8299

action/action.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,11 @@ inputs:
88
description: 'output file from function'
99
default: 'function_output.json'
1010
functionType:
11-
description: 'type of function'
11+
description: 'invocation signature type of function'
1212
default: 'http'
13+
declarativeType:
14+
description: 'declarative type of the function as defined in code i.e. a typed declarative function uses the http invocation type'
15+
default: ''
1316
validateMapping:
1417
description: 'whether to validate mapping from legacy->cloud event and vice versa'
1518
default: true
@@ -25,6 +28,12 @@ inputs:
2528
runtime:
2629
description: 'function runtime (e.g. nodejs10, go113)'
2730
default: ''
31+
runtimeVersion:
32+
description: 'function runtime version, uses the latest version if not specified (e.g. 3.7.4 for python37 runtime)'
33+
default: ''
34+
builderURL:
35+
description: 'builder url to use when building'
36+
default: ''
2837
tag:
2938
description: 'GCR tag to use for builder image'
3039
default: 'latest'
@@ -40,6 +49,9 @@ inputs:
4049
workingDirectory:
4150
description: 'The subdirectory in which the conformance tests should run'
4251
default: ""
52+
runtimeEnvs:
53+
description: 'A comma separated list of runtime environment variable overrides'
54+
default: ""
4355
runs:
4456
using: 'node12'
4557
main: 'dist/index.js'

0 commit comments

Comments
 (0)