Skip to content

Commit 977b8fa

Browse files
committed
Fix building binaries workflow (#1010)
1 parent d3062d2 commit 977b8fa

File tree

1 file changed

+46
-38
lines changed

1 file changed

+46
-38
lines changed

.github/workflows/build-binaries.yml

Lines changed: 46 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -8,57 +8,65 @@ on:
88

99
jobs:
1010
build:
11-
runs-on: ubuntu-latest
1211
strategy:
1312
fail-fast: false
1413
matrix:
15-
arch: [
16-
{
17-
'go' : 'amd64',
18-
'cc' : 'x86_64'
19-
},
20-
{
21-
'go': 'arm64',
22-
'cc': 'aarch64'
23-
}
24-
]
25-
os: [
26-
{
27-
'go' : 'linux',
28-
'cc' : 'linux'
29-
},
30-
{
31-
'go': 'darwin',
32-
'cc': 'macos'
33-
},
34-
{
35-
'go': 'windows',
36-
'cc': 'windows-gnu'
37-
}
38-
]
39-
go-version: ['1.20.3']
14+
include:
15+
- os: ubuntu-latest
16+
architecture: amd64
17+
- os: macOS-latest
18+
architecture: amd64
19+
- os: self-hosted
20+
architecture: arm64
21+
runs-on: ${{ matrix.os }}
4022
steps:
4123
- name: Checkout code
4224
uses: actions/checkout@v3
43-
- name: Install UPX
44-
run: sudo apt-get install -y upx-ucl
45-
- name: Install Go
46-
uses: actions/setup-go@v3
4725
with:
48-
go-version: ${{ matrix.go-version }}
26+
fetch-depth: 0
4927

50-
- name: Install C cross compiler
51-
uses: goto-bus-stop/setup-zig@v2
28+
- name: Get latest tag
29+
id: tag
30+
run: echo "TAG=$(git describe --tags)" >> $GITHUB_ENV
5231

32+
- name: Install dependencies (Ubuntu or self-hosted)
33+
if: runner.os == 'Linux'
34+
run: sudo apt-get update -qq && sudo apt-get install -y upx-ucl build-essential cargo git golang
35+
36+
- name: Install dependencies (macOS)
37+
if: runner.os == 'macOS'
38+
run: brew install upx cargo-c
39+
40+
- name: Set up Go
41+
uses: actions/setup-go@v4
42+
with:
43+
go-version: 1.20.3
44+
5345
- name: Build Juno
5446
run: |
55-
GOOS=${{ matrix.os['go'] }} GOARCH=${{ matrix.arch['go'] }} CGO_ENABLED=1 CC="zig cc -target ${{ matrix.arch['cc'] }}-${{ matrix.os['cc'] }}" make juno
56-
if [[ ${{ matrix.os }} == "linux" ]]; then
57-
upx build/juno
47+
make juno
48+
upx build/juno
49+
mv build/juno juno-${{ env.TAG }}-${{ runner.os }}-${{ matrix.architecture }}
50+
51+
- name: Generate Checksum
52+
id: checksum
53+
run: |
54+
if [[ "${{ runner.os }}" == "macOS" ]]; then
55+
shasum -a 256 juno-${{ env.TAG }}-${{ runner.os }}-${{ matrix.architecture }} > juno-${{ env.TAG }}-${{ runner.os }}-${{ matrix.architecture }}.sha256
56+
else
57+
sha256sum juno-${{ env.TAG }}-${{ runner.os }}-${{ matrix.architecture }} > juno-${{ env.TAG }}-${{ runner.os }}-${{ matrix.architecture }}.sha256
5858
fi
5959
6060
- name: Upload Artifact
6161
uses: actions/upload-artifact@v3
6262
with:
63-
name: juno-${{ matrix.os }}-${{ matrix.arch }}
64-
path: build/juno
63+
name: juno-${{ env.TAG }}-${{ runner.os }}-${{ matrix.architecture }}
64+
path: |
65+
juno-${{ env.TAG }}-${{ runner.os }}-${{ matrix.architecture }}
66+
juno-${{ env.TAG }}-${{ runner.os }}-${{ matrix.architecture }}.sha256
67+
68+
- name: Cleanup
69+
if: matrix.os == 'self-hosted'
70+
run: |
71+
rm juno-${{ env.TAG }}-${{ runner.os }}-${{ matrix.architecture }}
72+
rm juno-${{ env.TAG }}-${{ runner.os }}-${{ matrix.architecture }}.sha256

0 commit comments

Comments
 (0)