Skip to content

Commit

Permalink
Merge pull request #1 from FreedomNetNL/feature/ci
Browse files Browse the repository at this point in the history
Feature/ci
  • Loading branch information
lucasvbeek authored Feb 2, 2022
2 parents 22f21a2 + c2c92db commit 3f8d1e9
Show file tree
Hide file tree
Showing 6 changed files with 81 additions and 114 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
name: build

on: [push]

jobs:
builds:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.17
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
distribution: goreleaser
version: latest
args: release --rm-dist ${{ !startsWith(github.ref, 'refs/tags/v') && '--snapshot' || '' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Store build
uses: actions/upload-artifact@v2
with:
name: build
path: dist/*
138 changes: 24 additions & 114 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,120 +1,30 @@
project_name: 'speedtest-go'
#dist: ./out
before:
hooks:
- go mod download
project_name: 'librespeed-go'

builds:
- main: ./main.go
id: speedtest-backend
binary: speedtest-backend
env:
- env:
- CGO_ENABLED=0
flags:
- -trimpath
ldflags:
- -w -s
goos:
- windows
- linux
- darwin
goarch:
- 386
- amd64
- arm
- arm64
- mips
- mipsle
goarm:
- 5
- 6
- 7
gomips:
- hardfloat
- softfloat
ignore:
- goos: darwin
goarch: 386
- goos: windows
goarch: arm
- goos: windows
goarch: arm64
hooks:
post: upx -9 "{{ .Path }}"
- main: ./main.go
id: speedtest-backend-freebsd
binary: speedtest-backend
env:
- CGO_ENABLED=0
flags:
- -trimpath
ldflags:
- -w -s
goos:
- freebsd
goarch:
- 386
- amd64
- arm
- arm64
- mips
- mipsle
goarm:
- 5
- 6
- 7
gomips:
- hardfloat
- softfloat
- main: ./main.go
id: speedtest-backend-noupx-linux
binary: speedtest-backend
env:
- CGO_ENABLED=0
flags:
- -trimpath
ldflags:
- -w -s
goos:
- linux
goarch:
- mips64
- mips64le
gomips:
- hardfloat
- softfloat
- main: ./main.go
id: speedtest-backend-noupx-windows-arm64
binary: speedtest-backend
env:
- CGO_ENABLED=0
flags:
- -trimpath
ldflags:
- -w -s
goos:
- windows
goarch:
- arm
- arm64
goarm:
- 5
- 6
- 7

nfpms:
- homepage: https://freedom.nl
description: LibreSpeed-Go backend
maintainer: Freedom Internet DevOps <[email protected]>
license: LGPL 3.0
vendor: Freedom Internet
contents:
- src: scripts/defaults
dst: /etc/default/librespeed-go
- src: scripts/systemd/librespeed-go.service
dst: /usr/lib/systemd/system/librespeed-go.service
formats:
- deb
- rpm
dependencies:
- systemd
scripts:
postinstall: scripts/postinstall.sh

archives:
- format_overrides:
- goos: windows
format: zip
files:
- files:
- README.md
- LICENSE
- settings.toml
checksum:
name_template: 'checksums.txt'
changelog:
skip: false
sort: asc
release:
github:
owner: librespeed
name: speedtest-go
disable: false
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6r
github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
github.com/breml/rootcerts v0.2.1 h1:GZMVDXOs945764NFck0vtHSjktKYubOFM0kjf5HAuwc=
github.com/breml/rootcerts v0.2.1/go.mod h1:24FDtzYMpqIeYC7QzaE8VPRQaFZU5TIUDlyk8qwjD88=
github.com/breml/rootcerts v0.2.2 h1:hkHEpbTdYaNvDoYeq+mwRvCeg/YTTl23DjQ1Tnj71Zs=
github.com/breml/rootcerts v0.2.2/go.mod h1:24FDtzYMpqIeYC7QzaE8VPRQaFZU5TIUDlyk8qwjD88=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/census-instrumentation/opencensus-proto v0.3.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
Expand Down Expand Up @@ -567,6 +569,8 @@ golang.org/x/sys v0.0.0-20211124211545-fe61309f8881/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20211210111614-af8b64212486/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220114195835-da31bd327af9 h1:XfKQ4OlFl8okEOr5UvAqFRVj8pY/4yfcXrddB8qAbU0=
golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27 h1:XDXtA5hveEEV8JB2l7nhMTp3t3cHp9ZpwcdjqyEWLlo=
golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
Expand Down
5 changes: 5 additions & 0 deletions scripts/defaults
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Set the command-line arguments to pass to the server.
# Due to shell scaping, to pass backslashes for regexes, you need to double
# them (\\d for \d). If running under systemd, you need to double them again
# (\\\\d to mean \d), and escape newlines too.
ARGS=""
5 changes: 5 additions & 0 deletions scripts/postinstall.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh

systemctl daemon-reload
systemctl enable librespeed-go
systemctl start librespeed-go
13 changes: 13 additions & 0 deletions scripts/systemd/librespeed-go.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[Unit]
Description=LibreSpeed-Go backend
Documentation=https://github.com/FreedomNetNL/speedtest-go

[Service]
Restart=on-failure
DynamicUser=yes
User=librespeed
EnvironmentFile=/etc/default/librespeed-go
ExecStart=/usr/local/bin/librespeed-go $ARGS

[Install]
WantedBy=multi-user.target

0 comments on commit 3f8d1e9

Please sign in to comment.