Skip to content

Commit 0edf6ef

Browse files
committed
first version
0 parents  commit 0edf6ef

File tree

16 files changed

+487
-0
lines changed

16 files changed

+487
-0
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
go.sum -diff

.github/workflows/build.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: build
2+
3+
on:
4+
push:
5+
tags:
6+
- v*
7+
branches:
8+
- master
9+
pull_request:
10+
branches:
11+
- master
12+
13+
jobs:
14+
build:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v3
18+
19+
- name: Install Go
20+
uses: actions/setup-go@v3
21+
with:
22+
go-version: 1.19.x
23+
24+
- name: Build
25+
shell: bash
26+
run: make build

.github/workflows/lint.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: lint
2+
3+
on:
4+
push:
5+
tags:
6+
- v*
7+
branches:
8+
- master
9+
pull_request:
10+
branches:
11+
- master
12+
13+
jobs:
14+
lint: # golangci:
15+
name: lint
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v3
19+
20+
- name: Install Go
21+
uses: actions/setup-go@v3
22+
with:
23+
go-version: 1.19.x
24+
25+
- name: golangci-lint
26+
uses: golangci/golangci-lint-action@v3
27+
with:
28+
version: latest

.github/workflows/tests.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: tests
2+
3+
on:
4+
push:
5+
tags:
6+
- v*
7+
branches:
8+
- master
9+
pull_request:
10+
branches:
11+
- master
12+
13+
jobs:
14+
test:
15+
strategy:
16+
matrix:
17+
go-version: [1.17.x]
18+
os: [ubuntu-latest]
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v3
22+
23+
- name: Install Go
24+
uses: actions/setup-go@v3
25+
with:
26+
go-version: 1.19.x
27+
28+
- name: Test
29+
shell: bash
30+
run: make test

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/.idea
2+
/.vscode
3+
/.run
4+
.DS_STORE
5+
.DS_Store
6+
7+
/bin
8+
coverage.out

.golangci.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# More info on config here: https://golangci-lint.run/usage/configuration/
2+
run:
3+
concurrency: 4
4+
timeout: 5m
5+
tests: true
6+
skip-dirs:
7+
- bin
8+
allow-parallel-runners: true
9+
10+
output:
11+
sort-results: true
12+
13+
linters-settings:
14+
govet:
15+
check-shadowing: true
16+
goconst:
17+
min-len: 3
18+
min-occurrences: 3
19+
goimports:
20+
local-prefixes: github.com/Format-C-eft/git-update
21+
gosec:
22+
excludes:
23+
- G204
24+
25+
linters:
26+
disable-all: true
27+
enable:
28+
- errcheck
29+
- gosimple
30+
- govet
31+
- ineffassign
32+
- staticcheck
33+
- typecheck
34+
- unused
35+
- goconst
36+
- goimports
37+
- gosec

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2021 platform
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

Makefile

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
export GO111MODULE=on
2+
export GOSUMDB=off
3+
4+
LOCAL_BIN = $(CURDIR)/bin
5+
GOBIN = $(GOPATH)/bin
6+
GOARCH = amd64
7+
8+
.PHONY: bin-deps
9+
bin-deps:
10+
$(info Installing binary dependencies...)
11+
GOBIN=$(LOCAL_BIN) go install github.com/golangci/golangci-lint/cmd/[email protected]
12+
13+
.PHONY: .lint
14+
.lint:
15+
$(LOCAL_BIN)/golangci-lint run --config=.golangci.yaml ./...
16+
17+
.PHONY: lint
18+
lint: bin-deps .lint
19+
20+
.PHONY: build
21+
build: build-linux build-darwin
22+
23+
.PHONY: build-linux
24+
build-linux:
25+
go mod download && CGO_ENABLED=0 \
26+
GOOS=linux GOARCH=${GOARCH} go build -o ${LOCAL_BIN}/git-update-linux-${GOARCH} ./cmd/main.go;
27+
28+
.PHONY: build-darwin
29+
build-darwin:
30+
go mod download && CGO_ENABLED=0 \
31+
GOOS=darwin GOARCH=${GOARCH} go build -o ${LOCAL_BIN}/git-update-darwin-${GOARCH} ./cmd/main.go;
32+
33+
.PHONY: test
34+
test:
35+
go test ./... -count=1 -timeout=60s -v -short
36+
37+
.PHONY: install
38+
install:
39+
go build -o $(GOBIN)/protogen -ldflags "$(LDFLAGS)" $(CURDIR)/cmd

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# git-update
2+
3+
# Описание
4+
Программа создана благодаря лени и для ускорения актуализации всех репозиториев
5+
находящихся в одном корневом каталоге.
6+
7+
# Требования
8+
Операционная система на MacOS или Linux, Windows тоже подойдет пожалуй, но не тестировалось.
9+
10+
# Использование
11+
Ключи запуска:
12+
- dir - Путь к корневому каталогу с проектами, по умолчанию "../"
13+
- branch - Наименование корневой ветки: master/main
14+
- all - Выполнить все шаги checkout master, fetch, pull, по умолчанию выключено
15+
- checkout - Выполнить git checkout на корневую ветку, по умолчанию выключено
16+
- fetch - Выполнить git fetch --prune, по умолчанию выключено
17+
- pull - Выполнить git pull, по умолчанию выключено
18+
- execute_timeout - Максимальное время выполнения всех действий над допкаталогом, по умолчанию 30сек

cmd/main.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package main
2+
3+
import (
4+
"github.com/Format-C-eft/git-update/internal/cmd"
5+
)
6+
7+
func main() {
8+
cmd.Execute()
9+
}

0 commit comments

Comments
 (0)