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

Improve workflow speed & build binaries #144

Merged
merged 9 commits into from
Feb 7, 2025
Merged
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
46 changes: 0 additions & 46 deletions .github/actions/cache-cloud-provider-kind-image/action.yml

This file was deleted.

59 changes: 59 additions & 0 deletions .github/release-drafter-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name-template: "v$RESOLVED_VERSION"
tag-template: "v$RESOLVED_VERSION"
categories:
- title: "🚀 Features"
labels:
- "feat"
- "feature"
- "enhancement"
- title: "🐛 Bug Fixes"
labels:
- "fix"
- "bugfix"
- "bug"
- title: "🧰 Maintenance"
labels:
- "chore"
- title: "💥 Breaking Changes"
labels:
- "breaking"

change-template: "- $TITLE @$AUTHOR (#$NUMBER)"
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.
version-resolver:
major:
labels:
- "major"
- "breaking"
minor:
labels:
- "minor"
patch:
labels:
- "patch"
default: patch
template: |
## Changes

$CHANGES

autolabeler:
- label: "chore"
files:
- "*.md"
title:
- "/^docs!?:/i"
- "/^test!?:/i"
- "/^chore!?:/i"
- "/^refactor!?:/i"
- label: "bug"
title:
- "/^fix!?:/i"
- "/^revert!?:/i"
- label: "feature"
title:
- "/^feat!?:/i"
- "/^add!?:/i"
- label: "breaking"
title:
- "/^[a-zA-Z]+!:/i"
5 changes: 1 addition & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,5 @@ jobs:
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Install dependencies
run: |
go mod download
- name: Build and run tests with race detector enabled
run: just test-race
run: just test-race
3 changes: 0 additions & 3 deletions .github/workflows/govulncheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ jobs:
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Install dependencies
run: |
go mod download
- id: govulncheck
uses: golang/govulncheck-action@v1
with:
Expand Down
6 changes: 0 additions & 6 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ jobs:
- name: Build and run tests
run: just build

- name: Build and cache cloud-provider-kind image
uses: ./.github/actions/cache-cloud-provider-kind-image

- name: Install kind
run: just install-kind

Expand Down Expand Up @@ -64,9 +61,6 @@ jobs:

- name: Build and run tests
run: just build

- name: Build and cache cloud-provider-kind image
uses: ./.github/actions/cache-cloud-provider-kind-image

- name: Build and install test plugin
run: just install-test-plugin
Expand Down
22 changes: 22 additions & 0 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Release Drafter
on:
push:
branches:
- main
pull_request:
types: [opened, reopened, synchronize]
permissions:
contents: read
jobs:
update_release_draft:
permissions:
contents: write
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: release-drafter/release-drafter@v6
with:
config-name: release-drafter-config.yml
publish: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33 changes: 33 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: pre-release-binaries
on:
push:
tags:
- "v*.*.*"

jobs:
publish:
name: Build and Publish
runs-on: ubuntu-latest
if: github.event_name != 'pull_request'
strategy:
matrix:
goos: [linux, darwin]
goarch: [amd64, arm64]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Build
run: |
mkdir -p dist
GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -o dist/cofidectl-${{ matrix.goos }}-${{ matrix.goarch }}-${{ github.ref_name }} ./cmd/cofidectl/main.go
- name: Upload artifacts
run: |
gh release list --limit 1 | grep -q ${{ github.ref_name }} || gh release create ${{ github.ref_name }} -d
gh release upload ${{ github.ref_name }} dist/cofidectl-${{ matrix.goos }}-${{ matrix.goarch }} --clobber
gh release upload ${{ github.ref_name }} LICENSE --clobber
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module github.com/cofide/cofidectl

go 1.23.0

toolchain go1.23.4
toolchain go1.23.6

require (
buf.build/go/protoyaml v0.3.1
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/create-kind-cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ DELETE_EXISTING_KIND_CLUSTER=${DELETE_EXISTING_KIND_CLUSTER:-true}

K8S_CLUSTER_NAME=${K8S_CLUSTER_NAME:-local1}

CLOUD_PROVIDER_KIND_CONTAINER_NAME=cloud-provider-kind-cloud-provider-1
CLOUD_PROVIDER_KIND_CONTAINER_NAME=cloud-provider-kind

function delete_kind_cluster() {
cluster=$(kind get clusters | egrep "\b${K8S_CLUSTER_NAME}\b" || true)
Expand Down
17 changes: 8 additions & 9 deletions tests/integration/install-kind.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,13 @@ function ensure_kind_network() {
fi
}

function install_cloud_provider_kind() {
# https://github.com/kubernetes-sigs/cloud-provider-kind
if [[ ! -d cloud-provider-kind ]]; then
git clone --depth 1 https://github.com/kubernetes-sigs/cloud-provider-kind
fi
pushd cloud-provider-kind
sudo bash -c 'NET_MODE=kind docker compose up -d'
popd
function run_cloud_provider_kind() {
docker run -d \
--network kind \
--restart unless-stopped \
--name cloud-provider-kind \
-v /var/run/docker.sock:/var/run/docker.sock \
registry.k8s.io/cloud-provider-kind/cloud-controller-manager:v0.5.0
}

function check_non_root_docker_access() {
Expand All @@ -82,7 +81,7 @@ function main() {
install_kind
set_inotify_limits_for_kind
ensure_kind_network
install_cloud_provider_kind
run_cloud_provider_kind
echo "Success!"
check_non_root_docker_access
}
Expand Down
Loading