Skip to content

fix: remove line that enables Cloud Source Repositories API as this is now deprecated #2500

fix: remove line that enables Cloud Source Repositories API as this is now deprecated

fix: remove line that enables Cloud Source Repositories API as this is now deprecated #2500

Workflow file for this run

# Copyright 2021 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.
## TODO:: Post comment on correct ways to resolve the build errors
name: "Continuous Integration - Pull Request"
on:
pull_request:
branches:
- main
jobs:
# Run static code tests: license-check, terraform format, Golang linting
static-code-tests:
runs-on: [self-hosted, runner-nov-22]
steps:
- uses: actions/checkout@v4
with:
ref: ${{github.event.pull_request.head.sha}}
- name: License Check
run: |
addlicense -check -ignore anthos-bm-openstack-terraform/resources/cloud-config.yaml ./
- name: Terraform Checkstyle
timeout-minutes: 20
run: |
tfenv use 1.9.5
terraform fmt -recursive -check -diff ./
- name: Golang Checkstyle
timeout-minutes: 20
run: |
golint ./... > golint.err 2>&1
if ! [ -s golint.err ]; then
exit 0
fi
if ! grep -q '"./..." matched no packages' "golint.err"; then
echo '[✘] Some .go files are not properly formatted. Check for lint errors using (golint ./...)'
cat golint.err
exit 1
fi
# Run terraform validate on terraform based samples
tf-validate:
runs-on: [self-hosted, runner-nov-22]
strategy:
matrix:
# list of directories in the repo that hosts Terraform samples
# update this list as new terraform samples are added to the repo
tf-sample: [
'anthos-attached-clusters',
'anthos-bm-gcp-terraform',
'anthos-bm-openstack-terraform',
'anthos-multi-cloud/AWS',
'anthos-multi-cloud/Azure'
]
steps:
- uses: actions/checkout@v4
with:
ref: ${{github.event.pull_request.head.sha}}
- name: Terraform Validate
timeout-minutes: 20
env:
SAMPLE_DIR: ${{ matrix.tf-sample }}
run: |
echo "Terraform validating: $SAMPLE_DIR"
cd $SAMPLE_DIR
tfenv use 1.9.5
terraform init -backend=false
terraform validate -json .
# Run the Golang unit tests in any of the samples
go-unit-tests:
runs-on: [self-hosted, runner-nov-22]
strategy:
matrix:
# list of directories in the repo that hosts Golang unit tests
# update this list as new unit tests in golang are added to the repo
go-test-dir: ['anthos-bm-gcp-terraform/test/unit/']
steps:
- uses: actions/checkout@v4
with:
ref: ${{github.event.pull_request.head.sha}}
- uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0
with:
go-version-file: ${{ matrix.go-test-dir }}/../go.mod
- name: Golang unit tests
timeout-minutes: 20
env:
GOLANG_TEST_DIR: ${{ matrix.go-test-dir }}
run: |
source /var/local/gh-runner/env_vars
cd $GOLANG_TEST_DIR
/usr/local/go/bin/go test -v -timeout 30m ./