about summary refs log tree commit diff
diff options
context:
space:
mode:
authorCarlos O'Ryan <coryan@users.noreply.github.com>2020-01-15T22·44-0500
committerGitHub <noreply@github.com>2020-01-15T22·44-0500
commit20009f59de903d5a70038adee308020a82e3ecad (patch)
tree864f0ab8dc88b48661be0bf10f281d1621737a19
parent7abccfa1ecc1a0d45673c25e4cfc33ebfb90c74e (diff)
ci: verify pkg-config files actually work (#30)
Change the CI builds to verify the pkg-config files we create actually
work. Some improvements in the `.*ignore` files.
-rw-r--r--.dockerignore22
-rw-r--r--.gitignore3
-rw-r--r--ci/test-install/bigquery/Makefile36
-rw-r--r--ci/test-install/bigtable/Makefile36
-rwxr-xr-xci/test-install/compile-test-projects.sh22
-rw-r--r--ci/test-install/spanner/Makefile36
6 files changed, 145 insertions, 10 deletions
diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 000000000000..4b7b2c0bd276
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,22 @@
+# Common build output directory names
+.build/
+_build/
+build-output/
+cmake-out/
+
+# Common bazel output directories
+bazel-*
+
+# Backup files for Emacs
+*~
+
+# Ignore IDEA / IntelliJ files
+.idea/
+cmake-build-*/
+
+# This is a staging directory used to upload the documents to gihub.io
+github-io-staging/
+
+# Ignore Visual Studio Code files
+.vsbuild/
+.vscode/
diff --git a/.gitignore b/.gitignore
index 765f3e124b02..4b7b2c0bd276 100644
--- a/.gitignore
+++ b/.gitignore
@@ -20,6 +20,3 @@ github-io-staging/
 # Ignore Visual Studio Code files
 .vsbuild/
 .vscode/
-
-google/cloud/storage/testbench/__pycache__/
-google/cloud/storage/testbench/*.pyc
diff --git a/ci/test-install/bigquery/Makefile b/ci/test-install/bigquery/Makefile
new file mode 100644
index 000000000000..bca2a7dc57fc
--- /dev/null
+++ b/ci/test-install/bigquery/Makefile
@@ -0,0 +1,36 @@
+# Copyright 2019 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# A simple Makefile to test the `install` target.
+#
+# This is not intended to be a demonstration of how to write good Makefiles,
+# nor is it a general solution on how to build Makefiles for google-cloud-cpp.
+# It is simply a minimal file to test the installed pkg-config support files.
+
+# The CXX, CXXFLAGS and CXXLD variables are hard-coded. These values work for
+# our tests, but applications would typically make them configurable parameters.
+CXX=g++ -std=c++11
+CXXLD=$(CXX)
+
+all: main
+
+# Configuration variables to compile and link against the library.
+PROTOS     := googleapis_cpp_cloud_bigquery_protos
+CXXFLAGS   := $(shell pkg-config $(PROTOS) --cflags)
+CXXLDFLAGS := $(shell pkg-config $(PROTOS) --libs-only-L)
+LIBS       := $(shell pkg-config $(PROTOS) --libs-only-l)
+
+# A target using the Google Cloud Storage C++ client library.
+main: main.cc
+	$(CXXLD) $(CXXFLAGS) $(CXXFLAGS) $(CXXLDFLAGS) -o $@ $^ $(LIBS)
diff --git a/ci/test-install/bigtable/Makefile b/ci/test-install/bigtable/Makefile
new file mode 100644
index 000000000000..5643b234d7fd
--- /dev/null
+++ b/ci/test-install/bigtable/Makefile
@@ -0,0 +1,36 @@
+# Copyright 2019 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# A simple Makefile to test the `install` target.
+#
+# This is not intended to be a demonstration of how to write good Makefiles,
+# nor is it a general solution on how to build Makefiles for google-cloud-cpp.
+# It is simply a minimal file to test the installed pkg-config support files.
+
+# The CXX, CXXFLAGS and CXXLD variables are hard-coded. These values work for
+# our tests, but applications would typically make them configurable parameters.
+CXX=g++ -std=c++11
+CXXLD=$(CXX)
+
+all: main
+
+# Configuration variables to compile and link against the library.
+PROTOS     := googleapis_cpp_bigtable_protos
+CXXFLAGS   := $(shell pkg-config $(PROTOS) --cflags)
+CXXLDFLAGS := $(shell pkg-config $(PROTOS) --libs-only-L)
+LIBS       := $(shell pkg-config $(PROTOS) --libs-only-l)
+
+# A target using the Google Cloud Storage C++ client library.
+main: main.cc
+	$(CXXLD) $(CXXFLAGS) $(CXXFLAGS) $(CXXLDFLAGS) -o $@ $^ $(LIBS)
diff --git a/ci/test-install/compile-test-projects.sh b/ci/test-install/compile-test-projects.sh
index 47d612833eda..d5398f1e4490 100755
--- a/ci/test-install/compile-test-projects.sh
+++ b/ci/test-install/compile-test-projects.sh
@@ -19,13 +19,7 @@
 
 set -eu
 
-# For BigQuery protos
-cp -R /home/build/cpp-cmakefiles/ci/test-install/bigquery \
-  /home/build/test-install-bigquery
-cd /home/build/test-install-bigquery
-cmake -H. -Bcmake-out
-cmake --build cmake-out -- -j "$(nproc)"
-cmake-out/utilize-googleapis
+# Verify the installed CMake config and pkgconfig files are actually usable.
 
 # For Bigtable protos
 cp -R /home/build/cpp-cmakefiles/ci/test-install/bigtable \
@@ -34,6 +28,18 @@ cd /home/build/test-install-bigtable
 cmake -H. -Bcmake-out
 cmake --build cmake-out -- -j "$(nproc)"
 cmake-out/utilize-googleapis
+env PKG_CONFIG_PATH=/usr/local/lib64/pkgconfig:/usr/local/lib/pkgconfig \
+    make
+
+# For BigQuery protos
+cp -R /home/build/cpp-cmakefiles/ci/test-install/bigquery \
+  /home/build/test-install-bigquery
+cd /home/build/test-install-bigquery
+cmake -H. -Bcmake-out
+cmake --build cmake-out -- -j "$(nproc)"
+cmake-out/utilize-googleapis
+env PKG_CONFIG_PATH=/usr/local/lib64/pkgconfig:/usr/local/lib/pkgconfig \
+    make
 
 # For spanner protos
 cp -R /home/build/cpp-cmakefiles/ci/test-install/spanner \
@@ -42,3 +48,5 @@ cd /home/build/test-install-spanner
 cmake -H. -Bcmake-out
 cmake --build cmake-out -- -j "$(nproc)"
 cmake-out/utilize-googleapis
+env PKG_CONFIG_PATH=/usr/local/lib64/pkgconfig:/usr/local/lib/pkgconfig \
+    make
diff --git a/ci/test-install/spanner/Makefile b/ci/test-install/spanner/Makefile
new file mode 100644
index 000000000000..74bf292ce6ab
--- /dev/null
+++ b/ci/test-install/spanner/Makefile
@@ -0,0 +1,36 @@
+# Copyright 2019 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# A simple Makefile to test the `install` target.
+#
+# This is not intended to be a demonstration of how to write good Makefiles,
+# nor is it a general solution on how to build Makefiles for google-cloud-cpp.
+# It is simply a minimal file to test the installed pkg-config support files.
+
+# The CXX, CXXFLAGS and CXXLD variables are hard-coded. These values work for
+# our tests, but applications would typically make them configurable parameters.
+CXX=g++ -std=c++11
+CXXLD=$(CXX)
+
+all: main
+
+# Configuration variables to compile and link against the library.
+PROTOS     := googleapis_cpp_spanner_protos
+CXXFLAGS   := $(shell pkg-config $(PROTOS) --cflags)
+CXXLDFLAGS := $(shell pkg-config $(PROTOS) --libs-only-L)
+LIBS       := $(shell pkg-config $(PROTOS) --libs-only-l)
+
+# A target using the Google Cloud Storage C++ client library.
+main: main.cc
+	$(CXXLD) $(CXXFLAGS) $(CXXFLAGS) $(CXXLDFLAGS) -o $@ $^ $(LIBS)