-
Notifications
You must be signed in to change notification settings - Fork 6
159 lines (155 loc) · 4.88 KB
/
build.yml
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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
name: go-core build
on: push
jobs:
build-windows:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: 1.23
- name: Setup MSYS
uses: msys2/setup-msys2@v2
with:
msystem: mingw64
update: true
install: >
git
base-devel
autoconf-wrapper
autoconf
automake
libtool
mingw-w64-x86_64-toolchain
mingw-w64-x86_64-go
- name: Build Windows
run: |
make gocore
make test
- name: Upload Gocore
if: startsWith(github.ref, 'refs/tags/v')
uses: actions/upload-artifact@v3
with:
name: gocore-windows-x86_64
path: ./build/bin/gocore*
build-mac:
runs-on: ${{ matrix.config.os }}
strategy:
matrix:
config:
- {os: macos-13, path: darwin-x86_64}
- {os: macos-latest, path: darwin-arm64}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: 1.23
- name: Build & Test
run: |
make gocore
make test
- name: Upload Gocore
if: startsWith(github.ref, 'refs/tags/v')
uses: actions/upload-artifact@v3
with:
name: gocore-${{ matrix.config.path }}
path: ./build/bin/gocore*
build-alpine:
strategy:
matrix:
config:
- {arch: x86_64, branch: latest-stable}
- {arch: aarch64, branch: latest-stable}
- {arch: riscv64, branch: edge}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Alpine Linux
uses: jirutka/setup-alpine@v1
with:
arch: ${{ matrix.config.arch }}
branch: ${{ matrix.config.branch }}
- name: Install deps
shell: alpine.sh --root {0}
run: apk add git cmake gcc g++ make go
- name: Build & Test
run: |
make gocore
make test
- name: Upload Gocore
if: startsWith(github.ref, 'refs/tags/v')
uses: actions/upload-artifact@v3
with:
name: gocore-linux-${{ matrix.config.arch }}
path: ./build/bin/gocore*
release:
if: startsWith(github.ref, 'refs/tags/v')
needs: [build-windows, build-mac, build-alpine]
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Version
id: version
run: echo ::set-output name=tag::$(echo ${GITHUB_REF:10})
- name: Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.version.outputs.tag }}
release_name: ${{ steps.version.outputs.tag }} gocore release
draft: false
prerelease: true
artifacts:
needs: release
runs-on: ubuntu-latest
strategy:
matrix:
platform: [
{path: linux-x86_64, file_ext: ""},
{path: windows-x86_64, file_ext: ".exe"},
{path: linux-aarch64, file_ext: ""},
{path: linux-riscv64, file_ext: ""},
{path: darwin-x86_64, file_ext: ""},
{path: darwin-arm64, file_ext: ""},
]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Artifact Gocore
uses: actions/download-artifact@v2
with:
name: gocore-${{ matrix.platform.path}}
path: ./gocore-${{ matrix.platform.path }}
- name: Upload Gocore release assets
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.upload_url }}
asset_path: ./gocore-${{ matrix.platform.path }}/gocore${{matrix.platform.file_ext}}
asset_name: gocore-${{ matrix.platform.path }}${{matrix.platform.file_ext}}
asset_content_type: application/octet-stream
- name: Generate gocore checksums
working-directory: ./gocore-${{ matrix.platform.path }}
run: |
mv ./gocore${{matrix.platform.file_ext}} ./gocore-${{ matrix.platform.path }}${{matrix.platform.file_ext}}
sha256sum gocore-${{ matrix.platform.path }}${{matrix.platform.file_ext}} >gocore-${{ matrix.platform.path }}${{matrix.platform.file_ext}}.checksum
- name: Upload Gocore release assets checksums (Linux and Mac)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.upload_url }}
asset_path: ./gocore-${{ matrix.platform.path }}/gocore-${{ matrix.platform.path }}${{matrix.platform.file_ext}}.checksum
asset_name: gocore-${{ matrix.platform.path }}${{matrix.platform.file_ext}}.checksum
asset_content_type: text/plain