chore: Clean up and simplify some github actions #835
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: | |
pull_request: | |
concurrency: | |
# Cancel any running workflow for the same branch when new commits are pushed. | |
# We group both by ref_name (available when CI is triggered by a push to a branch/tag) | |
# and head_ref (available when CI is triggered by a PR). | |
group: "${{ github.ref_name }}-${{ github.head_ref }}" | |
cancel-in-progress: true | |
jobs: | |
build: | |
strategy: | |
matrix: | |
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 | |
- 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="${{ 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) | |
runs-on: windows-latest | |
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: echo "GO_TAGS=builtinassets" | Out-File -FilePath $env:GITHUB_ENV -Append | |
- run: echo "GOOS=windows" | Out-File -FilePath $env:GITHUB_ENV -Append | |
- run: echo "GOARCH=amd64" | Out-File -FilePath $env:GITHUB_ENV -Append | |
- run: make alloy | |