agones.dev/agones@v1.53.0/build/includes/examples.mk (about)

     1  # Copyright 2019 Google LLC All Rights Reserved.
     2  #
     3  # Licensed under the Apache License, Version 2.0 (the "License");
     4  # you may not use this file except in compliance with the License.
     5  # You may obtain a copy of the License at
     6  #
     7  #     http://www.apache.org/licenses/LICENSE-2.0
     8  #
     9  # Unless required by applicable law or agreed to in writing, software
    10  # distributed under the License is distributed on an "AS IS" BASIS,
    11  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  # See the License for the specific language governing permissions and
    13  # limitations under the License.
    14  
    15  #
    16  # Include for managing the examples
    17  #
    18  
    19  #   _____                    _
    20  #  |_   _|_ _ _ __ __ _  ___| |_ ___
    21  #    | |/ _` | '__/ _` |/ _ \ __/ __|
    22  #    | | (_| | | | (_| |  __/ |_\__ \
    23  #    |_|\__,_|_|  \__, |\___|\__|___/
    24  #                 |___/
    25  
    26  # test all example images exist on Google Artifact Registry (GAR)
    27  test-examples-on-gar: example-image-test.allocation-endpoint
    28  test-examples-on-gar: example-image-test.autoscaler-webhook
    29  test-examples-on-gar: example-image-test.cpp-simple
    30  test-examples-on-gar: example-image-test.nodejs-simple
    31  test-examples-on-gar: example-image-test.rust-simple
    32  test-examples-on-gar: example-image-test.unity-simple
    33  test-examples-on-gar: example-image-test.xonotic
    34  test-examples-on-gar: example-image-test.crd-client
    35  test-examples-on-gar: example-image-test.supertuxkart
    36  test-examples-on-gar: example-image-test.simple-game-server
    37  test-examples-on-gar: example-image-test.simple-genai-server
    38  test-examples-on-gar: example-image-test.custom-controller
    39  
    40  push-example-golang-images: example-image-push.allocation-endpoint
    41  push-example-golang-images: example-image-push.autoscaler-webhook
    42  push-example-golang-images: example-image-push.crd-client
    43  push-example-golang-images: example-image-push.simple-game-server
    44  push-example-golang-images: example-image-push.simple-genai-server
    45  push-example-golang-images: example-image-push.supertuxkart
    46  push-example-golang-images: example-image-push.xonotic
    47  push-example-golang-images: example-image-push.custom-controller
    48  
    49  # Test to ensure the example image found in the % folder is on GAR. Fails if it is not.
    50  example-image-test.%:
    51  	$(DOCKER_RUN) bash -c "cd examples/$* && make gar-check"
    52  
    53  example-image-push.%:
    54  	$(DOCKER_RUN) bash -c "cd examples/$* && make push"
    55  
    56  # Perform make build for golang examples
    57  build-go-examples: build-example-allocation-endpoint build-example-autoscaler-webhook build-example-crd-client build-example-simple-game-server build-example-simple-genai-server build-example-supertuxkart build-example-xonotic build-example-custom-controller
    58  
    59  # Perform make build for all examples
    60  build-examples: build-example-allocation-endpoint build-example-autoscaler-webhook build-example-cpp-simple build-example-crd-client build-example-nodejs-simple build-example-rust-simple build-example-simple-game-server build-example-simple-genai-server build-example-supertuxkart build-example-xonotic
    61  
    62  # Run "make build" command for one example directory
    63  build-example:
    64  	cd  $(examples_folder)/$(EXAMPLE); \
    65  	if [ -f Makefile ] ; then \
    66  		make build; \
    67  	else \
    68  		echo "Makefile was not found in "/examples/$(EXAMPLE)" directory - nothing to execute" ; \
    69  	fi
    70  
    71  build-example-allocation-endpoint:
    72  	$(MAKE) build-example EXAMPLE=allocation-endpoint
    73  
    74  build-example-autoscaler-webhook:
    75  	$(MAKE) build-example EXAMPLE=autoscaler-webhook
    76  
    77  build-example-cpp-simple:
    78  	$(MAKE) build-example EXAMPLE=cpp-simple
    79  
    80  build-example-crd-client:
    81  	$(MAKE) build-example EXAMPLE=crd-client
    82  
    83  build-example-nodejs-simple:
    84  	$(MAKE) build-example EXAMPLE=nodejs-simple
    85  
    86  build-example-rust-simple:
    87  	$(MAKE) build-example EXAMPLE=rust-simple
    88  
    89  build-example-simple-game-server:
    90  	$(MAKE) build-example EXAMPLE=simple-game-server
    91  
    92  build-example-simple-genai-server:
    93  	$(MAKE) build-example EXAMPLE=simple-genai-server
    94  
    95  build-example-supertuxkart:
    96  	$(MAKE) build-example EXAMPLE=supertuxkart
    97  
    98  build-example-xonotic:
    99  	$(MAKE) build-example EXAMPLE=xonotic
   100  
   101  build-example-custom-controller:
   102  	$(MAKE) build-example EXAMPLE=custom-controller
   103  
   104  # ensure a version increase when an example changes
   105  check-example-versions: ensure-build-image
   106  	docker run --rm $(common_mounts) --workdir=$(mount_path)/build/scripts/example-version-checker $(DOCKER_RUN_ARGS) $(build_tag) \
   107  		go run .