Skip to content
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
41 changes: 28 additions & 13 deletions .github/workflows/cross-arch-build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ jobs:
build-all:
name: Build All Architectures
runs-on: ubuntu-latest
outputs:
suffix: ${{ steps.version.outputs.suffix }}

steps:
- name: Checkout code
Expand All @@ -29,11 +31,24 @@ jobs:
go clean -cache -modcache -i -r || true
echo "Go environment cleaned"

- name: Determine version
id: version
run: |
if [[ "${{ github.ref_type }}" == "tag" ]]; then
echo "version=${{ github.ref_name }}" >> $GITHUB_OUTPUT
echo "suffix=${{ github.ref_name }}_" >> $GITHUB_OUTPUT
echo "Building with version: ${{ github.ref_name }}"
else
echo "version=" >> $GITHUB_OUTPUT
echo "suffix=" >> $GITHUB_OUTPUT
echo "Building without version (non-tag build)"
fi

- name: Build all architectures using make
run: |
set -e
echo "Building all architectures..."
if ! make release-build; then
if ! make release-build VERSION="${{ steps.version.outputs.version }}"; then
echo "❌ Build failed"
exit 1
fi
Expand All @@ -56,24 +71,24 @@ jobs:
with:
name: linux-binaries
path: |
kubectl-oadp_${{ github.ref_name }}_linux_amd64
kubectl-oadp_${{ github.ref_name }}_linux_arm64
kubectl-oadp_${{ steps.version.outputs.suffix }}linux_amd64
kubectl-oadp_${{ steps.version.outputs.suffix }}linux_arm64

- name: Upload macOS binaries
uses: actions/upload-artifact@v4
with:
name: macos-binaries
path: |
kubectl-oadp_${{ github.ref_name }}_darwin_amd64
kubectl-oadp_${{ github.ref_name }}_darwin_arm64
kubectl-oadp_${{ steps.version.outputs.suffix }}darwin_amd64
kubectl-oadp_${{ steps.version.outputs.suffix }}darwin_arm64

- name: Upload Windows binaries
uses: actions/upload-artifact@v4
with:
name: windows-binaries
path: |
kubectl-oadp_${{ github.ref_name }}_windows_amd64.exe
kubectl-oadp_${{ github.ref_name }}_windows_arm64.exe
kubectl-oadp_${{ steps.version.outputs.suffix }}windows_amd64.exe
kubectl-oadp_${{ steps.version.outputs.suffix }}windows_arm64.exe

- name: Run host tests
run: |
Expand All @@ -95,10 +110,10 @@ jobs:
include:
- os: ubuntu-latest
arch: amd64
binary: kubectl-oadp_${{ github.ref_name }}_linux_amd64
binary: kubectl-oadp_${{ needs.build-all.outputs.suffix }}linux_amd64
- os: ubuntu-24.04-arm
arch: arm64
binary: kubectl-oadp_${{ github.ref_name }}_linux_arm64
binary: kubectl-oadp_${{ needs.build-all.outputs.suffix }}linux_arm64

runs-on: ${{ matrix.os }}

Expand Down Expand Up @@ -202,10 +217,10 @@ jobs:
include:
- os: macos-13 # Intel
arch: amd64
binary: kubectl-oadp_${{ github.ref_name }}_darwin_amd64
binary: kubectl-oadp_${{ needs.build-all.outputs.suffix }}darwin_amd64
- os: macos-latest # Apple Silicon
arch: arm64
binary: kubectl-oadp_${{ github.ref_name }}_darwin_arm64
binary: kubectl-oadp_${{ needs.build-all.outputs.suffix }}darwin_arm64

runs-on: ${{ matrix.os }}

Expand Down Expand Up @@ -309,10 +324,10 @@ jobs:
include:
- os: windows-latest # amd64
arch: amd64
binary: kubectl-oadp_${{ github.ref_name }}_windows_amd64.exe
binary: kubectl-oadp_${{ needs.build-all.outputs.suffix }}windows_amd64.exe
- os: windows-11-arm # arm64
arch: arm64
binary: kubectl-oadp_${{ github.ref_name }}_windows_arm64.exe
binary: kubectl-oadp_${{ needs.build-all.outputs.suffix }}windows_arm64.exe

runs-on: ${{ matrix.os }}

Expand Down
11 changes: 8 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -386,8 +386,13 @@ release-build: ## Build binaries for all platforms
fi; \
echo "Building for $$GOOS/$$GOARCH..."; \
GOOS=$$GOOS GOARCH=$$GOARCH go build -o $$binary_name .; \
echo "✅ Built $$binary_name for $$GOOS/$$GOARCH"; \
mv $$binary_name $(BINARY_NAME)_${VERSION}_$$GOOS_$$GOARCH$${binary_name#$(BINARY_NAME)}; \
if [ -n "$(VERSION)" ]; then \
final_name="$(BINARY_NAME)_$(VERSION)_$${GOOS}_$${GOARCH}$${binary_name#$(BINARY_NAME)}"; \
else \
final_name="$(BINARY_NAME)_$${GOOS}_$${GOARCH}$${binary_name#$(BINARY_NAME)}"; \
fi; \
mv $$binary_name $$final_name; \
echo "✅ Built $$final_name for $$GOOS/$$GOARCH"; \
done
@echo "✅ All release binaries built successfully!"

Expand All @@ -408,7 +413,7 @@ release-archives: release-build ## Create tar.gz archives for all platforms (inc
fi; \
archive_name="$(BINARY_NAME)_${VERSION}_$$GOOS_$$GOARCH.tar.gz"; \
echo "Creating $$archive_name..."; \
tar czf $$archive_name LICENSE $(BINARY_NAME)_${VERSION}_$$GOOS_$$GOARCH$${binary_name#$(BINARY_NAME)}; \
tar czf $$archive_name LICENSE $(BINARY_NAME)_${VERSION}_$${GOOS}_$${GOARCH}$${binary_name#$(BINARY_NAME)}; \
sha256sum $$archive_name > $$archive_name.sha256; \
echo "✅ Created $$archive_name with LICENSE"; \
done
Expand Down
Loading