Skip to content

Commit 4fa4add

Browse files
authored
Merge pull request #64 from arnested/misc
Move away from TravisCI and CodeClimate
2 parents 2de23a3 + b1c5c15 commit 4fa4add

16 files changed

+474
-83
lines changed

.codeclimate.yml

Lines changed: 0 additions & 16 deletions
This file was deleted.

.github/workflows/build.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
on:
2+
- push
3+
name: Build and test
4+
jobs:
5+
go_generate:
6+
name: Check generated code is up to date
7+
if: '!github.event.deleted'
8+
runs-on: ubuntu-latest
9+
env:
10+
workdir: go/src/${{ github.repository }}
11+
steps:
12+
- uses: actions/[email protected]
13+
with:
14+
path: ${{env.workdir}}
15+
- name: Install Go
16+
uses: actions/setup-go@v2
17+
with:
18+
go-version: '1.15'
19+
- name: go generate
20+
env:
21+
GO111MODULE: 'on'
22+
GOPATH: ${{ github.workspace }}/go
23+
working-directory: ${{env.workdir}}
24+
run: go generate -x
25+
- name: Diff after go generate
26+
working-directory: ${{env.workdir}}
27+
run: git diff --exit-code
28+
build_and_test:
29+
name: Build and test
30+
if: '!github.event.deleted'
31+
runs-on: macos-latest
32+
strategy:
33+
matrix:
34+
go-version: ['1.15']
35+
steps:
36+
- uses: actions/[email protected]
37+
- name: Install Go
38+
uses: actions/setup-go@v2
39+
with:
40+
go-version: ${{ matrix.go-version }}
41+
- name: go test
42+
env:
43+
GO111MODULE: 'on'
44+
# We enable cgo to be able to test with `-race`.
45+
CGO_ENABLED: 1
46+
run: go test -v -race -cover -covermode=atomic -coverprofile=coverage.txt ./...
47+
- name: Upload coverage report to Codecov
48+
uses: codecov/[email protected]
49+
with:
50+
flags: go${{ matrix.go-version }}
51+
token: ${{secrets.CODECOV_TOKEN}}
52+
license_check:
53+
name: License check
54+
if: '!github.event.deleted'
55+
runs-on: ubuntu-latest
56+
steps:
57+
- uses: actions/[email protected]
58+
- name: Install Go
59+
uses: actions/setup-go@v2
60+
with:
61+
go-version: '1.15'
62+
- name: Install wwhrd
63+
env:
64+
GO111MODULE: 'off'
65+
run: go get -u github.com/frapposelli/wwhrd
66+
- name: go mod vendor
67+
env:
68+
GO111MODULE: 'on'
69+
run: go mod vendor
70+
- name: wwhrd check
71+
run: wwhrd check

.github/workflows/lint.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,14 @@ jobs:
1717
- uses: actions/checkout@v2
1818
- name: Run markdownlint
1919
uses: actionshub/[email protected]
20+
21+
golangci:
22+
name: lint
23+
runs-on: ubuntu-latest
24+
steps:
25+
- uses: actions/[email protected]
26+
- name: golangci-lint
27+
uses: golangci/[email protected]
28+
with:
29+
version: latest
30+
only-new-issues: true

.github/workflows/release.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Release
2+
on:
3+
push:
4+
branches:
5+
- main
6+
jobs:
7+
bump-version:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v2
11+
with:
12+
fetch-depth: 0
13+
- name: Bump version and push tag
14+
uses: anothrNick/[email protected]
15+
id: version
16+
env:
17+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
18+
WITH_V: true
19+
DEFAULT_BUMP: patch
20+
RELEASE_BRANCHES: main
21+
- name: Set up Go
22+
uses: actions/setup-go@v2
23+
with:
24+
go-version: 1.15
25+
- name: Run GoReleaser
26+
uses: goreleaser/goreleaser-action@v2
27+
with:
28+
version: latest
29+
args: release
30+
env:
31+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32+
- name: Import GPG signing key
33+
run: |
34+
mkdir -p -m 0700 ~/.gnupg/
35+
printf -- "${{ secrets.GPG_SIGNING_KEY }}" > ~/.gnupg/private-key.asc
36+
gpg --import --no-tty --batch --yes ~/.gnupg/private-key.asc
37+
- name: Copy deb packages into build area
38+
run: |
39+
mkdir -p site
40+
cp -v dist/*.deb site/
41+
- name: Scan packages
42+
run: |
43+
dpkg-scanpackages --multiversion . > Packages
44+
gzip -k -f Packages
45+
working-directory: site
46+
- name: apt-ftparchive release
47+
run: |
48+
apt-ftparchive release . > Release
49+
gpg -abs --no-tty --batch --yes -o - Release > Release.gpg
50+
gpg --clearsign --no-tty --batch --yes -o - Release > InRelease
51+
working-directory: site
52+
- uses: ZacJW/[email protected]
53+
with:
54+
input_files: '[["README.md"]]'
55+
output_files: '["README.html"]'
56+
- name: Fix link / package name in GitHub Pages
57+
run: |
58+
DEB=$(grep linux_amd64.deb dist/checksums.txt | awk '{print $2}')
59+
sed -i "s/system-state_.*_linux_amd64.deb/<a href=\"https:\/\/github.com\/arnested\/system-state\/releases\/latest\/download\/${DEB}\">${DEB}<\/a>/" README.html
60+
sed -i 's/<!DOCTYPE html>//' README.html
61+
cat page/header.html README.html page/footer.html > site/index.html
62+
- name: Add install script to GitHub Pages
63+
run: cp -v install.sh site/install.sh
64+
- name: Deploy deb packages
65+
uses: JamesIves/[email protected]
66+
with:
67+
branch: gh-pages
68+
folder: site
69+
clean: true

.goreleaser.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
before:
2+
hooks:
3+
- go mod download
4+
builds:
5+
- env:
6+
- CGO_ENABLED=0
7+
goos:
8+
- linux
9+
archives:
10+
- format: binary
11+
name_template: "{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}"
12+
replacements:
13+
darwin: Darwin
14+
linux: Linux
15+
windows: Windows
16+
386: i386
17+
amd64: x86_64
18+
checksum:
19+
name_template: 'checksums.txt'
20+
snapshot:
21+
name_template: "{{ .Tag }}-next"
22+
changelog:
23+
sort: asc
24+
filters:
25+
exclude:
26+
- '^docs:'
27+
- '^test:'
28+
release:
29+
# If set to auto, will mark the release as not ready for production
30+
# in case there is an indicator for this in the tag e.g. v1.0.0-rc1
31+
# If set to true, will mark the release as not ready for production.
32+
# Default is false.
33+
prerelease: auto
34+
35+
nfpms:
36+
-
37+
vendor: Arne Jørgensen
38+
maintainer: Arne Jørgensen <[email protected]>
39+
description: http server for monitoring systemd state
40+
license: MIT
41+
formats:
42+
- deb
43+
dependencies:
44+
- libsystemd0
45+
bindir: /usr/libexec
46+
contents:
47+
- src: systemd/systemd-state.service
48+
dst: /lib/systemd/system/systemd-state.service
49+
50+
- src: deb/systemd-state.list
51+
dst: /etc/apt/sources.list.d/systemd-state.list
52+
53+
- src: deb/systemd-state.asc
54+
dst: /etc/apt/trusted.gpg.d/systemd-state.asc
55+
56+
scripts:
57+
postinstall: "deb/postinstall.sh"
58+
preremove: "deb/preremove.sh"
59+
postremove: "deb/postremove.sh"

.travis.yml

Lines changed: 0 additions & 64 deletions
This file was deleted.

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
# systemd state http server
22

3-
[![Maintainability](https://api.codeclimate.com/v1/badges/2c74204a27869bfe8426/maintainability)](https://codeclimate.com/github/arnested/systemd-state/maintainability)
43
[![Docker image size](https://badgen.net/docker/size/arnested/systemd-state)](https://hub.docker.com/r/arnested/systemd-state)
5-
[![Test Coverage](https://api.codeclimate.com/v1/badges/2c74204a27869bfe8426/test_coverage)](https://codeclimate.com/github/arnested/systemd-state/test_coverage)
64
[![Build Status](https://travis-ci.org/arnested/systemd-state.svg?branch=master)](https://travis-ci.org/arnested/systemd-state)
75
[![Release](https://img.shields.io/github/release/arnested/systemd-state.svg)](https://github.com/arnested/systemd-state/releases/latest)
86
[![Go Report Card](https://goreportcard.com/badge/github.com/arnested/systemd-state)](https://goreportcard.com/report/github.com/arnested/systemd-state)

deb/postinstall.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/sh
2+
3+
set -e
4+
5+
/bin/systemctl daemon-reload
6+
7+
if /bin/systemctl is-active --quiet systemd-state.service; then
8+
/bin/systemctl restart systemd-state.service
9+
fi
10+
11+
if ! /bin/systemctl is-enabled --quiet systemd-state.service; then
12+
/bin/systemctl enable --now systemd-state.service;
13+
fi

deb/postremove.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/sh
2+
3+
set -e
4+
5+
/bin/systemctl daemon-reload

deb/preremove.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/sh
2+
3+
set -e
4+
5+
if /bin/systemctl is-active --quiet systemd-state.service; then
6+
/bin/systemctl stop systemd-state.service
7+
fi
8+
9+
if /bin/systemctl is-enabled --quiet systemd-state.service; then
10+
/bin/systemctl disable --now systemd-state.service;
11+
fi

0 commit comments

Comments
 (0)