2023-03-21 17:37:32 +00:00
|
|
|
# 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]
|
|
|
|
|
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
|
|
|
|
jobs:
|
2023-03-28 21:29:27 +00:00
|
|
|
setup:
|
|
|
|
name: Setup
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
outputs:
|
|
|
|
compute-small: ${{ steps.setup-outputs.outputs.compute-small }}
|
|
|
|
compute-medium: ${{ steps.setup-outputs.outputs.compute-medium }}
|
|
|
|
compute-large: ${{ steps.setup-outputs.outputs.compute-large }}
|
|
|
|
compute-xl: ${{ steps.setup-outputs.outputs.compute-xl }}
|
2023-03-21 17:37:32 +00:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # pin@v3.3.0
|
2023-03-28 21:29:27 +00:00
|
|
|
- id: setup-outputs
|
|
|
|
name: Setup outputs
|
|
|
|
run: ./.github/scripts/get_runner_classes.sh
|
|
|
|
|
|
|
|
check-go-mod:
|
|
|
|
needs:
|
|
|
|
- setup
|
|
|
|
uses: ./.github/workflows/reusable-check-go-mod.yml
|
|
|
|
with:
|
|
|
|
runs-on: ${{ needs.setup.outputs.compute-medium }}
|
2023-03-30 16:57:11 +00:00
|
|
|
repository-name: ${{ github.repository }}
|
|
|
|
secrets:
|
|
|
|
elevated-github-token: ${{ secrets.ELEVATED_GITHUB_TOKEN }}
|
2023-03-21 17:37:32 +00:00
|
|
|
|
|
|
|
build-386:
|
2023-03-28 21:29:27 +00:00
|
|
|
needs:
|
|
|
|
- setup
|
|
|
|
- check-go-mod
|
2023-03-21 17:37:32 +00:00
|
|
|
env:
|
|
|
|
XC_OS: "freebsd linux windows"
|
2023-03-28 21:29:27 +00:00
|
|
|
runs-on: ${{ fromJSON(needs.setup.outputs.compute-medium) }}
|
2023-03-21 17:37:32 +00:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # pin@v3.3.0
|
2023-03-30 16:57:11 +00:00
|
|
|
|
|
|
|
# NOTE: This step is specifically needed for ENT. It allows us to access the required private HashiCorp repos.
|
|
|
|
- name: Setup Git
|
|
|
|
if: ${{ endsWith(github.repository, '-enterprise') }}
|
|
|
|
run: git config --global url."https://${{ secrets.ELEVATED_GITHUB_TOKEN }}:@github.com".insteadOf "https://github.com"
|
|
|
|
|
2023-03-21 17:37:32 +00:00
|
|
|
- uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # pin@v3.5.0
|
|
|
|
with:
|
|
|
|
go-version-file: 'go.mod'
|
|
|
|
- name: Build
|
|
|
|
run: |
|
|
|
|
for os in $XC_OS; do
|
|
|
|
GOOS="$os" GOARCH=386 CGO_ENABLED=0 go build
|
|
|
|
done
|
|
|
|
|
|
|
|
build-amd64:
|
2023-03-28 21:29:27 +00:00
|
|
|
needs:
|
|
|
|
- setup
|
|
|
|
- check-go-mod
|
2023-03-21 17:37:32 +00:00
|
|
|
env:
|
|
|
|
XC_OS: "darwin freebsd linux solaris windows"
|
2023-03-28 21:29:27 +00:00
|
|
|
runs-on: ${{ fromJSON(needs.setup.outputs.compute-medium) }}
|
2023-03-21 17:37:32 +00:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # pin@v3.3.0
|
2023-03-30 16:57:11 +00:00
|
|
|
|
|
|
|
# NOTE: This step is specifically needed for ENT. It allows us to access the required private HashiCorp repos.
|
|
|
|
- name: Setup Git
|
|
|
|
if: ${{ endsWith(github.repository, '-enterprise') }}
|
|
|
|
run: git config --global url."https://${{ secrets.ELEVATED_GITHUB_TOKEN }}:@github.com".insteadOf "https://github.com"
|
|
|
|
|
2023-03-21 17:37:32 +00:00
|
|
|
- uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # pin@v3.5.0
|
|
|
|
with:
|
|
|
|
go-version-file: 'go.mod'
|
|
|
|
- name: Build
|
|
|
|
run: |
|
|
|
|
for os in $XC_OS; do
|
|
|
|
GOOS="$os" GOARCH=amd64 CGO_ENABLED=0 go build
|
|
|
|
done
|
|
|
|
|
|
|
|
build-arm:
|
2023-03-28 21:29:27 +00:00
|
|
|
needs:
|
|
|
|
- setup
|
|
|
|
- check-go-mod
|
|
|
|
runs-on: ${{ fromJSON(needs.setup.outputs.compute-medium) }}
|
2023-03-21 17:37:32 +00:00
|
|
|
env:
|
|
|
|
CGO_ENABLED: 1
|
|
|
|
GOOS: linux
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # pin@v3.3.0
|
2023-03-30 16:57:11 +00:00
|
|
|
|
|
|
|
# NOTE: This step is specifically needed for ENT. It allows us to access the required private HashiCorp repos.
|
|
|
|
- name: Setup Git
|
|
|
|
if: ${{ endsWith(github.repository, '-enterprise') }}
|
|
|
|
run: git config --global url."https://${{ secrets.ELEVATED_GITHUB_TOKEN }}:@github.com".insteadOf "https://github.com"
|
|
|
|
|
|
|
|
|
2023-03-21 17:37:32 +00:00
|
|
|
- uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # pin@v3.5.0
|
|
|
|
with:
|
|
|
|
go-version-file: 'go.mod'
|
|
|
|
- run: |
|
|
|
|
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
|