Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add workflow to update go #964

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ jobs:
name: lint
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.22'
- uses: actions/checkout@v4
with:
fetch-depth: '0'
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.22'
go-version-file: go.mod

- name: Set up Cosign
uses: sigstore/cosign-installer@v3
Expand Down
14 changes: 4 additions & 10 deletions .github/workflows/test-gh-k8s-1.16.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,16 @@ jobs:
name: Test GH 1.21
runs-on: ubuntu-20.04
steps:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.22'
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
path: src/github.com/${{ github.repository }}
fetch-depth: 0
go-version-file: go.mod
- name: Run Tests
run: |
set -e -x

export GOPATH=$(pwd)
cd src/github.com/${{ github.repository }}

# Install ytt for build
mkdir -p /tmp/bin
export PATH=/tmp/bin:$PATH
Expand All @@ -42,7 +36,7 @@ jobs:
# Ensure that there is no existing kapp installed
rm -f /tmp/bin/kapp

./hack/build-binaries.sh
./hack/build.sh

export KAPP_E2E_NAMESPACE=kapp-test
kubectl create ns $KAPP_E2E_NAMESPACE
Expand Down
14 changes: 4 additions & 10 deletions .github/workflows/test-gh.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,16 @@ jobs:
name: Test GH
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.22'
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
path: src/github.com/${{ github.repository }}
fetch-depth: 0
go-version-file: go.mod
- name: Run Tests
run: |
set -e -x

export GOPATH=$(pwd)
cd src/github.com/${{ github.repository }}

# Install ytt for build
mkdir -p /tmp/bin
export PATH=/tmp/bin:$PATH
Expand All @@ -42,7 +36,7 @@ jobs:
# Ensure that there is no existing kapp installed
rm -f /tmp/bin/kapp

./hack/build-binaries.sh
./hack/build.sh

export KAPP_E2E_NAMESPACE=kapp-test
kubectl create ns $KAPP_E2E_NAMESPACE
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/trivy-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ jobs:
with:
repo: carvel-dev/kapp
tool: kapp
goVersion: '1.22'
secrets:
githubToken: ${{ secrets.GITHUB_TOKEN }}
slackWebhookURL: ${{ secrets.SLACK_WEBHOOK_URL }}
40 changes: 40 additions & 0 deletions .github/workflows/update-go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: go-updater

on:
schedule:
- cron: '0 12 * * *'
workflow_dispatch:

jobs:
update-go:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 0
- name: Set up Go 1.x
uses: actions/setup-go@v5
with:
go-version: 'stable'
check-latest: true
- name: Update Go
run: go get go
- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.CARVEL_BOT_ACCESS_TOKEN }}
committer: Carvel Bot <[email protected]>
author: Carvel Bot <[email protected]>
commit-message: |
Bump go

Signed-off-by: Carvel Bot <[email protected]>
title: Bump go
delete-branch: true
body: |
Auto-generated by https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}

Signed-off-by: Carvel Bot <[email protected]>
base: develop
branch: bump-go
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module carvel.dev/kapp

go 1.22.3
go 1.22.5

require (
github.com/cppforlife/cobrautil v0.0.0-20221130162803-acdfead391ef
Expand Down
9 changes: 1 addition & 8 deletions hack/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,14 @@

set -e -x -u

function get_latest_git_tag {
git describe --tags | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+'
}

VERSION="${1:-`get_latest_git_tag`}"

# makes builds reproducible
export CGO_ENABLED=0
LDFLAGS="-X carvel.dev/kapp/pkg/kapp/version.Version=$VERSION -buildid="

go mod vendor
go mod tidy
go fmt ./cmd/... ./pkg/... ./test/...

go build -ldflags="$LDFLAGS" -trimpath -o kapp ./cmd/kapp/...
go build -trimpath -o kapp ./cmd/kapp/...
./kapp version

# compile tests, but do not run them: https://github.com/golang/go/issues/15513#issuecomment-839126426
Expand Down
Loading