Skip to content

Commit

Permalink
add github action
Browse files Browse the repository at this point in the history
  • Loading branch information
zc2638 committed Sep 7, 2023
1 parent 86e21b4 commit 826e09e
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 7 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Main WorkFlow
on:
push:
branches:
- main
tags:
pull_request:

env:
GO_VERSION: 1.21
OS: ubuntu-20.04

jobs:
lint:
runs-on: ${{ env.OS }}
steps:
- name: Install Go
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}

- name: Checkout Code
uses: actions/checkout@v3

- name: Install Dependencies
run: go get -v -t -d ./...

- name: Lint
uses: golangci/golangci-lint-action@v3
with:
version: latest

- name: Test
run: make test

build:
runs-on: ${{ env.OS }}
steps:
- name: Install Go
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}

- name: Checkout Code
uses: actions/checkout@v3

- name: Install Dependencies
run: go get -v -t -d ./...

- name: Build
run: make build
4 changes: 1 addition & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
GOOS ?= linux
GOARCH ?= amd64
tag ?= latest

build-%:
@GOOS=$(GOOS) GOARCH=$(GOARCH) CGO_ENABLED=0 go build -ldflags="-s -w" -installsuffix cgo -o output/$* ./cmd/$*
@CGO_ENABLED=0 go build -ldflags="-s -w" -installsuffix cgo -o output/$* ./cmd/$*

docker-build-%: build-%
@docker build --platform $(GOOS)/$(GOARCH) -t zc2638/$* -f build/Dockerfile .
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ Controllable CICD service

## TODO

- Add GitHub CI for test and build.
- Add the worker for kubernetes.
- Support docker image pull auth for registry.
- Support secret.
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ require (
github.com/segmentio/ksuid v1.0.4
github.com/spf13/cobra v1.7.0
github.com/spf13/viper v1.15.0
github.com/zc2638/wslog v0.0.0-20230829113207-11af102bf6fb
github.com/zc2638/wslog v0.0.0-20230907023703-58d4be1e378f
golang.org/x/sync v0.3.0
gopkg.in/yaml.v3 v3.0.1
gorm.io/driver/mysql v1.5.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1154,10 +1154,10 @@ github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5t
github.com/yvasiyarov/go-metrics v0.0.0-20140926110328-57bccd1ccd43/go.mod h1:aX5oPXxHm3bOH+xeAttToC8pqch2ScQN/JoXYupl6xs=
github.com/yvasiyarov/gorelic v0.0.0-20141212073537-a9bba5b9ab50/go.mod h1:NUSPSUX/bi6SeDMUh6brw0nXpxHnc96TguQh0+r/ssA=
github.com/yvasiyarov/newrelic_platform_go v0.0.0-20140908184405-b21fdbd4370f/go.mod h1:GlGEuHIJweS1mbCqG+7vt2nvWLzLLnRHbXz5JKd/Qbg=
github.com/zc2638/wslog v0.0.0-20230821114055-e716ae3aa165 h1:LIHAPo9D+x3WU+5AMYeeTEFfBB73hJjvmHIZ55aJXiE=
github.com/zc2638/wslog v0.0.0-20230821114055-e716ae3aa165/go.mod h1:SXe1Fr+8wvKz4dl9aQ6Lw+YLTo+xVGFAxQctfU2LSd4=
github.com/zc2638/wslog v0.0.0-20230829113207-11af102bf6fb h1:lqcdg5XzqO8beLgwSf0F64ZvAZlk5Q8MCCpMkSpizZ8=
github.com/zc2638/wslog v0.0.0-20230829113207-11af102bf6fb/go.mod h1:SXe1Fr+8wvKz4dl9aQ6Lw+YLTo+xVGFAxQctfU2LSd4=
github.com/zc2638/wslog v0.0.0-20230907023703-58d4be1e378f h1:wrHi2Nz3TyL/hwjhkkqZ4Xuog7VZBFqyehE17kGI/lc=
github.com/zc2638/wslog v0.0.0-20230907023703-58d4be1e378f/go.mod h1:SXe1Fr+8wvKz4dl9aQ6Lw+YLTo+xVGFAxQctfU2LSd4=
github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q=
gitlab.com/nyarla/go-crypt v0.0.0-20160106005555-d9a5dc2b789b/go.mod h1:T3BPAOm2cqquPa0MKWeNkmOM5RQsRhkrwMWonFMN7fE=
go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
Expand Down

0 comments on commit 826e09e

Please sign in to comment.