<commit_before># Copyright 2022 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.
steps:
  # Run tests and save to file
  - name: golang
    entrypoint: /bin/bash
    args: 
      - -c
      - |
        cd badge
        go get -u github.com/jstemmer/go-junit-report 2>&1
        go test -timeout 1m -v ./... | tee sponge.log
        /go/bin/go-junit-report -set-exit-code < sponge.log > ${SHORT_SHA}_test_log.xml

  # Docker Build
  - name: 'gcr.io/cloud-builders/docker'
    args: ['build', '-t', 
           'us-central1-docker.pkg.dev/$PROJECT_ID/gcb-tools/badge:$SHORT_SHA', '.']

  # Docker push to Google Artifact Registry
  - name: 'gcr.io/cloud-builders/docker'
    args: ['push', 'us-central1-docker.pkg.dev/$PROJECT_ID/gcb-tools/badge:$SHORT_SHA']

  # Deploy to Cloud Run
  - name: 'gcr.io/cloud-builders/gcloud'
    args: ['run', 'deploy', 'badge-${SHORT_SHA}', 
           '--image=us-central1-docker.pkg.dev/$PROJECT_ID/gcb-tools/badge:$SHORT_SHA', 
           '--region', 'us-central1', '--platform', 'managed']

# Save test logs to Google Cloud Storage
artifacts:
  objects:
    location: gs://gcbdash/
    paths:
      - badge/${SHORT_SHA}_test_log.xml
# Store images in Google Artifact Registry
images:
  - us-central1-docker.pkg.dev/$PROJECT_ID/gcb-tools/badge:$SHORT_SHA

<commit_msg>Don't deploy to a new service each time<commit_after># Copyright 2022 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.
steps:
  # Run tests and save to file
  - name: golang
    entrypoint: /bin/bash
    args: 
      - -c
      - |
        cd badge
        go get -u github.com/jstemmer/go-junit-report 2>&1
        go test -timeout 1m -v ./... | tee sponge.log
        /go/bin/go-junit-report -set-exit-code < sponge.log > ${SHORT_SHA}_test_log.xml

  # Docker Build
  - name: 'gcr.io/cloud-builders/docker'
    args: ['build', '-t', 
           'us-central1-docker.pkg.dev/$PROJECT_ID/gcb-tools/badge:$SHORT_SHA', '.']

  # Docker push to Google Artifact Registry
  - name: 'gcr.io/cloud-builders/docker'
    args: ['push', 'us-central1-docker.pkg.dev/$PROJECT_ID/gcb-tools/badge:$SHORT_SHA']

  # Deploy to Cloud Run
  - name: 'gcr.io/cloud-builders/gcloud'
    args: ['run', 'deploy', 'badge', 
           '--image=us-central1-docker.pkg.dev/$PROJECT_ID/gcb-tools/badge:$SHORT_SHA', 
           '--region', 'us-central1', '--platform', 'managed']

# Save test logs to Google Cloud Storage
artifacts:
  objects:
    location: gs://gcbdash/
    paths:
      - badge/${SHORT_SHA}_test_log.xml
# Store images in Google Artifact Registry
images:
  - us-central1-docker.pkg.dev/$PROJECT_ID/gcb-tools/badge:$SHORT_SHA


{'fraction_non_alphanumeric': 0.12840252955732748, 'fraction_numerical': 0.008798460269452846, 'mean_word_length': 2.9934138309549945, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1625261', 'n_tokens_mistral': 1268, 'n_tokens_neox': 1171, 'n_words': 345}