Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add Github action to build provider #64

Merged
merged 1 commit into from
Nov 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Build TF Provider

on: [push]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: 1.21.3
- name: Install C toolchain
run: |
sudo apt-get update
sudo apt install -y gcc-x86-64-linux-gnu
mkdir bin
- name: Cache Binaries
uses: actions/cache@v2
env:
cache-name: cache-binaries
with:
path: bin
key: ${{ github.sha }}
restore-keys: ${{ github.sha }}
- name: Build Linux binary with Boringcrypto
run: |
CC=x86_64-linux-gnu-gcc CGO_ENABLED=1 GOARCH=amd64 GOOS=linux GOEXPERIMENT=boringcrypto \
go build -o bin/terraform-provider-azurerm.linux.amd64 .
- name: Verify Boringcrypto
run: |
go run rsc.io/goversion@master -crypto bin/terraform-provider-azurerm.linux.amd64 | grep -q '(boring crypto)'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we 100% sure this certifies the crypto as boring? We've been burned here before... if we're sure, no worries, otherwise let's bust out our trusty go tool nm

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've had a look at the implementation and it's a very similar check to the go tool nm we had before: https://github.com/rsc/goversion/blob/3a30cee7003ec5dc0903682e79b3059c8e101952/version/read.go#L60

But that implementation looks more solid & thorough than the go tool & grep chain 😄

# boringcrypto isn't available for darwin, so we can also disable CGO.
- name: Build Darwin binary without Boringcrypto
run: |
CGO_ENABLED=0 GOARCH=arm64 GOOS=darwin \
go build -o bin/terraform-provider-azurerm.darwin.arm64 .
release:
runs-on: ubuntu-latest
needs: build
if: github.ref == 'refs/heads/main'
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Cache Binaries
uses: actions/cache@v2
env:
cache-name: cache-binaries
with:
path: bin
key: ${{ github.sha }}
restore-keys: ${{ github.sha }}
- name: Create Release
uses: ncipollo/release-action@v1
with:
tag: ${{ github.sha }}
artifacts: bin/terraform-provider-azurerm.*.*
makeLatest: true
Loading