Skip to content

Commit

Permalink
reduce build size
Browse files Browse the repository at this point in the history
  • Loading branch information
dpaasman00 committed Sep 5, 2024
1 parent f3b1446 commit 13a039a
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 102 deletions.
113 changes: 56 additions & 57 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,65 +5,64 @@ on:
- "v*"

jobs:
build-64bit-msi:
runs-on: windows-2022
steps:
- name: Checkout Sources
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.21"
check-latest: true
- name: Install tools
run: make install-tools
# Needed until supervisor binary is released
- name: Build Supervisor Binary
run: make release-prep
- name: Build Windows Binaries
run: make build-binaries
- name: Copy Windows Collector Binary
run: cp dist/collector_windows_amd64.exe windows/observiq-otel-collector.exe
- name: Copy Windows Updater Binary
run: cp dist/updater_windows_amd64.exe windows/updater.exe
- name: Copy Supervisor Binary
run: cp release_deps/supervisor_bin/opampsupervisor_windows_amd64.exe windows/opampsupervisor.exe
- name: Copy Plugins to MSI Build Directory
run: cp -r release_deps/plugins windows/
- name: Copy Example Config
run: cp config/example.yaml windows/config.yaml
- name: Copy JMX Receiver Jar
run: cp release_deps/opentelemetry-java-contrib-jmx-metrics.jar windows/opentelemetry-java-contrib-jmx-metrics.jar
- name: Copy LICENSE
run: cp LICENSE windows/LICENSE
- name: Copy VERSION file
run: cp release_deps/VERSION.txt windows/VERSION.txt
# HACK: Copy build directory to C drive to avoid this error, since there must be a relative path from the tempdir that go-msi uses
# for the MSI to build properly
- name: Copy Build Dir
run: |
cp -r windows C:/build
echo "C:/build" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
# Installs go-msi and wix.
- name: Install Build Tools
run: |
curl -f -L -o go-msi.exe https://github.com/observIQ/go-msi/releases/download/v2.2.0/go-msi.exe
curl -f -L -o wix310-binaries.zip https://github.com/wixtoolset/wix3/releases/download/wix3104rtm/wix310-binaries.zip
unzip wix310-binaries.zip
working-directory: C:/build
- name: "Build MSI from Tagged Release"
run: go-msi.exe make -m observiq-otel-collector.msi --version ${{ github.ref_name }} --arch amd64
working-directory: C:/build
- name: "Upload MSI"
uses: actions/upload-artifact@v4
with:
name: observiq-otel-collector.msi
path: C:/build/observiq-otel-collector.msi
# Short lived because Go Releaser will upload the msi to a release (github release, gcs, etc)
retention-days: 1
# build-64bit-msi:
# runs-on: windows-2022
# steps:
# - name: Checkout Sources
# uses: actions/checkout@v4
# - name: Setup Go
# uses: actions/setup-go@v5
# with:
# go-version: "1.21"
# check-latest: true
# - name: Install tools
# run: make install-tools
# # Needed until supervisor binary is released
# - name: Build Supervisor Binary
# run: make release-prep
# - name: Build Windows Binaries
# run: make build-binaries
# - name: Copy Windows Collector Binary
# run: cp dist/collector_windows_amd64.exe windows/observiq-otel-collector.exe
# - name: Copy Windows Updater Binary
# run: cp dist/updater_windows_amd64.exe windows/updater.exe
# - name: Copy Supervisor Binary
# run: cp release_deps/supervisor_bin/opampsupervisor_windows_amd64.exe windows/opampsupervisor.exe
# - name: Copy Plugins to MSI Build Directory
# run: cp -r release_deps/plugins windows/
# - name: Copy Example Config
# run: cp config/example.yaml windows/config.yaml
# - name: Copy JMX Receiver Jar
# run: cp release_deps/opentelemetry-java-contrib-jmx-metrics.jar windows/opentelemetry-java-contrib-jmx-metrics.jar
# - name: Copy LICENSE
# run: cp LICENSE windows/LICENSE
# - name: Copy VERSION file
# run: cp release_deps/VERSION.txt windows/VERSION.txt
# # HACK: Copy build directory to C drive to avoid this error, since there must be a relative path from the tempdir that go-msi uses
# # for the MSI to build properly
# - name: Copy Build Dir
# run: |
# cp -r windows C:/build
# echo "C:/build" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
# # Installs go-msi and wix.
# - name: Install Build Tools
# run: |
# curl -f -L -o go-msi.exe https://github.com/observIQ/go-msi/releases/download/v2.2.0/go-msi.exe
# curl -f -L -o wix310-binaries.zip https://github.com/wixtoolset/wix3/releases/download/wix3104rtm/wix310-binaries.zip
# unzip wix310-binaries.zip
# working-directory: C:/build
# - name: "Build MSI from Tagged Release"
# run: go-msi.exe make -m observiq-otel-collector.msi --version ${{ github.ref_name }} --arch amd64
# working-directory: C:/build
# - name: "Upload MSI"
# uses: actions/upload-artifact@v4
# with:
# name: observiq-otel-collector.msi
# path: C:/build/observiq-otel-collector.msi
# # Short lived because Go Releaser will upload the msi to a release (github release, gcs, etc)
# retention-days: 1

