Skip to content

Commit a99285e

Browse files
authored
Merge pull request #2 from oota-sushikuitee/feat/MVP
Feature: Implement v0.1.0
2 parents d977012 + a1ccfd7 commit a99285e

33 files changed

+3628
-91
lines changed

.github/labeler.yml

+10-16
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,6 @@ area/github-management:
33
- any-glob-to-any-file:
44
- ".github/**"
55

6-
area/documentation:
7-
- changed-files:
8-
- any-glob-to-any-file:
9-
- "**/*.md"
10-
- "**/*.txt"
11-
- "docs/**"
12-
13-
area/testing:
14-
- changed-files:
15-
- any-glob-to-any-file:
16-
- "**/*_test.go"
17-
- "**/testdata/*"
18-
196
area/cmd:
207
- changed-files:
218
- any-glob-to-any-file:
@@ -31,11 +18,18 @@ area/internal:
3118
- any-glob-to-any-file:
3219
- "internal/**"
3320

34-
kind/feature:
35-
- head-branch: ["^feat", "feat"]
36-
3721
kind/bugfix:
3822
- head-branch: ["^fix", "fix"]
3923

24+
kind/documentation:
25+
- changed-files:
26+
- any-glob-to-any-file:
27+
- "**/*.md"
28+
- "**/*.txt"
29+
- "docs/**"
30+
31+
kind/feature:
32+
- head-branch: ["^feat", "feat"]
33+
4034
kind:refactor:
4135
- head-branch: ["^refactor", "refactor"]

.github/workflows/golangci-lint.yml

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: reviewdog / golangci-lint
1+
name: golangci-lint
22

33
on:
44
pull_request:
@@ -13,8 +13,13 @@ jobs:
1313
steps:
1414
- name: checkout
1515
uses: actions/checkout@v4
16+
17+
- name: setup go
18+
uses: actions/setup-go@v5
1619
with:
17-
fetch-depth: 0
20+
go-version-file: "go.mod"
1821

1922
- name: golangci-lint
20-
uses: reviewdog/action-golangci-lint@v2
23+
uses: golangci/golangci-lint-action@v5
24+
with:
25+
version: latest

.github/workflows/test.yml

+17-3
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,24 @@ on:
88
branches:
99
- main
1010

11-
permissions:
12-
contents: read
13-
1411
jobs:
12+
go-mod:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: checkout
16+
uses: actions/checkout@v4
17+
18+
- name: setup go
19+
uses: actions/setup-go@v5
20+
with:
21+
go-version-file: "go.mod"
22+
23+
- name: Check go.mod / go.sum
24+
run: |
25+
go mod tidy
26+
git diff --exit-code go.mod
27+
git diff --exit-code go.sum
28+
1529
test:
1630
runs-on: ubuntu-latest
1731
steps:

.golangci.yml

+20-21
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,36 @@
11
run:
2-
timeout: "10m"
3-
tests: true
4-
allow-parallel-runners: false
5-
go: "1.21.5"
6-
7-
linters-settings:
8-
misspell:
9-
locale: "US"
10-
govet:
11-
enable-all: true
12-
disable:
13-
- fieldalignment
2+
timeout: "20m"
3+
allow-parallel-runners: true
4+
go: "1.23"
145

156
linters:
167
disable-all: true
178
enable:
189
- bodyclose
19-
- forcetypeassert
10+
- errcheck
2011
- gocritic
2112
- goimports
2213
- gosimple
2314
- govet
24-
- makezero
25-
- misspell
26-
- nilerr
15+
- ineffassign
2716
- noctx
28-
- revive
2917
- staticcheck
3018
- unused
3119

20+
linters-settings:
21+
govet:
22+
enable-all: true
23+
staticcheck:
24+
checks: ["-SA1006"]
25+
3226
issues:
3327
exclude-use-default: true
34-
exclude-case-sensitive: false
35-
max-issues-per-linter: 50
36-
max-same-issues: 3
37-
new: false
28+
exclude-rules:
29+
- path: _test\.go
30+
linters:
31+
- errcheck
32+
- noctx
33+
- govet
34+
35+
output:
36+
print-linter-name: true

cmd/nigiri/main.go

+9-33
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,15 @@
11
package main
22

