1+ name : Build Binaries
2+
3+ on :
4+ workflow_call :
5+ inputs :
6+ tag_name :
7+ description : " Tag name for release builds"
8+ required : false
9+ type : string
10+ is_release :
11+ description : " Whether this is a release build"
12+ required : true
13+ type : boolean
14+ default : false
15+ outputs :
16+ linux_x86_64 :
17+ description : " Linux x86_64 binary path"
18+ value : ${{ jobs.build.outputs.linux_x86_64 }}
19+ linux_arm64 :
20+ description : " Linux ARM64 binary path"
21+ value : ${{ jobs.build.outputs.linux_arm64 }}
22+ macos_x86_64 :
23+ description : " macOS x86_64 binary path"
24+ value : ${{ jobs.build.outputs.macos_x86_64 }}
25+ macos_arm64 :
26+ description : " macOS ARM64 binary path"
27+ value : ${{ jobs.build.outputs.macos_arm64 }}
28+ windows_x86_64 :
29+ description : " Windows x86_64 binary path"
30+ value : ${{ jobs.build.outputs.windows_x86_64 }}
31+
32+ jobs :
33+ build :
34+ name : Build
35+ runs-on : ${{ matrix.os }}
36+ outputs :
37+ linux_x86_64 : ${{ steps.build.outputs.linux_x86_64 }}
38+ linux_arm64 : ${{ steps.build.outputs.linux_arm64 }}
39+ macos_x86_64 : ${{ steps.build.outputs.macos_x86_64 }}
40+ macos_arm64 : ${{ steps.build.outputs.macos_arm64 }}
41+ windows_x86_64 : ${{ steps.build.outputs.windows_x86_64 }}
42+ strategy :
43+ matrix :
44+ include :
45+ - name : linux
46+ os : ubuntu-22.04 # Use oldest supported non-deprecated version so we link against older glibc version which allows running binary on a wider set of Linux systems
47+ path : target/x86_64-unknown-linux-gnu/release/function-runner
48+ asset_name : function-runner-x86_64-linux-${{ inputs.is_release && (inputs.tag_name || github.event.release.tag_name) || 'test' }}
49+ shasum_cmd : sha256sum
50+ target : x86_64-unknown-linux-gnu
51+ output_var : linux_x86_64
52+ - name : linux-arm64
53+ os : ubuntu-22.04 # Use oldest supported non-deprecated version so we link against older glibc version which allows running binary on a wider set of Linux systems
54+ path : target/aarch64-unknown-linux-gnu/release/function-runner
55+ asset_name : function-runner-arm-linux-${{ inputs.is_release && (inputs.tag_name || github.event.release.tag_name) || 'test' }}
56+ shasum_cmd : sha256sum
57+ target : aarch64-unknown-linux-gnu
58+ output_var : linux_arm64
59+ - name : macos
60+ os : macos-latest
61+ path : target/x86_64-apple-darwin/release/function-runner
62+ asset_name : function-runner-x86_64-macos-${{ inputs.is_release && (inputs.tag_name || github.event.release.tag_name) || 'test' }}
63+ shasum_cmd : shasum -a 256
64+ target : x86_64-apple-darwin
65+ output_var : macos_x86_64
66+ - name : arm64-macos
67+ os : macos-latest
68+ path : target/aarch64-apple-darwin/release/function-runner
69+ asset_name : function-runner-arm-macos-${{ inputs.is_release && (inputs.tag_name || github.event.release.tag_name) || 'test' }}
70+ shasum_cmd : shasum -a 256
71+ target : aarch64-apple-darwin
72+ output_var : macos_arm64
73+ - name : windows
74+ os : windows-latest
75+ path : target\x86_64-pc-windows-msvc\release\function-runner.exe
76+ asset_name : function-runner-x86_64-windows-${{ inputs.is_release && (inputs.tag_name || github.event.release.tag_name) || 'test' }}
77+ shasum_cmd : sha256sum
78+ target : x86_64-pc-windows-msvc
79+ output_var : windows_x86_64
80+
81+ steps :
82+ - uses : actions/checkout@v4
83+
84+ - name : Install cross compiler
85+ if : ${{ matrix.target == 'aarch64-unknown-linux-gnu' }}
86+ run : |
87+ sudo apt-get update
88+ sudo apt-get install -y gcc-aarch64-linux-gnu
89+
90+ - name : Set up cross compiler env variables
91+ if : ${{ matrix.target == 'aarch64-unknown-linux-gnu' }}
92+ run : |
93+ echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
94+ echo "CC_aarch64_unknown_linux_gnu=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
95+ echo "CXX_aarch64_unknown_linux_gnu=aarch64-linux-gnu-g++" >> $GITHUB_ENV
96+
97+ # Should no-op except for macos-arm case where that target won't be installed
98+ - name : Install target
99+ run : rustup target add ${{ matrix.target }}
100+
101+ - name : Build ${{ matrix.target }}
102+ id : build
103+ run : |
104+ cargo build --release --target ${{ matrix.target }} --package function-runner
105+ echo "${{ matrix.output_var }}=${{ matrix.path }}" >> $GITHUB_OUTPUT
0 commit comments