Skip to content

Commit 83fe047

Browse files
committed
Try github actions build.
1 parent 834392a commit 83fe047

15 files changed

Lines changed: 262 additions & 150 deletions

File tree

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: build-deviceparameters
2+
on: [push]
3+
jobs:
4+
build:
5+
runs-on: ubuntu-20.04
6+
steps:
7+
- uses: actions/checkout@v2
8+
9+
- name: Setup Go
10+
uses: actions/setup-go@v2
11+
with:
12+
go-version: '1.17.2'
13+
14+
- name: Install build tools
15+
run: sudo apt update && sudo apt install -y lsb-release build-essential debhelper upx ruby ruby-dev
16+
17+
- name: Install ronn for converting manpages
18+
run: sudo gem install ronn
19+
20+
# AMD64
21+
- name: Build for amd64
22+
run: cd support && make amd64
23+
24+
- name: Install amd64
25+
run: sudo dpkg -i mist-device-parameters_*_amd64.deb
26+
27+
- name: Run installed deviceparamter
28+
run: deviceparameter -V
29+
30+
- name: Run installed deviceparamters
31+
run: deviceparameters -V
32+
33+
# ARMv5 / armel
34+
- name: Build for armel(arm5)
35+
run: cd support && make armel
36+
37+
# ARMv6 / armhf
38+
- name: Build for armhf(arm6)
39+
run: cd support && make armhf
40+
41+
# Windows
42+
- name: Build for Windows
43+
run: cd support && make win64
44+
45+
# Publish
46+
- uses: ncipollo/release-action@v1
47+
if: startsWith(github.ref, 'refs/tags/')
48+
with:
49+
artifacts: "mist-device-parameters_*.deb,mist-device-parameters_*.zip"
50+
token: ${{ secrets.GITHUB_TOKEN }}
51+
draft: true

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
*.deb
2+
*.zip
3+
*.buildinfo
4+
*.changes

cmd/deviceparameter/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
build

cmd/deviceparameter/Makefile

Lines changed: 72 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,45 +3,93 @@
33
BUILD_DATE = $(shell date -u '+%Y-%m-%d_%H:%M:%S')
44
BUILD_DISTRO = $(shell lsb_release -sd)
55

6-
all: deviceparameter manual
6+
USE_UPX ?= 0
7+
ifneq ($(USE_UPX),0)
8+
BUILD_PARTS := build compress-brute
9+
else
10+
BUILD_PARTS := build
11+
endif
712

8-
win32: export GOOS=windows
9-
win32: export GOARCH=386
10-
win32: deviceparameter.exe
13+
# In this setup arm5=armel and arm6=armhf for widest compatibility
14+
GOALS := amd64 arm5 armel arm6 armhf arm7 arm64 win64 clean
15+
ifeq (,$(filter $(GOALS),$(MAKECMDGOALS)))
16+
$(error Build with make amd64/arm5/armel/arm6/armhf/arm7/arm64/win64)
17+
endif
18+
19+
amd64:
20+
amd64: export GOOS=linux
21+
amd64: export GOARCH=amd64
22+
amd64: export FLAVOUR=$(GOOS)-$(GOARCH)
23+
amd64: $(BUILD_PARTS) manual
24+
25+
arm5: export GOOS=linux
26+
arm5: export GOARCH=arm
27+
arm5: export GOARM=5
28+
arm5: export FLAVOUR=$(GOOS)-$(GOARCH)$(GOARM)
29+
arm5: $(BUILD_PARTS) manual
30+
31+
armel: export GOOS=linux
32+
armel: export GOARCH=arm
33+
armel: export GOARM=5
34+
armel: export FLAVOUR=$(GOOS)-armel
35+
armel: $(BUILD_PARTS) manual
36+
37+
arm6: export GOOS=linux
38+
arm6: export GOARCH=arm
39+
arm6: export GOARM=6
40+
arm6: export FLAVOUR=$(GOOS)-$(GOARCH)$(GOARM)
41+
arm6: $(BUILD_PARTS) manual
42+
43+
armhf: export GOOS=linux
44+
armhf: export GOARCH=arm
45+
armhf: export GOARM=6
46+
armhf: export FLAVOUR=$(GOOS)-armhf
47+
armhf: $(BUILD_PARTS) manual
48+
49+
arm7: export GOOS=linux
50+
arm7: export GOARCH=arm
51+
arm7: export GOARM=7
52+
arm7: export FLAVOUR=$(GOOS)-$(GOARCH)$(GOARM)
53+
arm7: $(BUILD_PARTS) manual
54+
55+
arm64: export GOOS=linux
56+
arm64: export GOARCH=arm64
57+
arm64: export FLAVOUR=$(GOOS)-$(GOARCH)
58+
arm64: $(BUILD_PARTS) manual
1159

1260
win64: export GOOS=windows
1361
win64: export GOARCH=amd64
62+
win64: export FLAVOUR=$(GOOS)-$(GOARCH)
1463
win64: deviceparameter.exe
1564

