Skip to content

Commit 5896976

Browse files
authored
Build with Github Actions (#13)
1 parent a973f8a commit 5896976

File tree

3 files changed

+60
-8
lines changed

3 files changed

+60
-8
lines changed

.github/workflows/main.yml

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Build
2+
on:
3+
pull_request:
4+
branches:
5+
- '*'
6+
push:
7+
branches:
8+
- "master"
9+
tags:
10+
- "!*"
11+
12+
jobs:
13+
build:
14+
name: Build
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Setup go
19+
uses: actions/setup-go@v2
20+
with:
21+
go-version: 1.15
22+
23+
- name: Checkout code
24+
uses: actions/checkout@v2
25+
26+
- name: Build binary
27+
run: go build -o dist/qlock -ldflags="-s -w -X main.version=$(git describe --tags)" .
28+
29+
lint:
30+
name: Lint
31+
runs-on: ubuntu-latest
32+
33+
steps:
34+
- name: Setup go
35+
uses: actions/setup-go@v2
36+
with:
37+
go-version: 1.15
38+
39+
- name: Checkout code
40+
uses: actions/checkout@v2
41+
42+
- name: Install goimports
43+
run: cd /tmp && go get -u golang.org/x/tools/cmd/goimports
44+
45+
- name: Lint code
46+
run: make style

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dist/

Makefile

+13-8
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
1-
SOURCE="./src/qlock.py"
2-
TARGET="/usr/bin/tty-qlock"
1+
#### General ####
32

3+
# All target for when make is run on its own.
4+
.PHONY: all
5+
all: style
46

5-
all: install
7+
#### Linting ####
68

7-
install:
8-
install -m 755 $(SOURCE) $(TARGET)
9-
10-
uninstall:
11-
rm $(TARGET)
9+
# Format code. Unformatted code will fail in CI.
10+
.PHONY: style
11+
style:
12+
ifdef GITHUB_ACTIONS
13+
goimports -l .
14+
else
15+
goimports -l -w .
16+
endif

0 commit comments

Comments
 (0)