python-example-noncontainer-artifacts/cloudbuild.yaml (21 lines of code) (raw):

# Copyright 2020 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. # [START cloudbuild_python_yaml] steps: - name: python entrypoint: python args: ["-m", "pip", "install", "--upgrade", "pip"] # [START cloudbuild_python_dependencies_yaml] # Install dependencies - name: python entrypoint: python args: ["-m", "pip", "install", "build", "pytest", "Flask", "--user"] # [END cloudbuild_python_dependencies_yaml] # [START cloudbuild_python_package_yaml] # Python Build - name: python entrypoint: python args: ["-m", "build"] # [END cloudbuild_python_package_yaml] # [START cloudbuild_python_tests_yaml] # Run unit tests - name: python entrypoint: python args: ["-m", "pytest", "--junitxml=${SHORT_SHA}_test_log.xml"] # [END cloudbuild_python_tests_yaml] # [START cloudbuild_python_logs_yaml] # Save test logs to Google Cloud Storage artifacts: objects: location: gs://${_BUCKET_NAME}/ paths: - ${SHORT_SHA}_test_log.xml # [END cloudbuild_python_logs_yaml] # Store Python package in Google Artifact Registry pythonPackages: - repository: "https://us-central1-python.pkg.dev/${PROJECT_ID}/${_ARTIFACT_REGISTRY_PYTHON_REPO}" paths: ["dist/*"] # [END cloudbuild_python_yaml]