16-
raspberry: export GOOS=linux
17-
raspberry: export GOARCH=arm
18-
raspberry: export GOARM=6
19-
raspberry: deviceparameter
20-
21-
raspberry2: export GOOS=linux
22-
raspberry2: export GOARCH=arm
23-
raspberry2: export GOARM=7
24-
raspberry2: deviceparameter
65+
builddir: $(FLAVOUR)
66+
mkdir -p build/$(FLAVOUR)
2567

26-
deviceparameter:
27-
go build -o deviceparameter -ldflags "-X 'main.ApplicationBuildDate=$(BUILD_DATE)' -X 'main.ApplicationBuildDistro=$(BUILD_DISTRO)'"
68+
# -s disable symbol table
69+
# -w disable DWARF generation
70+
build: builddir
71+
go build -o build/$(FLAVOUR)/deviceparameter -ldflags "-w -s -X 'main.ApplicationBuildDate=$(BUILD_DATE)' -X 'main.ApplicationBuildDistro=$(BUILD_DISTRO)'"
2872

2973
deviceparameter.exe:
30-
go build -o deviceparameter.exe -ldflags "-X 'main.ApplicationBuildDate=$(BUILD_DATE)' -X 'main.ApplicationBuildDistro=$(BUILD_DISTRO)'"
74+
go build -o build/$(FLAVOUR)/deviceparameter.exe -ldflags "-w -s -X 'main.ApplicationBuildDate=$(BUILD_DATE)' -X 'main.ApplicationBuildDistro=$(BUILD_DISTRO)'"
75+
76+
# upx will make the binary much smaller
77+
compress: build
78+
upx build/$(FLAVOUR)/deviceparameter
3179

32-
deviceparameter.1.gz:
80+
# but will take quite a while with --brute
81+
compress-brute: build
82+
upx --brute build/$(FLAVOUR)/deviceparameter
83+
84+
build/$(FLAVOUR)/deviceparameter.1.gz:
3385
ronn --roff README.md
3486
mv README.1 deviceparameter.1
3587
gzip deviceparameter.1
88+
mv deviceparameter.1.gz build/$(FLAVOUR)/
3689

37-
manual: deviceparameter.1.gz
38-
39-
install: deviceparameter manual
40-
install -m 0755 deviceparameter /usr/local/bin
41-
install -m 0644 deviceparameter /usr/local/man/man1
90+
manual: build/$(FLAVOUR)/deviceparameter.1.gz
4291

4392
clean:
44-
rm -f deviceparameter
45-
rm -f deviceparameter.1.gz
93+
rm -Rf build
4694

4795
.PHONY: clean

cmd/deviceparameters/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
build

cmd/deviceparameters/Makefile

Lines changed: 72 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,45 +3,93 @@
33
BUILD_DATE = $(shell date -u '+%Y-%m-%d_%H:%M:%S')
44
BUILD_DISTRO = $(shell lsb_release -sd)
55

6-
all: deviceparameters manual
6+
USE_UPX ?= 0
7+
ifneq ($(USE_UPX),0)
8+
BUILD_PARTS := build compress-brute
9+
else
10+
BUILD_PARTS := build
11+
endif
712

8-
win32: export GOOS=windows
9-
win32: export GOARCH=386
10-
win32: deviceparameters.exe
13+
# In this setup arm5=armel and arm6=armhf for widest compatibility
14+
GOALS := amd64 arm5 armel arm6 armhf arm7 arm64 win64 clean
15+
ifeq (,$(filter $(GOALS),$(MAKECMDGOALS)))
16+
$(error Build with make amd64/arm5/armel/arm6/armhf/arm7/arm64/win64)
17+
endif
18+
19+
amd64:
20+
amd64: export GOOS=linux
21+
amd64: export GOARCH=amd64
22+
amd64: export FLAVOUR=$(GOOS)-$(GOARCH)
23+
amd64: $(BUILD_PARTS) manual
24+
25+
arm5: export GOOS=linux
26+
arm5: export GOARCH=arm
27+
arm5: export GOARM=5
28+
arm5: export FLAVOUR=$(GOOS)-$(GOARCH)$(GOARM)
29+
arm5: $(BUILD_PARTS) manual
30+
31+
armel: export GOOS=linux
32+
armel: export GOARCH=arm
33+
armel: export GOARM=5
34+
armel: export FLAVOUR=$(GOOS)-armel
35+
armel: $(BUILD_PARTS) manual
36+
37+
arm6: export GOOS=linux
38+
arm6: export GOARCH=arm
39+
arm6: export GOARM=6
40+
arm6: export FLAVOUR=$(GOOS)-$(GOARCH)$(GOARM)
41+
arm6: $(BUILD_PARTS) manual
42+
43+
armhf: export GOOS=linux
44+
armhf: export GOARCH=arm
45+
armhf: export GOARM=6
46+
armhf: export FLAVOUR=$(GOOS)-armhf
47+
armhf: $(BUILD_PARTS) manual
48+
49+
arm7: export GOOS=linux
50+
arm7: export GOARCH=arm
51+
arm7: export GOARM=7
52+
arm7: export FLAVOUR=$(GOOS)-$(GOARCH)$(GOARM)
53+
arm7: $(BUILD_PARTS) manual
54+
55+
arm64: export GOOS=linux
56+
arm64: export GOARCH=arm64
57+
arm64: export FLAVOUR=$(GOOS)-$(GOARCH)
58+
arm64: $(BUILD_PARTS) manual
1159