release:
needs: [build-64bit-msi]
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
Expand Down
48 changes: 6 additions & 42 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,85 +19,49 @@ builds:
binary: observiq-otel-collector
mod_timestamp: "{{ .CommitTimestamp }}"
goos:
- windows
- linux
- darwin
goarch:
- amd64
- arm64
- arm
- ppc64
- ppc64le
ignore:
- goos: windows
goarch: arm
- goos: windows
- goos: linux
goarch: arm64
- goos: windows
goarch: ppc64
- goos: windows
goarch: ppc64le
- goos: darwin
goarch: ppc64
- goos: darwin
goarch: ppc64le
goarch: amd64
prebuilt:
path: tmp/collector_{{ .Os }}_{{ .Arch }}{{ .Ext }}
- id: updater
builder: prebuilt
binary: updater
mod_timestamp: "{{ .CommitTimestamp }}"
goos:
- windows
- linux
- darwin
goarch:
- amd64
- arm64
- arm
- ppc64
- ppc64le
ignore:
- goos: windows
goarch: arm
- goos: windows
- goos: linux
goarch: arm64
- goos: windows
goarch: ppc64
- goos: windows
goarch: ppc64le
- goos: darwin
goarch: ppc64
- goos: darwin
goarch: ppc64le
goarch: amd64
prebuilt:
path: tmp/updater_{{ .Os }}_{{ .Arch }}{{ .Ext }}
- id: supervisor
builder: prebuilt
binary: opampsupervisor
goos:
- windows
- linux
- darwin
goarch:
- amd64
- arm64
- arm
- ppc64
- ppc64le
ignore:
- goos: windows
goarch: arm
- goos: windows
- goos: linux
goarch: arm64
- goos: windows
goarch: ppc64
- goos: windows
goarch: ppc64le
- goos: darwin
goarch: ppc64
- goos: darwin
goarch: ppc64le
goarch: amd64
prebuilt:
path: release_deps/supervisor_bin/opampsupervisor_{{ .Os }}_{{ .Arch }}{{ .Ext }}

Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ reset: kill
build-binaries: agent updater

.PHONY: build-all
build-all: build-linux build-darwin build-windows
build-all: build-linux-amd64 build-darwin-arm64

.PHONY: build-linux
build-linux: build-linux-amd64 build-linux-arm64 build-linux-arm build-linux-ppc64 build-linux-ppc64le
build-linux: build-linux-amd64 build-linux-arm64

.PHONY: build-darwin
build-darwin: build-darwin-amd64 build-darwin-arm64
Expand Down
2 changes: 1 addition & 1 deletion buildscripts/download-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ curl -fL -o "$DOWNLOAD_DIR/opentelemetry-java-contrib-jmx-metrics.jar" \
# download contrib repo and manually build supervisor repos
echo "Cloning supervisor repo"
SUPERVISOR_REPO="https://github.com/open-telemetry/opentelemetry-collector-contrib.git"
PLATFORMS=("linux/amd64" "linux/arm64" "linux/arm" "linux/ppc64" "linux/ppc64le" "darwin/amd64" "darwin/arm64" "windows/amd64")
PLATFORMS=("linux/amd64" "darwin/arm64")

mkdir "$DOWNLOAD_DIR/supervisor_bin"
$(cd $DOWNLOAD_DIR && git clone --depth 1 "$SUPERVISOR_REPO")
Expand Down

0 comments on commit 13a039a

Please sign in to comment.