forked from ghostunnel/ghostunnel
-
Notifications
You must be signed in to change notification settings - Fork 0
140 lines (134 loc) · 3.77 KB
/
compile.yml
File metadata and controls
140 lines (134 loc) · 3.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
---
name: Compile
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
permissions:
contents: read
jobs:
build-docker:
name: Build (Docker)
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Set up buildx command
id: buildx
uses: docker/setup-buildx-action@v3
with:
install: true
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: '1.26.x'
- name: Build containers
run: go tool mage -v docker:build
env:
GITHUB_REF: ${{ github.ref }}
build-linux:
name: Build (Linux)
strategy:
matrix:
version: [1.26.x]
os: [ubuntu-22.04, ubuntu-24.04]
runs-on: ${{ matrix.os }}
steps:
- name: Set up cross toolchain
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu
- name: Set up toolchain
uses: actions/setup-go@v6
with:
go-version: ${{ matrix.version }}
id: go
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 100
fetch-tags: true
- name: Build binary
run: |
go tool mage -compile ./mage-bin
CGO_ENABLED=1 GOARCH=amd64 ./mage-bin -v go:build
mv ghostunnel ghostunnel-linux-amd64
CGO_ENABLED=1 GOARCH=arm64 CC=aarch64-linux-gnu-gcc ./mage-bin -v go:build
mv ghostunnel ghostunnel-linux-arm64
- name: Upload artifact
uses: actions/upload-artifact@v7
with:
name: ghostunnel-linux-amd64-${{ matrix.os }}
path: ghostunnel-linux-amd64
- name: Upload artifact
uses: actions/upload-artifact@v7
with:
name: ghostunnel-linux-arm64-${{ matrix.os }}
path: ghostunnel-linux-arm64
build-darwin:
name: Build (MacOS)
strategy:
matrix:
version: [1.26.x]
runs-on: macos-latest
steps:
- name: Set up toolchain
uses: actions/setup-go@v6
with:
go-version: ${{ matrix.version }}
id: go
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 100
fetch-tags: true
- name: Build binary
run: |
go tool mage -compile ./mage-bin
CGO_ENABLED=1 GOARCH=amd64 ./mage-bin -v go:build
mv ghostunnel ghostunnel-darwin-amd64
CGO_ENABLED=1 GOARCH=arm64 ./mage-bin -v go:build
mv ghostunnel ghostunnel-darwin-arm64
lipo -create -output ghostunnel-darwin-universal ghostunnel-darwin-amd64 ghostunnel-darwin-arm64
- name: Upload artifact
uses: actions/upload-artifact@v7
with:
name: ghostunnel-darwin-amd64
path: ghostunnel-darwin-amd64
- name: Upload artifact
uses: actions/upload-artifact@v7
with:
name: ghostunnel-darwin-arm64
path: ghostunnel-darwin-arm64
- name: Upload artifact
uses: actions/upload-artifact@v7
with:
name: ghostunnel-darwin-universal
path: ghostunnel-darwin-universal
build-windows:
name: Build (Windows)
strategy:
matrix:
version: [1.26.x]
runs-on: windows-latest
steps:
- name: Set up toolchain
uses: actions/setup-go@v6
with:
go-version: ${{ matrix.version }}
id: go
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 100
fetch-tags: true
- name: Build binary
run: go tool mage -v go:build
- name: Upload artifact
uses: actions/upload-artifact@v7
with:
name: ghostunnel-windows-amd64
path: ghostunnel