This repository has been archived by the owner on Apr 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
171 lines (136 loc) · 4.3 KB
/
go.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
160
161
162
163
164
165
166
167
168
169
170
171
name: Merge Checks
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
test:
name: Test
runs-on: ubuntu-20.04
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.17
- name: Check out code into the Go module directory
uses: actions/[email protected]
- name: Run tests
run: go test -v ./...
buildLinux:
name: Build Linux
runs-on: ubuntu-20.04
needs:
- test
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.17
- name: Check out code into the Go module directory
uses: actions/[email protected]
- name: Get dependencies
run: |
go mod tidy
- name: Build Linux x64
run: GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o build/hermes_linux_amd64 github.com/c16a/hermes/app
- name: Store Linux x64 artifacts
uses: actions/upload-artifact@v2
with:
name: hermes_linux_amd64
path: build/hermes_linux_amd64
- name: Build Linux ARM 64-bit
run: GOOS=linux GOARCH=arm64 go build -ldflags="-s -w" -o build/hermes_linux_arm64 github.com/c16a/hermes/app
- name: Store Linux ARM 64-bit artifacts
uses: actions/upload-artifact@v2
with:
name: hermes_linux_arm64
path: build/hermes_linux_arm64
- name: Build Linux OpenPOWER 64-bit
run: GOOS=linux GOARCH=ppc64le go build -ldflags="-s -w" -o build/hermes_linux_ppc64le github.com/c16a/hermes/app
- name: Store Linux OpenPOWER 64-bit artifacts
uses: actions/upload-artifact@v2
with:
name: hermes_linux_ppc64le
path: build/hermes_linux_ppc64le
buildWindows:
name: Build Windows
runs-on: ubuntu-20.04
needs:
- test
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.17
- name: Check out code into the Go module directory
uses: actions/[email protected]
- name: Get dependencies
run: |
go mod tidy
- name: Build Windows x64
run: GOOS=windows GOARCH=amd64 go build -ldflags="-s -w" -o build/hermes_windows_amd64.exe github.com/c16a/hermes/app
- name: Store Windows x64 artifacts
uses: actions/upload-artifact@v2
with:
name: hermes_windows_amd64.exe
path: build/hermes_windows_amd64.exe
buildMac:
name: Build macOS
runs-on: ubuntu-20.04
needs:
- test
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.17
- name: Check out code into the Go module directory
uses: actions/[email protected]
- name: Get dependencies
run: |
go mod tidy
- name: Build macOS Intel x64
run: GOOS=darwin GOARCH=amd64 go build -ldflags="-s -w" -o build/hermes_mac_amd64 github.com/c16a/hermes/app
- name: Store macOS Intel x64 artifacts
uses: actions/upload-artifact@v2
with:
name: hermes_mac_amd64
path: build/hermes_mac_amd64
- name: Build macOS Apple Silicon
run: GOOS=darwin GOARCH=arm64 go build -ldflags="-s -w" -o build/hermes_mac_arm64 github.com/c16a/hermes/app
- name: Store macOS Apple Silicon artifacts
uses: actions/upload-artifact@v2
with:
name: hermes_mac_arm64
path: build/hermes_mac_arm64
docker:
name: Build Image
runs-on: ubuntu-20.04
needs:
- test
- buildLinux
- buildWindows
- buildMac
steps:
- name: Check out code
uses: actions/[email protected]
- name: Setup buildx
uses: docker/[email protected]
- name: Login to GitHub Container Registry
uses: docker/[email protected]
with:
registry: ghcr.io
username: $GITHUB_ACTOR
password: ${{ secrets.CR_PAT }}
- name: Build and push
uses: docker/[email protected]
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
username: $GITHUB_ACTOR
password: ${{ secrets.CR_PAT }}
push: false
tags: |
ghcr.io/c16a/hermes/hermes:latest