From 85d2500e7bd09d32cf71fe8f3e554c78da0a3dd6 Mon Sep 17 00:00:00 2001 From: Sam DeHaan Date: Fri, 28 Feb 2025 16:40:15 -0500 Subject: [PATCH 1/6] Build non-windows in templated action --- .github/workflows/build.yml | 128 +++++++++++++----------------------- 1 file changed, 46 insertions(+), 82 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 30cb3b013a..fa6adfca5a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,14 +8,53 @@ concurrency: group: "${{ github.ref_name }}-${{ github.head_ref }}" cancel-in-progress: true jobs: - build_linux: - name: Build on Linux - runs-on: ubuntu-latest - container: grafana/alloy-build-image:v0.1.8 + build: strategy: matrix: - os: [linux] - arch: [amd64, arm64, ppc64le, s390x] + build: + - os: linux + arch: amd64 + go_tags: "builtinassets promtail_journal_enabled" + runs_on: ubuntu-latest + - os: linux + arch: arm64 + go_tags: "builtinassets promtail_journal_enabled" + runs_on: ubuntu-latest + - os: linux + arch: ppc64le + go_tags: "builtinassets promtail_journal_enabled" + runs_on: ubuntu-latest + - os: linux + arch: s390x + go_tags: "builtinassets promtail_journal_enabled" + runs_on: ubuntu-latest + - os: linux + arch: amd64 + go_tags: "builtinassets promtail_journal_enabled" + runs_on: ubuntu-latest + go_experiment: "GOEXPERIMENT=boringcrypto" + suffix: "-boringcrypto" + - os: linux + arch: arm64 + go_tags: "builtinassets promtail_journal_enabled" + runs_on: ubuntu-latest + go_experiment: "GOEXPERIMENT=boringcrypto" + suffix: "-boringcrypto" + - os: darwin + arch: amd64 + go_tags: "builtinassets" + runs_on: macos-14-large + - os: darwin + arch: arm64 + go_tags: "builtinassets" + runs_on: macos-14-xlarge + - os: freebsd + arch: amd64 + go_tags: "builtinassets" + runs_on: ubuntu-latest + name: Build on ${{ matrix.build.os }}${{ matrix.build.suffix}} (${{ matrix.build.arch }}) + runs-on: ${{ matrix.build.runs-on }} + container: grafana/alloy-build-image:v0.1.8{{ matrix.build.suffix }} steps: - name: Checkout code uses: actions/checkout@v4 @@ -31,62 +70,7 @@ jobs: # TODO: Try enabling caching later. It might use up too much disk space on runners so needs extra testing. cache: false - run: make generate-ui - - run: GO_TAGS="builtinassets promtail_journal_enabled" GOOS=${{ matrix.os }} GOARCH=${{ matrix.arch }} GOARM= make alloy - - build_linux_boringcrypto: - name: Build on Linux (boringcrypto) - runs-on: ubuntu-latest - container: grafana/alloy-build-image:v0.1.8-boringcrypto - strategy: - matrix: - os: [linux] - arch: [amd64, arm64] - steps: - - name: Checkout code - uses: actions/checkout@v4 - - name: Set ownership - # https://github.com/actions/runner/issues/2033#issuecomment-1204205989 - run: | - # this is to fix GIT not liking owner of the checkout dir - chown -R $(id -u):$(id -g) $PWD - - name: Set up Go - uses: actions/setup-go@v5 - with: - go-version-file: go.mod - # TODO: Try enabling caching later. It might use up too much disk space on runners so needs extra testing. - cache: false - - run: make generate-ui - - run: GO_TAGS="builtinassets promtail_journal_enabled" GOOS=${{ matrix.os }} GOARCH=${{ matrix.arch }} GOARM= GOEXPERIMENT=boringcrypto make alloy - - build_mac_intel: - name: Build on MacOS (Intel) - runs-on: macos-14-large - steps: - - name: Checkout code - uses: actions/checkout@v4 - - name: Set up Go - uses: actions/setup-go@v5 - with: - go-version-file: go.mod - # TODO: Try enabling caching later. It might use up too much disk space on runners so needs extra testing. - cache: false - - run: make generate-ui - - run: GO_TAGS="builtinassets" GOOS=darwin GOARCH=amd64 GOARM= make alloy - - build_mac_arm: - name: Build on MacOS (ARM) - runs-on: macos-14-xlarge - steps: - - name: Checkout code - uses: actions/checkout@v4 - - name: Set up Go - uses: actions/setup-go@v5 - with: - go-version-file: go.mod - # TODO: Try enabling caching later. It might use up too much disk space on runners so needs extra testing. - cache: false - - run: make generate-ui - - run: GO_TAGS="builtinassets" GOOS=darwin GOARCH=arm64 GOARM= make alloy + - run: GO_TAGS="${{ matrix.build.go_tags}}" GOOS=${{ matrix.build.os }} GOARCH=${{ matrix.build.arch }} GOARM= $${{ matrix.build.go_experiment}} make alloy build_windows: name: Build on Windows (AMD64) @@ -106,23 +90,3 @@ jobs: - run: echo "GOARCH=amd64" | Out-File -FilePath $env:GITHUB_ENV -Append - run: make alloy - build_freebsd: - name: Build on FreeBSD (AMD64) - runs-on: ubuntu-latest - container: grafana/alloy-build-image:v0.1.8 - steps: - - name: Checkout code - uses: actions/checkout@v4 - - name: Set ownership - # https://github.com/actions/runner/issues/2033#issuecomment-1204205989 - run: | - # this is to fix GIT not liking owner of the checkout dir - chown -R $(id -u):$(id -g) $PWD - - name: Set up Go - uses: actions/setup-go@v5 - with: - go-version-file: go.mod - # TODO: Try enabling caching later. It might use up too much disk space on runners so needs extra testing. - cache: false - - run: make generate-ui - - run: GO_TAGS="builtinassets" GOOS=freebsd GOARCH=amd64 GOARM= make alloy From 131860d4d9452da3f770e326c75f8d811babd115 Mon Sep 17 00:00:00 2001 From: Sam DeHaan Date: Fri, 28 Feb 2025 16:46:06 -0500 Subject: [PATCH 2/6] Don't use github action matrix in name --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fa6adfca5a..e7a9226d06 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -52,7 +52,7 @@ jobs: arch: amd64 go_tags: "builtinassets" runs_on: ubuntu-latest - name: Build on ${{ matrix.build.os }}${{ matrix.build.suffix}} (${{ matrix.build.arch }}) + name: Build runs-on: ${{ matrix.build.runs-on }} container: grafana/alloy-build-image:v0.1.8{{ matrix.build.suffix }} steps: From b536c62fbb9c91a64122c8697f9ec4d4db7c068e Mon Sep 17 00:00:00 2001 From: Sam DeHaan Date: Fri, 28 Feb 2025 16:47:34 -0500 Subject: [PATCH 3/6] Fix container reference --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e7a9226d06..6ec75be3f8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -54,7 +54,7 @@ jobs: runs_on: ubuntu-latest name: Build runs-on: ${{ matrix.build.runs-on }} - container: grafana/alloy-build-image:v0.1.8{{ matrix.build.suffix }} + container: grafana/alloy-build-image:v0.1.8${{ matrix.build.suffix }} steps: - name: Checkout code uses: actions/checkout@v4 From f222fbf2de5d1a331268b636811b5a920d887c1e Mon Sep 17 00:00:00 2001 From: Sam DeHaan Date: Fri, 28 Feb 2025 16:48:53 -0500 Subject: [PATCH 4/6] Fix reference to runs_on --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6ec75be3f8..ef6f033b23 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -53,7 +53,7 @@ jobs: go_tags: "builtinassets" runs_on: ubuntu-latest name: Build - runs-on: ${{ matrix.build.runs-on }} + runs-on: ${{ matrix.build.runs_on }} container: grafana/alloy-build-image:v0.1.8${{ matrix.build.suffix }} steps: - name: Checkout code From 67850bf7c7e7c4212b42560619e6cc1d30c8bd72 Mon Sep 17 00:00:00 2001 From: Sam DeHaan Date: Fri, 28 Feb 2025 16:55:19 -0500 Subject: [PATCH 5/6] Refactor osx builds out of matrix --- .github/workflows/build.yml | 39 ++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ef6f033b23..a7ee2eb3ae 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,45 +15,30 @@ jobs: - os: linux arch: amd64 go_tags: "builtinassets promtail_journal_enabled" - runs_on: ubuntu-latest - os: linux arch: arm64 go_tags: "builtinassets promtail_journal_enabled" - runs_on: ubuntu-latest - os: linux arch: ppc64le go_tags: "builtinassets promtail_journal_enabled" - runs_on: ubuntu-latest - os: linux arch: s390x go_tags: "builtinassets promtail_journal_enabled" - runs_on: ubuntu-latest - os: linux arch: amd64 go_tags: "builtinassets promtail_journal_enabled" - runs_on: ubuntu-latest go_experiment: "GOEXPERIMENT=boringcrypto" suffix: "-boringcrypto" - os: linux arch: arm64 go_tags: "builtinassets promtail_journal_enabled" - runs_on: ubuntu-latest go_experiment: "GOEXPERIMENT=boringcrypto" suffix: "-boringcrypto" - - os: darwin - arch: amd64 - go_tags: "builtinassets" - runs_on: macos-14-large - - os: darwin - arch: arm64 - go_tags: "builtinassets" - runs_on: macos-14-xlarge - os: freebsd arch: amd64 go_tags: "builtinassets" - runs_on: ubuntu-latest name: Build - runs-on: ${{ matrix.build.runs_on }} + runs-on: ubuntu-latest container: grafana/alloy-build-image:v0.1.8${{ matrix.build.suffix }} steps: - name: Checkout code @@ -72,6 +57,28 @@ jobs: - run: make generate-ui - run: GO_TAGS="${{ matrix.build.go_tags}}" GOOS=${{ matrix.build.os }} GOARCH=${{ matrix.build.arch }} GOARM= $${{ matrix.build.go_experiment}} make alloy + build_mac_intel: + strategy: + matrix: + build: + - arch: amd64 + runs_on: macos-14-large + - arch: arm64 + runs_on: macos-14-xlarge + name: Build on MacOS + runs-on: ${{ matrix.build.runs_on }} + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version-file: go.mod + # TODO: Try enabling caching later. It might use up too much disk space on runners so needs extra testing. + cache: false + - run: make generate-ui + - run: GO_TAGS="builtinassets" GOOS=darwin GOARCH=${{ matrix.build.arch}} GOARM= make alloy + build_windows: name: Build on Windows (AMD64) runs-on: windows-latest From a6657cea2059cdcd82e6aac59a39ce55666c9051 Mon Sep 17 00:00:00 2001 From: Sam DeHaan Date: Fri, 28 Feb 2025 16:59:40 -0500 Subject: [PATCH 6/6] remove extra character --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a7ee2eb3ae..4f068779de 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -55,7 +55,7 @@ jobs: # TODO: Try enabling caching later. It might use up too much disk space on runners so needs extra testing. cache: false - run: make generate-ui - - run: GO_TAGS="${{ matrix.build.go_tags}}" GOOS=${{ matrix.build.os }} GOARCH=${{ matrix.build.arch }} GOARM= $${{ matrix.build.go_experiment}} make alloy + - run: GO_TAGS="${{ matrix.build.go_tags}}" GOOS=${{ matrix.build.os }} GOARCH=${{ matrix.build.arch }} GOARM= ${{ matrix.build.go_experiment}} make alloy build_mac_intel: strategy: