ci: use correct build-distros workflow (#16757)

Signed-off-by: Dan Bond <danbond@protonmail.com>
pull/16770/head
Dan Bond 2023-03-23 16:40:48 -07:00 committed by GitHub
parent 9d636aa816
commit d06ede9daf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 46 additions and 14 deletions

View File

@ -1,17 +1,32 @@
# NOTE: this workflow builds Consul binaries on multiple architectures for PRs.
# It is aimed at checking new commits don't introduce any breaking build changes.
name: build-distros
on:
pull_request:
branches: ["main"]
push:
branches: ["main"]
tags: ["*"]
on: [pull_request]
permissions:
contents: read
jobs:
check-go-mod:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # pin@v3.3.0
- uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # pin@v3.5.0
with:
go-version-file: 'go.mod'
- run: go mod tidy
- run: |
if [[ -n $(git status -s) ]]; then
echo "Git directory has changes"
git status -s
exit 1
fi
build-386:
strategy:
matrix:
os: ['freebsd', 'linux', 'windows']
needs: check-go-mod
env:
XC_OS: "freebsd linux windows"
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # pin@v3.3.0
@ -19,12 +34,15 @@ jobs:
with:
go-version-file: 'go.mod'
- name: Build
run: GOOS=${{ matrix.os }} GOARCH=386 CGO_ENABLED=0 go build
run: |
for os in $XC_OS; do
GOOS="$os" GOARCH=386 CGO_ENABLED=0 go build
done
build-amd64:
strategy:
matrix:
os: ['darwin', 'freebsd', 'linux', 'solaris', 'windows']
needs: check-go-mod
env:
XC_OS: "darwin freebsd linux solaris windows"
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # pin@v3.3.0
@ -32,12 +50,26 @@ jobs:
with:
go-version-file: 'go.mod'
- name: Build
run: GOOS=${{ matrix.os }} GOARCH=amd64 CGO_ENABLED=0 go build
run: |
for os in $XC_OS; do
GOOS="$os" GOARCH=amd64 CGO_ENABLED=0 go build
done
build-arm:
needs: check-go-mod
runs-on: ubuntu-22.04
env:
CGO_ENABLED: 1
GOOS: linux
steps:
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # pin@v3.3.0
- uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # pin@v3.5.0
with:
go-version-file: 'go.mod'
- run: |
sudo rm -fv /etc/apt/sources.list.d/github_git-lfs.list # workaround for https://github.com/actions/runner-images/issues/1983
sudo apt-get update --allow-releaseinfo-change-suite --allow-releaseinfo-change-version && sudo apt-get install -y gcc-arm-linux-gnueabi gcc-arm-linux-gnueabihf gcc-aarch64-linux-gnu
- run: CC=arm-linux-gnueabi-gcc GOARCH=arm GOARM=5 go build
- run: CC=arm-linux-gnueabihf-gcc GOARCH=arm GOARM=6 go build
- run: CC=aarch64-linux-gnu-gcc GOARCH=arm64 go build