Skip to content

Commit

Permalink
CI and portability (#15)
Browse files Browse the repository at this point in the history
* Add github action for build and test

* Add working directory

* Split into build and test phases

Store binary from build.

* Add badge to readme

* Upload single file

* Move storing an artifact to only run on main

* Add extra flag to build

These should reduce the size of the binary produced.
  • Loading branch information
PossibleLlama authored and Chris Collier committed Nov 9, 2020
1 parent 6261155 commit 3f653cc
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 1 deletion.
75 changes: 75 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Go

on: push

jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:

- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.13

- name: Check out code into the Go module directory
uses: actions/checkout@v2

- name: Get dependencies
run: go mod download
working-directory: src

- name: Build
run: go build -v .
working-directory: src

unit_test:
name: Unit test
runs-on: ubuntu-latest
steps:

- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.13

- name: Check out code into the Go module directory
uses: actions/checkout@v2

- name: Get dependencies
run: go mod download
working-directory: src

- name: Test
run: go test -v ./...
working-directory: src

store:
name: Store artifacts
runs-on: ubuntu-latest
needs: [build, unit_test]
if: github.ref == 'refs/heads/main'

steps:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.13

- name: Check out code into the Go module directory
uses: actions/checkout@v2

- name: Get dependencies
run: go mod download
working-directory: src

- name: Build
run: "go build -ldflags='-w -s' -o dist/worklog -v ."
working-directory: src

- name: Archive production artifacts
uses: actions/upload-artifact@v2
with:
name: workflow-binary
path: src/dist
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Worklog

Intented to be a quick CLI to track what you have done each day.
![Go](https://github.com/PossibleLlama/worklog/workflows/Go/badge.svg)

Intented to be a quick productivity CLI tool, to track what you
have done each day.

## ~/.worklog/config.yml

Expand Down

0 comments on commit 3f653cc

Please sign in to comment.