Skip to content

Add license check to lint build step #822

Add license check to lint build step

Add license check to lint build step #822

Workflow file for this run

# Copyright 2025 Splunk Inc.
#
# 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.
name: build
on:
pull_request:
push:
branches:
- main
jobs:
build-linux:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v2
with:
go-version: 1.22
id: go
- uses: azure/[email protected]
with:
version: 'v3.7.0'
id: install
- uses: azure/setup-kubectl@v3
id: install-kubectl
- uses: actions/checkout@v2
with:
fetch-depth: "0"
- uses: actions/cache@v4
with:
# In order:
# * Module download cache
# * Build cache (Linux)
# * Build cache (Mac)
# * Build cache (Windows)
path: |
~/go/pkg/mod
~/.cache/go-build
~/Library/Caches/go-build
%LocalAppData%\go-build
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
id: cache
- name: Install command dependencies
run: |
mkdir -p $HOME/go/bin
export GOPATH=$HOME/go
echo "GOPATH=$GOPATH" >> $GITHUB_ENV
echo "GO_VERSION=$(go version | awk '{ print $3}' | sed 's/^go//')" >> $GITHUB_ENV
echo "$HOME/go/bin" >> $GITHUB_PATH
make install-ci install
- name: Build
run: make build
- name: Lint
run: |
make lint
make check-license
- name: Create k8s Kind Cluster
uses: helm/[email protected]
with:
version: v0.11.1
wait: 90s
cluster_name: kind
- name: Test
run: |
make test TEST_FLAGS="-timeout 3m -tags integration"
- uses: codecov/codecov-action@v2
- name: goreleaser
uses: goreleaser/goreleaser-action@v2
with:
args: release --snapshot --skip=publish --clean --release-notes .release-notes.md
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build-windows:
name: Build(Windows)
runs-on: windows-latest
steps:
- uses: actions/setup-go@v2
with:
go-version: 1.22
id: go
- uses: azure/[email protected]
with:
version: 'v3.7.0'
id: install
- uses: actions/checkout@v2
- uses: actions/cache@v4
with:
# In order:
# * Module download cache
# * Build cache (Linux)
# * Build cache (Mac)
# * Build cache (Windows)
path: |
~/go/pkg/mod
~/.cache/go-build
~/Library/Caches/go-build
%LocalAppData%\go-build
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
id: cache
- name: Install command dependencies
run: |
echo "GOPATH=$HOME/go" >> $GITHUB_ENV
echo "GO_VERSION=$(go version | awk '{ print $3}' | sed 's/^go//')" >> $GITHUB_ENV
echo "$HOME/go/bin" >> $GITHUB_PATH
- name: Build
run: make build
- name: Test
run: make test