3-
import "github.com/spf13/cobra"
3+
import (
4+
"fmt"
5+
"os"
46

5-
func main() {
6-
var buildCmd = &cobra.Command{
7-
Use: "build",
8-
Short: "TODO: Add a brief description",
9-
Run: func(cmd *cobra.Command, args []string) {
10-
// Do stuff
11-
},
12-
}
13-
14-
var runCmd = &cobra.Command{
15-
Use: "run",
16-
Short: "TODO: Add a brief description",
17-
Run: func(cmd *cobra.Command, args []string) {
18-
// Do stuff
19-
},
20-
}
7+
"github.com/oota-sushikuitee/nigiri/pkg/commands"
8+
)
219

22-
var removeCmd = &cobra.Command{
23-
Use: "remove",
24-
Short: "TODO: Add a brief description",
25-
Run: func(cmd *cobra.Command, args []string) {
26-
// Do stuff
27-
},
28-
}
29-
30-
var rootCmd = &cobra.Command{
31-
Use: "TODO: Add a description",
32-
Short: "TODO: Add a brief description",
10+
func main() {
11+
if err := commands.NewRootCommand().Execute(); err != nil {
12+
fmt.Println(err)
13+
os.Exit(1)
3314
}
34-
35-
rootCmd.AddCommand(buildCmd)
36-
rootCmd.AddCommand(runCmd)
37-
rootCmd.AddCommand(removeCmd)
38-
rootCmd.Execute()
3915
}

docs/design-docs/api-design.md

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# API Design
2+
3+
## Overview
4+
5+
```bash
6+
$ nigiri build <target> <options>
7+
# build the target under the ~/.nigiri/<target>/<commit-hash> directory
8+
# ~/.nigiri/<target>/<commit-hash> has the following structure:
9+
# - bin/: contains the built binary
10+
# - src/: contains the source code
11+
# - build.json: contains the build information
12+
```
13+
14+
```bash
15+
$ nigiri run <options> <target>
16+
# run the target under the ~/.nigiri/<target>/<commit-hash> directory
17+
```
18+
19+
```bash
20+
$ nigiri remove <target> <commit-hash>
21+
# remove the target under the ~/.nigiri/<target>/<commit-hash> directory
22+
```

example/.nigiri.yml

+27-13
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,27 @@
1-
build:
2-
golangci-lint:
3-
- source: github.com/golangci/golangci-lint/
4-
- build-command:
5-
- linux: make build
6-
- windows: make build
7-
- darwin: make build
8-
reviewdog:
9-
- source: github.com/reviewdog/reviewdog
10-
- build-command:
11-
- linux: make build
12-
- windows: make build
13-
- darwin: make build
1+
targets:
2+
nigiri:
3+
source: https://github.com/oota-sushikuitee/nigiri
4+
default-branch: main
5+
build-command:
6+
linux: make build
7+
windows: make build
8+
darwin: make build
9+
dotfiles:
10+
source: https://github.com/Okabe-Junya/dotfiles
11+
default-branch: main
12+
build-command:
13+
linux: make
14+
windows: make
15+
darwin: make
16+
configs:
17+
source: https://github.com/Okabe-Junya/.github
18+
default-branch: main
19+
build-command:
20+
linux: make
21+
windows: make
22+
darwin: make
23+
defaults:
24+
build-command:
25+
linux: make build
26+
windows: make build
27+
darwin: make build

go.mod

+42-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,50 @@
11
module github.com/oota-sushikuitee/nigiri
22

3-
go 1.22.3
3+
go 1.23.0
44

5-
require github.com/spf13/cobra v1.9.1
5+
toolchain go1.24.1
66

77
require (
8+
github.com/go-git/go-git/v5 v5.14.0
9+
github.com/spf13/cobra v1.9.1
10+
github.com/spf13/viper v1.20.0
11+
github.com/stretchr/testify v1.10.0
12+
)
13+
14+
require (
15+
dario.cat/mergo v1.0.1 // indirect
16+
github.com/Microsoft/go-winio v0.6.2 // indirect
17+
github.com/ProtonMail/go-crypto v1.1.6 // indirect
18+
github.com/cloudflare/circl v1.6.0 // indirect
19+
github.com/cyphar/filepath-securejoin v0.4.1 // indirect
20+
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
21+
github.com/emirpasic/gods v1.18.1 // indirect
22+
github.com/fsnotify/fsnotify v1.8.0 // indirect
23+
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
24+
github.com/go-git/go-billy/v5 v5.6.2 // indirect
25+
github.com/go-viper/mapstructure/v2 v2.2.1 // indirect
26+
github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 // indirect
827
github.com/inconshreveable/mousetrap v1.1.0 // indirect
28+
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
29+
github.com/kevinburke/ssh_config v1.2.0 // indirect
30+
github.com/pelletier/go-toml/v2 v2.2.3 // indirect
31+
github.com/pjbgf/sha1cd v0.3.2 // indirect
32+
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
33+
github.com/sagikazarmark/locafero v0.8.0 // indirect
34+
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 // indirect
35+
github.com/skeema/knownhosts v1.3.1 // indirect
36+
github.com/sourcegraph/conc v0.3.0 // indirect
37+
github.com/spf13/afero v1.14.0 // indirect
38+
github.com/spf13/cast v1.7.1 // indirect
939
github.com/spf13/pflag v1.0.6 // indirect
40+
github.com/subosito/gotenv v1.6.0 // indirect
41+
github.com/xanzy/ssh-agent v0.3.3 // indirect
42+
go.uber.org/multierr v1.11.0 // indirect
43+
golang.org/x/crypto v0.36.0 // indirect
44+
golang.org/x/exp v0.0.0-20250305212735-054e65f0b394 // indirect
45+
golang.org/x/net v0.37.0 // indirect
46+
golang.org/x/sys v0.31.0 // indirect
47+
golang.org/x/text v0.23.0 // indirect
48+
gopkg.in/warnings.v0 v0.1.2 // indirect
49+
gopkg.in/yaml.v3 v3.0.1 // indirect
1050
)

0 commit comments

Comments
 (0)