Skip to content

fix codeql

fix codeql #137

Workflow file for this run

on:
push:
paths-ignore:
- 'charts/**'
- 'docs/**'
- '/*.md'
branches:
- '*'
pull_request:
paths-ignore:
- 'charts/**'
- 'docs/**'
- '/*.md'
workflow_call:
name: Build and test
jobs:
build:
strategy:
matrix:
architecture: [amd64, arm64]
os: [linux, darwin]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go 1.20.x
uses: actions/setup-go@v5
with:
go-version-file: './go.mod'
id: go
- name: Download Go modules
run: go mod download
env:
GOPROXY: https://proxy.golang.org
- name: Set ldflags version
if: github.event_name == 'push' && github.ref_type == 'tag'
run: |
echo LDFLAGS="-ldflags=\"-X 'main.Version=${{ github.ref_name }}' -X 'k8s.io/component-base/version.gitVersion=${{ github.ref_name }}'"\" >> $GITHUB_ENV
- name: Build
run: GOOS=${{ matrix.os }} GOARCH=${{matrix.architecture}} go build ${{ env.LDFLAGS }} -o bin/thundering-herd-scheduler-${{ matrix.os }}-${{ matrix.architecture }} ./cmd/thundering-herd-scheduler
- name: Version
if: matrix.os == 'linux' && matrix.architecture == 'amd64'
run: bin/thundering-herd-scheduler-${{ matrix.os }}-${{ matrix.architecture }} --version
- name: Test
run: go test ./...
- uses: actions/upload-artifact@v3
if: github.event_name != 'pull_request'
with:
name: thundering-herd-scheduler-binaries
path: bin/thundering-herd-scheduler-*
if-no-files-found: error