-
Notifications
You must be signed in to change notification settings - Fork 1
165 lines (149 loc) · 5.38 KB
/
deploy.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
# Copyright 2021 Jeremy Edwards
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: CI
on:
push:
tags: ["v*"]
branches: ["main"]
pull_request:
branches: ["main"]
jobs:
# Set the job key. The key is displayed as the job name
# when a job name is not provided
push-image:
name: Push Images
runs-on: ubuntu-latest
steps:
- name: Checkout code
# https://github.com/actions/checkout
uses: actions/checkout@v4
- name: Setup Go
# https://github.com/actions/setup-go
uses: actions/setup-go@v5
with:
go-version: "1.22"
- name: Install Prerequisites
run: |
sudo apt-get update
sudo apt -y -q install software-properties-common
sudo add-apt-repository universe
sudo apt-get update
sudo apt-get -y -q install lz4 p7zip-full rar unrar
- name: Prepare Build
run: |
make clean
make deps
make lint
- name: Test
run: |
make test-10
make benchmark
make coverage.txt
- name: Push Code Coverage
# https://github.com/codecov/codecov-action
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
files: ./coverage.txt # optional
flags: unittests # optional
name: codecov-umbrella # optional
fail_ci_if_error: true # optional (default = false)
verbose: true # optional (default = false)
- name: Build
run: |
make all -j$(nproc)
make bin/release.tar.gz
make release-binaries
- name: Login to GitHub Container Registry
# https://github.com/docker/login-action#github-packages-docker-registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to Docker Hub
# https://github.com/docker/login-action#github-packages-docker-registry
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up QEMU
# https://github.com/docker/setup-qemu-action
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
# https://github.com/docker/setup-buildx-action
uses: docker/setup-buildx-action@v3
- name: Push Images (Commit)
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
run: |
make REGISTRY=docker.io/jeremyje images
make bin/release.tar.gz
- name: Push Images (Release)
if: startsWith(github.ref, 'refs/tags/')
run: |
make DOCKER_PUSH=--push REGISTRY=docker.io/jeremyje images
make DOCKER_PUSH=--push REGISTRY=ghcr.io/jeremyje images
make bin/release.tar.gz
- name: Push Images (Latest)
if: startsWith(github.ref, 'refs/tags/') && !contains(github.ref, '-')
run: |
make DOCKER_PUSH=--push REGISTRY=docker.io/jeremyje images
make DOCKER_PUSH=--push REGISTRY=ghcr.io/jeremyje images
- name: Create Release
# https://github.com/softprops/action-gh-release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
generate_release_notes: true
draft: false
prerelease: false
files: |
LICENSE
bin/release.tar.gz
bin/release/certtool-386
bin/release/certtool-386.exe
bin/release/certtool-amd64
bin/release/certtool-amd64-darwin
bin/release/certtool-amd64.exe
bin/release/certtool-arm
bin/release/certtool-arm64
bin/release/certtool-arm64-darwin
bin/release/certtool-arm64.exe
bin/release/httpprobe-386
bin/release/httpprobe-386.exe
bin/release/httpprobe-amd64
bin/release/httpprobe-amd64-darwin
bin/release/httpprobe-amd64.exe
bin/release/httpprobe-arm
bin/release/httpprobe-arm64
bin/release/httpprobe-arm64-darwin
bin/release/httpprobe-arm64.exe
bin/release/server-386
bin/release/server-386.exe
bin/release/server-amd64
bin/release/server-amd64-darwin
bin/release/server-amd64.exe
bin/release/server-arm
bin/release/server-arm64
bin/release/server-arm64-darwin
bin/release/server-arm64.exe
- name: Publish Application
# https://github.com/actions/upload-artifact
uses: actions/upload-artifact@v4
if: startsWith(github.ref, 'refs/tags/')
with:
name: release.tar.gz
path: |
bin/release.tar.gz
bin/release/*