8
8
9
9
jobs :
10
10
build :
11
- runs-on : ubuntu-latest
12
11
strategy :
13
12
fail-fast : false
14
13
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 }}
40
22
steps :
41
23
- name : Checkout code
42
24
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
47
25
with :
48
- go-version : ${{ matrix.go-version }}
26
+ fetch-depth : 0
49
27
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
52
31
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
+
53
45
- name : Build Juno
54
46
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
58
58
fi
59
59
60
60
- name : Upload Artifact
61
61
uses : actions/upload-artifact@v3
62
62
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