Skip to content

Commit 4726b57

Browse files
authored
chore: Add buildpack-integration-test for ff java (#140)
* adding buildpack integration for java * add comments * addressing comments * accessing tmpdir * using/tmp * fixing minor errors * fixing comments
1 parent 7afcfbb commit 4726b57

File tree

3 files changed

+121
-0
lines changed

3 files changed

+121
-0
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Validates Functions Framework with GCF buildpacks.
2+
name: Buildpack Integration Test
3+
on:
4+
push:
5+
branches:
6+
- master
7+
workflow_dispatch:
8+
jobs:
9+
java11-buildpack-test:
10+
uses: GoogleCloudPlatform/functions-framework-conformance/.github/workflows/[email protected]
11+
with:
12+
http-builder-source: '/tmp/tests/conformance'
13+
http-builder-target: 'com.google.cloud.functions.conformance.HttpConformanceFunction'
14+
cloudevent-builder-source: '/tmp/tests/conformance'
15+
cloudevent-builder-target: 'com.google.cloud.functions.conformance.CloudEventsConformanceFunction'
16+
prerun: 'invoker/conformance/prerun.sh'
17+
builder-runtime: 'java11'
18+
# Latest uploaded tag from us.gcr.io/fn-img/us/buildpacks/java11/builder
19+
builder-tag: 'java11_20220620_11_0_RC00'
20+
java17-buildpack-test:
21+
uses: GoogleCloudPlatform/functions-framework-conformance/.github/workflows/[email protected]
22+
with:
23+
http-builder-source: '/tmp/tests/conformance'
24+
http-builder-target: 'com.google.cloud.functions.conformance.HttpConformanceFunction'
25+
cloudevent-builder-source: '/tmp/tests/conformance'
26+
cloudevent-builder-target: 'com.google.cloud.functions.conformance.CloudEventsConformanceFunction'
27+
prerun: 'invoker/conformance/prerun.sh'
28+
builder-runtime: 'java17'
29+
# Latest uploaded tag from us.gcr.io/fn-img/us/buildpacks/java17/builder
30+
builder-tag: 'java17_20220617_17_0_RC00'
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
<groupId>com.google.cloud.functions.invoker</groupId>
5+
<artifactId>conformance</artifactId>
6+
<version>0.0.0-SNAPSHOT</version>
7+
8+
<name>GCF Conformance Tests</name>
9+
<description>
10+
A GCF project used to validate conformance to the Functions Framework contract
11+
using the Functions Framework Conformance tools.
12+
</description>
13+
<url>https://github.com/GoogleCloudPlatform/functions-framework-conformance</url>
14+
15+
<properties>
16+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
17+
<maven.compiler.source>11</maven.compiler.source>
18+
<maven.compiler.target>11</maven.compiler.target>
19+
</properties>
20+
<repositories>
21+
<repository>
22+
<id>conformance</id>
23+
<url>file:./artifacts</url></repository>
24+
</repositories>
25+
<dependencies>
26+
<dependency>
27+
<groupId>com.google.cloud.functions</groupId>
28+
<artifactId>functions-framework-api</artifactId>
29+
<version>0.0.0-SNAPSHOT</version>
30+
</dependency>
31+
<dependency>
32+
<groupId>com.google.cloud.functions.invoker</groupId>
33+
<artifactId>java-function-invoker</artifactId>
34+
<version>0.0.0-SNAPSHOT</version>
35+
</dependency>
36+
<dependency>
37+
<groupId>com.google.code.gson</groupId>
38+
<artifactId>gson</artifactId>
39+
<version>2.8.9</version>
40+
</dependency>
41+
<dependency>
42+
<groupId>io.cloudevents</groupId>
43+
<artifactId>cloudevents-core</artifactId>
44+
<version>2.2.0</version>
45+
</dependency>
46+
<dependency>
47+
<groupId>io.cloudevents</groupId>
48+
<artifactId>cloudevents-json-jackson</artifactId>
49+
<version>2.2.0</version>
50+
</dependency>
51+
</dependencies>
52+
</project>

invoker/conformance/prerun.sh

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/bin/bash
2+
3+
# This script is used for buildpack validation.
4+
# Its purpose is to run conformance tests using a buildpack
5+
# with the latest code of functions-framework.
6+
#
7+
# Note: buildpack_pom.xml contains the configuration to use the local versions
8+
# java-function-invoker and functions-framework-api. We will be using this file
9+
# for running our conformance tests with buildpack.
10+
#
11+
# Steps:
12+
#
13+
# - Clear out the temp directory
14+
# - Copy the conformance tests folder into temp
15+
# - Build java-function-invoker with version 0.0.0-SNAPSHOT into artifacts
16+
# folder
17+
# - Build functions-framework-api with version 0.0.0-SNAPSHOT into artifacts
18+
# folder
19+
# - Ensure that we use the buildpack_pom.xml file by renaming it to pom.xml
20+
21+
22+
set -e
23+
REPO_ROOT=$(git rev-parse --show-toplevel)
24+
25+
rm -rf /tmp/tests
26+
mkdir /tmp/tests
27+
28+
cp -r $REPO_ROOT/invoker/conformance /tmp/tests
29+
30+
cd $REPO_ROOT/invoker
31+
mvn versions:set -DnewVersion=0.0.0-SNAPSHOT -DprocessAllModules=true
32+
mvn install -Dmaven.repo.local=/tmp/tests/conformance/artifacts
33+
34+
cd $REPO_ROOT/functions-framework-api
35+
mvn versions:set -DnewVersion=0.0.0-SNAPSHOT -DprocessAllModules=true
36+
mvn install -Dmaven.repo.local=/tmp/tests/conformance/artifacts
37+
38+
rm /tmp/tests/conformance/pom.xml
39+
mv /tmp/tests/conformance/buildpack_pom.xml /tmp/tests/conformance/pom.xml

0 commit comments

Comments
 (0)