diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml new file mode 100644 index 0000000..f864a13 --- /dev/null +++ b/.github/workflows/main.yaml @@ -0,0 +1,47 @@ +name: Main WorkFlow +on: + push: + branches: + - main + tags: + pull_request: + +jobs: + lint: + runs-on: ubuntu-20.04 + steps: + - name: Install Go + uses: actions/setup-go@v4 + with: + go-version: 1.21 + + - 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: ubuntu-20.04 + steps: + - name: Install Go + uses: actions/setup-go@v4 + with: + go-version: 1.21 + + - name: Checkout Code + uses: actions/checkout@v3 + + - name: Install Dependencies + run: go get -v -t -d ./... + + - name: Build + run: make build diff --git a/Makefile b/Makefile index affe63c..cf45838 100644 --- a/Makefile +++ b/Makefile @@ -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 . diff --git a/README.md b/README.md index 844024b..5cefa32 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/go.mod b/go.mod index 70a3fd6..82b25af 100644 --- a/go.mod +++ b/go.mod @@ -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 diff --git a/go.sum b/go.sum index e4a26d9..0832e4c 100644 --- a/go.sum +++ b/go.sum @@ -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=