Skip to content

chore: support building Coder Desktop .dylib - #15512

Merged
ethanndickson merged 2 commits into
mainfrom
ethan/build-dylib
Nov 20, 2024
Merged

ethanndickson merged 2 commits into
mainfrom
ethan/build-dylib

Conversation

@ethanndickson

@ethanndickson ethanndickson commented Nov 14, 2024 •

Copy link
Copy Markdown
Member

Relates to #14734.

  • Adds make/coder-dylib to build the Coder Desktop .dylib for both amd64 and arm64.

  • Adds a build-dylib CI job that builds the dylibs on a macOS runner, signs them, uploads them and the header file as a build artifact, and then downloads them and inserts them into the fat binary build during the regular build CI job (which uses an ubuntu runner).

  • Makes the dylibs and the accompanying header file available for download from /bin on a Coder deployment.

  • Adds a build-dylib to release.yaml. release now downloads and embeds these dylibs in it's builds.

  • Minor fixes to get release dry-runs working again.

$ codesign -dvv coder-vpn-darwin-amd64.dylib
[...]
Identifier=com.coder.vpn
Authority=Developer ID Application: Coder Technologies Inc (4399GN35BJ)

/bin:

coder-darwin-amd64
coder-darwin-arm64
coder-vpn-darwin-amd64.dylib
coder-vpn-darwin-arm64.dylib
coder-vpn-darwin-dylib.h
coder-linux-amd64
coder-linux-arm64
coder-linux-armv7
coder-windows-amd64.exe
coder-windows-arm64.exe

Latest passing ci run: https://github.com/coder/coder/actions/runs/11885370889/
build-dylib artifact: https://github.com/coder/coder/actions/runs/11885370889/artifacts/2199477618
Full build artifact: https://github.com/coder/coder/actions/runs/11885370889/artifacts/2199489548

Latest passing release dry-run: https://github.com/coder/coder/actions/runs/11885373782
release build artifact: https://github.com/coder/coder/actions/runs/11885373782/artifacts/2199494843

The C interface for the dylib is currently just:
int OpenTunnel(cReadFD int, cWriteFD int)

ethanndickson commented Nov 14, 2024 •

Copy link
Copy Markdown
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@deansheather

Copy link
Copy Markdown
Collaborator

Can we call the artifacts codervpn-darwin-arch.ext instead?

@ethanndickson

ethanndickson commented Nov 15, 2024 •

Copy link
Copy Markdown
Member Author

Yeah the naming is kinda tricky, how does coder-{desktop|vpn}-darwin-arch.ext sound? We have a bunch of code for embedding the binaries (hashing, tarring) that relies on the files starting with coder-, and I don't really want to touch that needlessly.

Also, the darwin part is kinda implicit, given that we're only exporting a dylib. I guess if we ever added a linux .so, it might use a different header file?

Comment thread .github/workflows/ci.yaml Resolved
Comment thread vpn/dylib/lib.go Resolved
Comment thread vpn/dylib/lib.go Resolved
Comment thread scripts/sign_darwin.sh Resolved
Comment thread scripts/build_go.sh Resolved
Comment thread scripts/build_go.sh Resolved
Comment thread Makefile Resolved
@deansheather

Copy link
Copy Markdown
Collaborator

We have a bunch of code for embedding the binaries (hashing, tarring) that relies on the files starting with coder-

Yeah OK that sounds good to me then.

Also, the darwin part is kinda implicit, given that we're only exporting a dylib

I'd rather keep the standard anyways. The windows binaries can easily be told apart too because of the .exe but we don't drop windows from the name.

@ethanndickson
ethanndickson marked this pull request as ready for review November 18, 2024 04:26

@spikecurtis spikecurtis left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

One nit inline. LGTM

Comment thread vpn/dylib/lib.go Resolved
Comment thread .github/workflows/ci.yaml Resolved
Comment thread Makefile Resolved
Comment thread vpn/dylib/lib.go Resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants