Skip to content

Commit

Permalink
use Github actions instead of Travis CI
Browse files Browse the repository at this point in the history
  • Loading branch information
nekr0z committed Nov 19, 2021
1 parent 749953b commit e940838
Show file tree
Hide file tree
Showing 11 changed files with 243 additions and 732 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: build
on: [push]

jobs:
build:
runs-on: ubuntu-latest
env:
GOPROXY: direct
steps:
- name: install packages
run: |
sudo apt update
sudo apt -y install libayatana-appindicator3-dev libappindicator3-dev libgtk-3-dev
- uses: actions/checkout@v2.4.0
with:
fetch-depth: 0
- uses: actions/setup-go@v2
with:
go-version: 1.16
- name: cache
uses: actions/cache@v2.1.6
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: |
${{ runner.os }}-build-${{ hashFiles('**/go.mod') }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-build-${{ hashFiles('**/go.mod') }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: build
run: |
go generate
VER=$(go run version_generate.go)
go build -buildmode=pie -trimpath -ldflags "-s -w -buildid= -X main.version=$VER"
go build -buildmode=pie -trimpath -ldflags "-s -w -buildid= -X main.version=$VER" -tags legacyappindicator
38 changes: 38 additions & 0 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: codecov
on: [push]
jobs:
codecov:
name: codecov
runs-on: ubuntu-latest
env:
GOPROXY: direct
steps:
- name: install packages
run: |
sudo apt update
sudo apt -y install libayatana-appindicator3-dev libappindicator3-dev libgtk-3-dev
- uses: actions/checkout@v2.4.0
- uses: actions/setup-go@v2
with:
go-version: 1.16
- name: cache
uses: actions/cache@v2.1.6
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: |
${{ runner.os }}-build-${{ hashFiles('**/go.mod') }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-build-${{ hashFiles('**/go.mod') }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: vet
run: |
go generate
go vet ./...
- name: generate report
run: |
go test -v -race -coverprofile=coverage.txt -covermode=atomic ./...
- name: upload coverage report
uses: codecov/codecov-action@v2.1.0
84 changes: 84 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: release

on:
push:
tags:
- "v*"

jobs:
release:
runs-on: ubuntu-latest
env:
GOPROXY: direct
steps:
- name: install packages
run: |
sudo apt update
sudo apt -y install libayatana-appindicator3-dev libappindicator3-dev libgtk-3-dev
- uses: actions/checkout@v2.4.0
with:
fetch-depth: 0
- uses: actions/setup-go@v2
with:
go-version: 1.16

- name: install changelog
run: |
go install evgenykuznetsov.org/go/changelog/cmd/changelog@latest
- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
bundler-cache: true

- name: install fpm
run: gem install fpm

- name: build packages
run: |
git fetch --tags --force
mkdir release
changelog -n "Evgeny Kuznetsov" -e "evgeny@kuznetsov.md" -p "matebook-applet" CHANGELOG.md
go generate
VER=$(go run version_generate.go)
go build -buildmode=pie -trimpath -ldflags "-s -w -buildid= -X main.version=$VER" -tags legacyappindicator
tar -czf release/matebook-applet-amd64-$VER-legacy.tar.gz matebook-applet LICENSE README.md CHANGELOG.md SOURCE.txt
go build -buildmode=pie -trimpath -ldflags "-s -w -buildid= -X main.version=$VER"
tar -czf release/matebook-applet-amd64-$VER.tar.gz matebook-applet LICENSE README.md CHANGELOG.md SOURCE.txt
fpm -t deb -s dir \
-d libayatana-appindicator3-1 \
-d libc6 \
-d "libgtk-3-0 >= 3.10" \
--deb-recommends huawei-wmi \
-a amd64 \
-n matebook-applet -v $VER \
-m "Evgeny Kuznetsov <evgeny@kuznetsov.md>" \
--deb-changelog debian.changelog \
--license GPL-3 \
--deb-priority optional \
--url https://evgenykuznetsov.org/go/matebook-applet \
--category misc \
--vendor "Evgeny Kuznetsov <evgeny@kuznetsov.md>" \
--description "System tray applet for Huawei MateBook\nAllows one to control Huawei MateBook features,\nlike Fn-Lock and Battery Protection settings, via GUI." \
LICENSE=/usr/share/doc/matebook-applet/ \
README.md=/usr/share/doc/matebook-applet/ \
SOURCE.txt=/usr/share/doc/matebook-applet \
matebook-applet=/usr/bin/ \
matebook-applet.1=/usr/share/man/man1/ \
assets/matebook-applet.png=/usr/share/icons/hicolor/512x512/apps/ \
matebook-applet.desktop=/usr/share/applications/
mv *.deb release/
- name: release
uses: marvinpinto/action-automatic-releases@v1.2.1
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: false
files: "release/*"

- name: trigger repository update
uses: appleboy/ssh-action@v0.1.4
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USER }}
key: ${{ secrets.SSH_KEY }}
script: matebook-applet
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
matebook-applet
*.asc
*.sig
.*.swp
*.tar.gz
*.deb
assets.go
debian.changelog
secrets.tar
coverage.txt
id_rsa
/release/
98 changes: 0 additions & 98 deletions .travis.yml

This file was deleted.

7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# matebook-applet
System tray applet/control app for Huawei Matebook

[![Build Status](https://travis-ci.com/nekr0z/matebook-applet.svg?branch=master)](https://travis-ci.com/nekr0z/matebook-applet) [![codecov](https://codecov.io/gh/nekr0z/matebook-applet/branch/master/graph/badge.svg)](https://codecov.io/gh/nekr0z/matebook-applet) [![Go Report Card](https://goreportcard.com/badge/evgenykuznetsov.org/go/matebook-applet)](https://goreportcard.com/report/evgenykuznetsov.org/go/matebook-applet)
![Build Status](https://github.com/nekr0z/matebook-applet/actions/workflows/build.yml/badge.svg) [![codecov](https://codecov.io/gh/nekr0z/matebook-applet/branch/master/graph/badge.svg)](https://codecov.io/gh/nekr0z/matebook-applet) [![Go Report Card](https://goreportcard.com/badge/evgenykuznetsov.org/go/matebook-applet)](https://goreportcard.com/report/evgenykuznetsov.org/go/matebook-applet)

---

Expand Down Expand Up @@ -130,9 +130,10 @@ You can always download precompiled amd64 binary from the [releases page](https:

$ git clone https://github.com/nekr0z/matebook-applet.git
$ cd matebook-applet
$ go run build.go
$ go generate
$ go build

To build against `libappindicator` instead, append the last command with the `-l` switch.
To build against `libappindicator` instead, append the last command with `-tags legacyappindicator`.

## Usage
The user interface is intentionally as simple as they get. You get an icon in system tray that you can click and get a menu. The menu consists of current status, options to change it, and an option to quit the applet. Please be aware that the applet does not probe for current status on its own (this is intentional), so if you change your battery protection settings by other means it will not reflect the change. Clicking on the status line (top of the menu) updates it.
Expand Down
Loading

0 comments on commit e940838

Please sign in to comment.