This repository has been archived by the owner on Jun 28, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 129
/
config.yml
818 lines (797 loc) · 27.7 KB
/
config.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
version: 2.0
# Tip: You can run `circleci config validate -c .circleci/config.yml`
# to validate this yaml after making changes to it.
# That requires a circleCI local installation:
# `curl -o /usr/local/bin/circleci \
# https://circle-downloads.s3.amazonaws.com/releases/build_agent_wrapper/circleci \
# && chmod +x /usr/local/bin/circleci`
# ======================= ANCHORS =======================
anchor_artman_vars: &anchor_artman_vars
ARTMAN_REPORTS_DIR: /tmp/workspace/reports/generations
anchor_auth_vars: &anchor_auth_vars
GCLOUD_PROJECT: gapic-test
GOOGLE_APPLICATION_CREDENTIALS: /tmp/workspace/gapic-generator/.circleci/gapic-generator-it-test.json
anchor_run_decrypt: &anchor_run_decrypt
name: Decrypt credentials (if encryption key is given)
command: |
if ! [ -z "$SYSTEM_TESTS_ENCRYPTION_KEY" ]
then
openssl aes-256-cbc -md sha256 -d \
-in /tmp/workspace/gapic-generator/.circleci/gapic-generator-it-test.json.enc \
-out /tmp/workspace/gapic-generator/.circleci/gapic-generator-it-test.json \
-k "${SYSTEM_TESTS_ENCRYPTION_KEY}"
fi
anchor_check_generation: &anchor_check_generation
name: Check client generation
command: |
# Generation for a language failed if there exists a [language].log
# which was outputted by generate_clients.py upon failure.
# LANGUAGE must be set in BASH_ENV in a prior command.
if [ -e ${ARTMAN_REPORTS_DIR}/${LANGUAGE}.log ]
then
echo "Not all client generations for ${LANGUAGE} succeeded."
echo "See artman generation log at /tmp/workspace/reports/generations/smoketest.log."
exit 1
else
echo "All client generations for ${LANGUAGE} succeeded."
exit 0
fi
anchor_test_python_client: &anchor_test_python_client
command: |
if [ -z "$NOX_COMMANDS" ]
then
echo "NOX_COMMANDS was not configured. Check CircleCI config."
exit 1
fi
if [ -e ${PYTHON_GEN_DIR}/${TEST_API} ]
then
cd ${PYTHON_GEN_DIR}/${TEST_API}
echo "Running test commands: $NOX_COMMANDS"
eval "$NOX_COMMANDS"
else
echo "Python ${TEST_API} library was not generated."
exit 1
fi
when: always
anchor_verify_and_test_python: &anchor_verify_and_test_python
working_directory: /tmp/
docker:
- image: l.gcr.io/google/python:latest
- image: gcr.io/gapic-images/gapic-showcase:0.4.0
steps:
- attach_workspace:
at: workspace
- run:
<<: *anchor_run_decrypt
- run:
<<: *anchor_check_generation
- run:
name: Install nox==0.17.0
command: |
pip3 install nox-automation==0.17.0 # TODO showcase still has old nox format
# Generated Logging client is broken: https://github.com/googleapis/gapic-generator/issues/2209.
- run:
name: Run Showcase Generated Unit Tests.
command: |
nox --session "unit(py='3.6')" \
--noxfile /tmp/workspace/gapic-generator/showcase/python/nox.py
when: always
- run:
name: Run Showcase Integration Tests.
command: |
nox --session "showcase(py='3.6')" \
--noxfile /tmp/workspace/gapic-generator/showcase/python/nox.py
when: always
- run:
name: Install nox latest
command: |
pip3 install nox
- run:
name: Prepare for Pubsub testing.
command: echo 'export TEST_API="pubsub-v1"' >> $BASH_ENV
- run:
name: Test Pubsub.
<<: *anchor_test_python_client
- run:
name: Prepare for Speech testing.
command: echo 'export TEST_API="speech-v1"' >> $BASH_ENV
- run:
name: Test Speech.
<<: *anchor_test_python_client
# Test a Ruby client if generation succeeded.
anchor_test_ruby_client: &anchor_test_ruby_client
command: |
if [ -e ${RUBY_GEN_DIR}/google-cloud-${TEST_API} ]
then
echo "Testing ${TEST_API} in the ${LANGUAGE} language"
cd ${RUBY_GEN_DIR}/google-cloud-${TEST_API}
bundle update
bundle exec rake test
else
echo "Ruby ${TEST_API} library was not generated for ${LANGUAGE} at ${RUBY_GEN_DIR}."
ls -la ${RUBY_GEN_DIR}
exit 1
fi
when: always
anchor_run_ruby: &anchor_run_ruby
working_directory: /tmp/
docker:
- image: circleci/ruby:2.5-node
- image: gcr.io/gapic-images/gapic-showcase:0.2.0
environment:
LANGUAGE: ruby
RUBY_GEN_DIR: /tmp/workspace/gapic-generator/artman-genfiles/ruby/google-cloud-ruby/
<<: *anchor_artman_vars
steps:
- attach_workspace:
# Use the workspace created in generate-clients
at: workspace
- run:
name: Prepare environment # The environment set for this job does not seem to propagate
command: |
echo 'export RUBY_GEN_DIR="/tmp/workspace/gapic-generator/artman-genfiles/ruby/google-cloud-ruby/"' >> $BASH_ENV
- run:
<<: *anchor_run_decrypt
- run:
<<: *anchor_check_generation
- run:
name: Prepare for Pubsub testing.
command: |
echo 'export TEST_API="pubsub"' >> $BASH_ENV
# https://github.com/googleapis/gapic-generator/issues/2503 blocks Pubsub testing.
- run:
name: Prepare for Speech testing.
command: |
echo 'export TEST_API="speech"' >> $BASH_ENV
- run:
name: Test Speech.
<<: *anchor_test_ruby_client
- run:
name: Prepare for Logging testing.
command: |
echo 'export TEST_API="logging"' >> $BASH_ENV
- run:
name: Test Logging.
<<: *anchor_test_ruby_client
- run:
name: Prepare to test Showcase.
command: echo 'export TEST_API="showcase"' >> $BASH_ENV
- run:
name: Test Showcase Generated Unit Tests.
<<: *anchor_test_ruby_client
- run:
name: Setup Showcase Integration Tests
# Git needs to be initialized since the gemspec tracks the packaged files using git.
command: |
cd workspace/gapic-generator/artman-genfiles/ruby/google-cloud-ruby/google-cloud-showcase
git config --global user.email "googleapis@google.com"
git config --global user.name "googleapis"
git init
git add .
git commit -m "init"
gem build google-showcase.gemspec
gem install google-showcase-0.1.0.gem
- run:
name: Run Showcase Integration Tests
command: |
cd workspace/gapic-generator/showcase/ruby
bundle update
bundle
bundle exec ruby showcase_integration_test.rb
anchor_test_php: &anchor_test_php
command: |
# Only run PHP API test if we have project credentials key
# or this API client doesn't require credentials.
# We can remove this if-check when https://github.com/googleapis/gapic-generator/issues/2235
# is resolved and unblocks PHP unit tests without credentials.
if ! [ -e ${PHP_CLIENTS_DIR}/google-cloud-${TEST_API} ]
then
echo "PHP ${TEST_API} library was not generated."
exit 1
fi
if ! [ -z "$SYSTEM_TESTS_ENCRYPTION_KEY" ] || [ "$KEY_REQUIRED" = false ]
then
cd ${PHP_CLIENTS_DIR}/google-cloud-${TEST_API}
composer install
composer update
vendor/bin/phpunit ${TESTS_DIR}
fi
when: always
anchor_run_php: &anchor_run_php
working_directory: /tmp/
steps:
- attach_workspace:
at: workspace
- run:
name: Verify all PHP generation succeeded
<<: *anchor_check_generation
- run:
<<: *anchor_run_decrypt
- restore_cache:
keys:
- pecl-grpc-v1.15.0
- pecl-grpc-
- run:
name: Copy restored extensions into extensions directory
command: |
mkdir -p /tmp/pecl-grpc-cache
sudo cp -r /tmp/pecl-grpc-cache/. /usr/local/lib/php/extensions/no-debug-non-zts-20170718/
- run:
name: Install grpc pecl extension if grpc.so is missing
command: |
if [ ! -f /usr/local/lib/php/extensions/no-debug-non-zts-20170718/grpc.so ]; then
sudo apt-get install -y zlib1g-dev
sudo pecl install grpc
fi
sudo echo 'extension="grpc.so"' | sudo tee -a /usr/local/etc/php/php.ini > /dev/null
when: always
- run:
name: Copy pecl extensions to pecl-cache directory
command: sudo cp -r /usr/local/lib/php/extensions/no-debug-non-zts-20170718/. /tmp/pecl-grpc-cache/
- save_cache:
key: pecl-grpc-v1.15.0
paths:
- /tmp/pecl-grpc-cache
- run:
name: Prepare to test Pubsub
command: |
echo 'export TEST_API="pubsub-v1"' >> $BASH_ENV
echo 'export KEY_REQUIRED=false' >> $BASH_ENV
when: always
- run:
name: Test PHP Pubsub client
<<: *anchor_test_php
- run:
name: Prepare to test Speech
command: |
echo 'export TEST_API="speech-v1"' >> $BASH_ENV
# Need creds for Speech client tests that make live calls to server
echo 'export KEY_REQUIRED=true' >> $BASH_ENV
when: always
- run:
name: Test PHP Speech client
<<: *anchor_test_php
- run:
name: Prepare to test Logging
command: |
echo 'export TEST_API="logging-v2"' >> $BASH_ENV
echo 'export KEY_REQUIRED=false' >> $BASH_ENV
when: always
- run:
name: Test PHP Logging client
<<: *anchor_test_php
- run:
name: Prepare to test Showcase.
command: |
echo 'export TEST_API="showcase-v1beta1"' >> $BASH_ENV
echo 'export KEY_REQUIRED=false' >> $BASH_ENV
- run:
name: Test Showcase Generated Unit Tests.
<<: *anchor_test_php
- run:
name: Run Showcase Integration Tests
command: |
cd workspace/gapic-generator/showcase/php
composer update
vendor/bin/phpunit
# Test a NodeJS client if generation succeeded.
anchor_test_nodejs_client: &anchor_test_nodejs_client
command: |
cd ${NODEJS_GEN_DIR}/${TEST_API}
npm install
# Copy over IAM protos.
cp -r node_modules/google-gax/protos/google/iam/ protos/google/
npm run compile-protos
npm test
when: always
# ======================= JOBS =======================
jobs:
build:
docker:
- image: googleapis/git
steps:
- checkout
working_directory: /tmp/workspace/gapic-generator
install-gapic-generator:
docker:
- image: circleci/openjdk:8-jdk
working_directory: /tmp/workspace
environment:
SHOWCASE_VERSION: 0.10.1
steps:
- checkout:
path: gapic-generator
- run:
name: Checkout googleapis
command: |
git clone --single-branch https://github.com/googleapis/googleapis.git googleapis
- run:
name: Setup showcase protos.
# Remove the other showcase protos, testing only uses echo.proto
command: |
mkdir showcase-protos
curl -sL https://github.com/googleapis/gapic-showcase/releases/download/v${SHOWCASE_VERSION}/gapic-showcase-${SHOWCASE_VERSION}-protos.tar.gz | tar -C showcase-protos -xz
curl -sL https://github.com/googleapis/gapic-showcase/releases/download/v${SHOWCASE_VERSION}/showcase_grpc_service_config.json > showcase-protos/google/showcase/v1beta1/showcase_grpc_service_config.json
TEST_SRC="gapic-generator/src/test/java/com/google/api/codegen/testsrc/showcase"
cp ${TEST_SRC}/showcase.yaml showcase-protos/google/showcase/
cp ${TEST_SRC}/showcase_gapic.yaml showcase-protos/google/showcase/v1beta1/
cp ${TEST_SRC}/artman_showcase.yaml showcase-protos/google/showcase/
rm showcase-protos/google/showcase/v1beta1/identity.proto
rm showcase-protos/google/showcase/v1beta1/messaging.proto
rm showcase-protos/google/showcase/v1beta1/testing.proto
- run:
name: Build and install local toolkit
command: |
export RUNNING_IN_ARTMAN_DOCKER=True
rm -rf gapic-generator/.git/
gapic-generator/gradlew -p gapic-generator fatJar createToolPaths
- persist_to_workspace:
# Save the toolkit and googleapis installations in workspace for later CircleCI jobs.
root: /tmp/workspace
paths:
- gapic-generator
- googleapis
- showcase-protos
test-baselines:
docker:
- image: circleci/golang:1.11
steps:
- checkout
- run:
name: Test baselines
command: |
./testutils/check-baselines.sh
gapic-generator-bazel-test:
working_directory: /tmp/
environment:
TEST_REPORTS_DIR: /tmp/workspace/bazel/reports/gapic-generator
BAZEL_VERSION: 2.0.0
PYTHON_VERSION: 3.5.2
machine: true
steps:
- checkout:
path: gapic-generator
- attach_workspace:
at: workspace
- run:
name: Set Python version
command: |
pyenv global ${PYTHON_VERSION}
- run:
name: Install Bazel
command: |
wget https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VERSION}/bazel-${BAZEL_VERSION}-installer-linux-x86_64.sh -O bazel_installer.sh
chmod +x bazel_installer.sh
./bazel_installer.sh --user
- run:
name: Make reports directory
command: |
mkdir -p ${TEST_REPORTS_DIR}
- run:
name: Run unit tests for gapic-generator
command: |
cd gapic-generator
bazel test //...
find . -type f -regex ".*/bazel-testlogs/.*xml" -exec cp {} ${TEST_REPORTS_DIR} \;
- store_test_results:
path: bazel/reports/gapic-generator
- store_artifacts:
path: bazel/reports/gapic-generator
test-gapic-generator:
docker:
- image: circleci/openjdk:8-jdk
working_directory: /tmp/workspace
steps:
- checkout:
path: gapic-generator
- run:
name: Run unit tests for gapic-generator
command: |
mkdir -p /tmp/workspace/reports/gapic-generator
cd gapic-generator
./gradlew check
bash <(curl -s https://codecov.io/bash)
find -type f -regex ".*/build/test-results/.*xml" | xargs cp -t /tmp/workspace/reports/gapic-generator
when: always
- store_test_results:
path: reports/gapic-generator
- store_artifacts:
path: reports/gapic-generator
generate-clients:
docker:
- image: googleapis/artman:2.0.0
working_directory: /tmp/
environment:
<<: *anchor_artman_vars
steps:
- attach_workspace:
at: workspace
- run:
name: Make reports directory
command: |
mkdir -p ${ARTMAN_REPORTS_DIR}
- run:
name: Generate Pubsub Libraries
command: |
cd workspace/gapic-generator
python3 generate_clients.py \
google/pubsub/artman_pubsub.yaml \
--user-config=.circleci/artman_config.yaml \
--log-dir=${ARTMAN_REPORTS_DIR}
when: always
- run:
name: Generate Logging Libraries
command: |
cd workspace/gapic-generator
python3 generate_clients.py \
google/logging/artman_logging.yaml \
--user-config=.circleci/artman_config.yaml \
--log-dir=${ARTMAN_REPORTS_DIR}
when: always
- run:
name: Generate Speech Libraries
command: |
cd workspace/gapic-generator
# TODO: Move off artman once package2.yaml is no longer needed.
python3 generate_clients.py \
google/cloud/speech/artman_speech_v1.yaml \
--user-config=.circleci/artman_config.yaml \
--log-dir=${ARTMAN_REPORTS_DIR}
when: always
- run:
name: Generate Showcase Libraries
command: |
cd workspace/gapic-generator
python3 generate_clients.py \
google/showcase/artman_showcase.yaml \
--user-config=.circleci/artman_config.yaml \
--log-dir=${ARTMAN_REPORTS_DIR} \
--root-dir=/tmp/workspace/showcase-protos
when: always
# This step is also required so long as Java's clients rely on a different
# version of google-common-protos compared to gapic-generator.
- run:
name: Patch in pre-release version of google-common-protos
command: |
cd workspace/gapic-generator/artman-genfiles/java
JAVA_COMMON_PROTOS_VERSION=proto-google-common-protos:1.13.0-pre3
sed -i "s/proto-google-common-protos:[0-9\.]\+/${JAVA_COMMON_PROTOS_VERSION}/g" \
proto-google-showcase-v1beta1/build.gradle
- store_artifacts:
path: /tmp/workspace/reports
- store_artifacts:
path: /tmp/workspace/gapic-generator/artman-genfiles
- persist_to_workspace:
# Save all generated directories in workspace for later CircleCI jobs.
root: /tmp/workspace
paths:
- gapic-generator/artman-genfiles
- reports
compute-discovery-test:
# Generate the Discovery Compute client and run its tests.
working_directory: /tmp/
environment:
# Directory to output the generated Compute client.
COMPUTE_OUT: /tmp/discogapic_out
# Commit hash to use the discover-artifact-manager repo from
DISCOVERY_REPO_VERSION: 95c64e678877821ffea2daccbedad4fa63049028
DISCOVERY_REPO_PATH: https://raw.githubusercontent.com/googleapis/discovery-artifact-manager
docker:
- image: circleci/openjdk:8-jdk
steps:
- attach_workspace:
at: workspace
- run:
name: Download Discovery files
command: |
mkdir discovery
cd discovery
wget -K $DISCOVERY_REPO_PATH/$DISCOVERY_REPO_VERSION/discoveries/compute.v1.json
wget -K $DISCOVERY_REPO_PATH/$DISCOVERY_REPO_VERSION/gapic/google/compute/v1/compute_gapic.yaml
- run:
name: Generate and build the Java Compute client
command: |
version=`cat workspace/gapic-generator/version.txt`
java -Xmx1024m -cp workspace/gapic-generator/build/libs/gapic-generator-${version}-fatjar.jar \
com.google.api.codegen.GeneratorMain DISCOGAPIC_CODE \
--discovery_doc discovery/compute.v1.json -o $COMPUTE_OUT \
--gapic_yaml discovery/compute_gapic.yaml --language java
- run:
name: Copy over the build.gradle file for the generated client
command: |
cd workspace/gapic-generator
cp .circleci/discogapic_compute_build.gradle $COMPUTE_OUT/build.gradle
- run:
name: Run generated tests for Compute
command: |
cd $COMPUTE_OUT
gradle test
java-openjdk8-test:
working_directory: /tmp/
environment:
LANGUAGE: java
<<: *anchor_artman_vars
docker:
- image: circleci/openjdk:8-jdk
- image: gcr.io/gapic-images/gapic-showcase:0.10.1
steps:
- attach_workspace:
at: workspace
- run:
name: Verify all Java generation succeeded
<<: *anchor_check_generation
- run:
name: Run all Java generated unit tests
command: |
cd workspace/gapic-generator/artman-genfiles/java
./gradlew build test
# TODO: Java smoke tests.
- run:
name: Save test results
command: |
find . -type f -regex ".*/build/test-results/.*xml" -exec cp {} /tmp/workspace/reports/ \;
when: always
- run:
name: Install the generated showcase library
command: |
cd workspace/gapic-generator/artman-genfiles/java
./gradlew install -p gapic-google-cloud-showcase-v1beta1
./gradlew install -p proto-google-showcase-v1beta1
./gradlew install -p grpc-google-showcase-v1beta1
- run:
name: Run Showcase Integration Tests
command: |
cd workspace/gapic-generator/showcase/java
./gradlew cleanTest check
- store_test_results:
path: /tmp/workspace/reports
- store_artifacts:
path: /tmp/workspace/reports
python-test:
environment:
LANGUAGE: python
<<: *anchor_artman_vars
PYTHON_GEN_DIR: /tmp/workspace/gapic-generator/artman-genfiles/python
NOX_COMMANDS: |
nox --noxfile noxfile.py
<<: *anchor_verify_and_test_python
python-system-test:
environment:
<<: *anchor_auth_vars
PROJECT_ID: gapic-test
LANGUAGE: python
<<: *anchor_artman_vars
PYTHON_GEN_DIR: /tmp/workspace/gapic-generator/artman-genfiles/python
NOX_COMMANDS: |
nox --noxfile noxfile.py -s system
<<: *anchor_verify_and_test_python
ruby-2.5-test:
environment:
RUBY_TEST_COMMAND: "bundle exec rake test"
<<: *anchor_run_ruby
ruby-2.5-system-test:
environment:
RUBY_TEST_COMMAND: "bundle exec rake acceptance"
<<: *anchor_auth_vars
<<: *anchor_run_ruby
php-7.2-test:
<<: *anchor_run_php
environment:
LANGUAGE: php
PHP_CLIENTS_DIR: /tmp/workspace/gapic-generator/artman-genfiles/php
TESTS_DIR: tests/Unit # Only run unit tests here.
<<: *anchor_artman_vars
<<: *anchor_auth_vars
docker:
- image: circleci/php:7.2.0-cli-stretch
- image: gcr.io/gapic-images/gapic-showcase:0.2.0
php-7.2-system-test:
<<: *anchor_run_php
environment:
LANGUAGE: php
PHP_CLIENTS_DIR: /tmp/workspace/gapic-generator/artman-genfiles/php
TESTS_DIR: tests # Only run unit tests here.
<<: *anchor_artman_vars
<<: *anchor_auth_vars
docker:
- image: circleci/php:7.2.0-cli-stretch
nodejs-10-test:
working_directory: /tmp/
environment:
LANGUAGE: nodejs
NODEJS_GEN_DIR: /tmp/workspace/gapic-generator/artman-genfiles/js
<<: *anchor_artman_vars
docker:
- image: circleci/node:10-stretch-browsers
- image: gcr.io/gapic-images/gapic-showcase:0.4.0
steps:
- attach_workspace:
at: workspace
- run:
name: Verify all NodeJS generation succeeded
<<: *anchor_check_generation
- run:
name: Test Showcase
command: |
cd ${NODEJS_GEN_DIR}/showcase-v1beta1
npm install
# The following step must be done since the new api annotations are not
# in the nodejs proto files repository.
cp -rf /tmp/workspace/showcase-protos/* protos/
npm run compile-protos
npm test
- run:
name: Run Showcase integration tests
command: |
cd workspace/gapic-generator/showcase/nodejs
npm install
npm test
npm run browser-test
- run:
name: Test webpack
command: |
cd workspace/gapic-generator/showcase/nodejs
npx webpack
- run:
name: Prepare to test Pubsub
command: |
echo 'export TEST_API="pubsub-v1"' >> $BASH_ENV
when: always
- run:
name: Test Node Pubsub client
<<: *anchor_test_nodejs_client
- run:
name: Prepare to test Speech
command: |
echo 'export TEST_API="speech-v1"' >> $BASH_ENV
when: always
- run:
name: Test Node Speech client
<<: *anchor_test_nodejs_client
- run:
name: Prepare to test Logging
command: |
echo 'export TEST_API="logging-v2"' >> $BASH_ENV
when: always
- run:
name: Test Node Logging client
<<: *anchor_test_nodejs_client
go-1.10-test:
working_directory: /tmp/
environment:
LANGUAGE: go
<<: *anchor_artman_vars
GOPATH: /tmp/go
docker:
- image: circleci/golang:1.10
- image: gcr.io/gapic-images/gapic-showcase:0.2.0
steps:
- attach_workspace:
at: workspace
- run:
name: Verify all Golang generation succeeded
<<: *anchor_check_generation
- run:
name: Set up golang dev env.
command: |
mkdir -p $GOPATH/src
mkdir -p $GOPATH/bin
mkdir -p $GOPATH/pkg
export PATH="$PATH:$GOPATH/bin"
echo 'export PATH="$PATH:$GOPATH/bin"' >> $BASH_ENV
go get -u github.com/golang/protobuf/protoc-gen-go
go get -d cloud.google.com/go/...
- run:
name: Delete exisiting clients for APIs that we generated
command: |
cd $GOPATH/src/cloud.google.com/go
rm -rf logging/apiv2
rm -rf speech/apiv1
rm -rf pubsub/apiv1
cd $GOPATH/src/google.golang.org/genproto/googleapis
rm -rf logging/v2
rm -rf cloud/speech
rm -rf pubsub
- run:
name: Copy over generated clients
command: cp -r /tmp/workspace/gapic-generator/artman-genfiles/gapi-cloud-*/* $GOPATH/src
- run:
name: Test Pubsub.
command: go test cloud.google.com/go/pubsub/apiv1
when: always
- run:
name: Test Logging
command: go test cloud.google.com/go/logging/apiv2
when: always
- run:
name: Test Speech
command: go test cloud.google.com/go/speech/apiv1
when: always
- run:
name: Test Showcase
command: go test cloud.google.com/go/showcase/apiv1beta1
when: always
- run:
name: Run Showcase Integration Tests
command: |
cd /tmp/workspace/gapic-generator/showcase/go
go test .
# TODO: test other language clients.
artman_smoke_tests:
working_directory: /tmp/
environment:
ARTMAN_USER_CONFIG: /tmp/workspace/gapic-generator/.circleci/artman_config.yaml
docker:
- image: googleapis/artman:2.0.0
steps:
- attach_workspace:
at: workspace
- run:
name: Checkout artman
command: |
git clone --single-branch https://github.com/googleapis/artman.git artman
cd artman
pip install -e .
- run:
name: Run all artman on all APIs
command: |
python3 artman/test/smoketest_artman.py --root-dir=/tmp/workspace/googleapis --log=/tmp/smoketest.log --user-config=$ARTMAN_USER_CONFIG
- store_artifacts:
path: /tmp/smoketest.log
# ======================= WORKFLOWS =======================
workflows:
version: 2
run_generated_tests:
jobs:
- install-gapic-generator
- test-baselines
- artman_smoke_tests:
requires:
- install-gapic-generator
filters:
branches:
only: master
- compute-discovery-test:
requires:
- install-gapic-generator
- gapic-generator-bazel-test
- test-gapic-generator:
requires:
- test-baselines
- generate-clients:
requires:
- install-gapic-generator
- java-openjdk8-test:
requires:
- generate-clients
- python-test:
requires:
- generate-clients
- ruby-2.5-test:
requires:
- generate-clients
- python-system-test:
requires:
- generate-clients
filters:
branches:
only: master
- ruby-2.5-system-test:
requires:
- generate-clients
filters:
branches:
only: master
- php-7.2-test:
requires:
- generate-clients
# TODO: Other php versions
- go-1.10-test:
requires:
- generate-clients
- nodejs-10-test:
requires:
- generate-clients
machine:
services:
- docker