1260
win64: export GOOS=windows
1361
win64: export GOARCH=amd64
62+
win64: export FLAVOUR=$(GOOS)-$(GOARCH)
1463
win64: deviceparameters.exe
1564

16-
raspberry: export GOOS=linux
17-
raspberry: export GOARCH=arm
18-
raspberry: export GOARM=6
19-
raspberry: deviceparameters
20-
21-
raspberry2: export GOOS=linux
22-
raspberry2: export GOARCH=arm
23-
raspberry2: export GOARM=7
24-
raspberry2: deviceparameters
65+
builddir: $(FLAVOUR)
66+
mkdir -p build/$(FLAVOUR)
2567

26-
deviceparameters:
27-
go build -o deviceparameters -ldflags "-X 'main.ApplicationBuildDate=$(BUILD_DATE)' -X 'main.ApplicationBuildDistro=$(BUILD_DISTRO)'"
68+
# -s disable symbol table
69+
# -w disable DWARF generation
70+
build: builddir
71+
go build -o build/$(FLAVOUR)/deviceparameters -ldflags "-w -s -X 'main.ApplicationBuildDate=$(BUILD_DATE)' -X 'main.ApplicationBuildDistro=$(BUILD_DISTRO)'"
2872

2973
deviceparameters.exe:
30-
go build -o deviceparameters.exe -ldflags "-X 'main.ApplicationBuildDate=$(BUILD_DATE)' -X 'main.ApplicationBuildDistro=$(BUILD_DISTRO)'"
74+
go build -o build/$(FLAVOUR)/deviceparameters.exe -ldflags "-w -s -X 'main.ApplicationBuildDate=$(BUILD_DATE)' -X 'main.ApplicationBuildDistro=$(BUILD_DISTRO)'"
75+
76+
# upx will make the binary much smaller
77+
compress: build
78+
upx build/$(FLAVOUR)/deviceparameters
3179

32-
deviceparameters.1.gz:
80+
# but will take quite a while with --brute
81+
compress-brute: build
82+
upx --brute build/$(FLAVOUR)/deviceparameters
83+
84+
build/$(FLAVOUR)/deviceparameters.1.gz:
3385
ronn --roff README.md
3486
mv README.1 deviceparameters.1
3587
gzip deviceparameters.1
88+
mv deviceparameters.1.gz build/$(FLAVOUR)/
3689

37-
manual: deviceparameters.1.gz
38-
39-
install: deviceparameters manual
40-
install -m 0755 deviceparameters /usr/local/bin
41-
install -m 0644 deviceparameters /usr/local/man/man1
90+
manual: build/$(FLAVOUR)/deviceparameters.1.gz
4291

4392
clean:
44-
rm -f deviceparameters
45-
rm -f deviceparameters.1.gz
93+
rm -Rf build
4694

4795
.PHONY: clean

support/Makefile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Makefile for building packages
2+
3+
# Determine version for the windows build
4+
DEVP_VER=$(shell head -n 1 debian/changelog | sed -n "s/mist-device-parameters (\(.*\)).*/\1/p")
5+
6+
amd64:
7+
dpkg-buildpackage --host-arch amd64 -b --no-sign
8+
9+
armel:
10+
dpkg-buildpackage --host-arch armel -b --no-sign
11+
12+
armhf:
13+
dpkg-buildpackage --host-arch armhf -b --no-sign
14+
15+
win64:
16+
make -C ../cmd/deviceparameter win64
17+
make -C ../cmd/deviceparameters win64
18+
zip -j mist-device-parameters_$(DEVP_VER).zip ../cmd/deviceparameter/build/windows-amd64/deviceparameter.exe ../cmd/deviceparameters/build/windows-amd64/deviceparameters.exe
19+
mv mist-device-parameters_$(DEVP_VER).zip ../

support/debian/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
mist-device-parameters
2+
files
3+
*.log
4+
*.substvars

support/debian/changelog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
mist-device-parameters (0.4.0-1) stretch; urgency=medium
2+
3+
* Bugfix release with new build env.
4+
5+
-- Raido Pahtma <raido@thinnect.com> Tue, 12 Dec 2021 12:00:00 +0000

support/debian/compat

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
9

0 commit comments

Comments
 (0)