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.
This commit is contained in:
Carlos O'Ryan 2020-01-15 17:44:36 -05:00 committed by GitHub
parent 7abccfa1ec
commit 20009f59de
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 145 additions and 10 deletions

22
.dockerignore Normal file
View file

@ -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/

3
.gitignore vendored
View file

@ -20,6 +20,3 @@ github-io-staging/
# Ignore Visual Studio Code files
.vsbuild/
.vscode/
google/cloud/storage/testbench/__pycache__/
google/cloud/storage/testbench/*.pyc

View file

@ -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)

View file

@ -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)

View file

@ -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

View file

@ -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)