Skip to content

Go

Go #2304

Workflow file for this run

# Copyright 2023 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
#
# https://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.
---
name: Go
on:
push:
branches: [main]
pull_request:
branches: [main]
schedule:
- cron: "0 0 * * *"
permissions: {}
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
strategy:
matrix:
go: ["1.26.1"]
env:
GOTOOLCHAIN: "go${{ matrix.go }}"
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false
- name: Set up Go ${{ matrix.go }}
uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0
with:
go-version: ${{ matrix.go }}
- name: Build
run: go build -v ./...
test:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false
- name: Set up Go
uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0
with:
go-version: "1.26.4"
- name: Run Coverage
run: go test -v -tags=ci -coverprofile=profile.cov ./...
- name: Send coverage
continue-on-error: true
uses: shogo82148/actions-goveralls@9606dbc5ac5cf888a0e9ef901515c3cd516a2790 # v1.11.0
with:
path-to-profile: profile.cov
static_analysis:
name: Static Analysis
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
persist-credentials: false
- name: Install Go
uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0
with:
go-version: "1.26.4"
id: go
- name: Install required static analysis tools
run: |
go get -u honnef.co/go/tools/cmd/staticcheck
- name: Check out code
uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0
- name: get dependencies
run: |
go get -v -t -d ./...
- name: Go vet
run: go vet ./...
- name: Check gofmt
run: diff -u <(echo -n) <(gofmt -d -s .)