File tree Expand file tree Collapse file tree 17 files changed +140
-115
lines changed Expand file tree Collapse file tree 17 files changed +140
-115
lines changed Original file line number Diff line number Diff line change
1
+ name : release
2
+ on :
3
+ push :
4
+ tags :
5
+ - " v*"
6
+ jobs :
7
+ goreleaser :
8
+ runs-on : ubuntu-latest
9
+ steps :
10
+ - uses : actions/checkout@v3
11
+ with :
12
+ fetch-depth : 0
13
+ - uses : actions/setup-go@v2
14
+ with :
15
+ go-version : " ^1.17"
16
+
17
+ - name : Run GoReleaser
18
+ uses : goreleaser/goreleaser-action@v2.9.1
19
+ with :
20
+ version : latest
21
+ args : release --rm-dist
22
+ env :
23
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
Original file line number Diff line number Diff line change @@ -25,5 +25,5 @@ site/yarn-error.log
25
25
coverage /
26
26
27
27
# Build
28
- bin /
28
+ dist /
29
29
site /out /
Original file line number Diff line number Diff line change
1
+ archives :
2
+ - builds :
3
+ - coder
4
+ files :
5
+ - README.md
6
+
7
+ before :
8
+ hooks :
9
+ - go mod tidy
10
+ - rm -f site/out/bin/coder*
11
+
12
+ builds :
13
+ - id : coder-slim
14
+ dir : cmd/coder
15
+ flags : [-tags=slim]
16
+ ldflags : ["-s -w"]
17
+ env : [CGO_ENABLED=0]
18
+ goos : [linux, windows]
19
+ goarch : [amd64, arm64]
20
+ hooks :
21
+ # The "trimprefix" appends ".exe" on Windows.
22
+ post : |
23
+ cp {{.Path}} site/out/bin/coder_{{ .Os }}_{{ .Arch }}{{ trimprefix .Name "coder" }}
24
+
25
+ - id : coder-slim-darwin
26
+ dir : cmd/coder
27
+ flags : [-tags=slim]
28
+ ldflags : ["-s -w"]
29
+ env : [CGO_ENABLED=0]
30
+ goos : [darwin]
31
+ goarch : [amd64, arm64]
32
+ hooks :
33
+ post : |
34
+ cp {{.Path}} site/out/bin/coder_{{ .Os }}_{{ .Arch }}
35
+
36
+ - id : coder
37
+ dir : cmd/coder
38
+ ldflags : ["-s -w"]
39
+ env : [CGO_ENABLED=0]
40
+ goos : [linux, windows]
41
+ goarch : [amd64, arm64]
42
+
43
+ - id : coder-darwin
44
+ dir : cmd/coder
45
+ ldflags : ["-s -w"]
46
+ env : [CGO_ENABLED=0]
47
+ goos : [darwin]
48
+ goarch : [amd64, arm64]
49
+
50
+ nfpms :
51
+ - vendor : Coder
52
+ homepage : https://coder.com
53
+ maintainer : Coder <support@coder.com>
54
+ description : |
55
+ Provision development environments with infrastructure with code
56
+ formats :
57
+ - apk
58
+ - deb
59
+ - rpm
60
+ suggests :
61
+ - postgresql
62
+ builds :
63
+ - coder
64
+
65
+ release :
66
+ ids : [coder, coder-darwin]
Original file line number Diff line number Diff line change 35
35
" drpcmux" ,
36
36
" drpcserver" ,
37
37
" fatih" ,
38
+ " goarch" ,
38
39
" goleak" ,
39
40
" gossh" ,
40
41
" hashicorp" ,
41
42
" httpmw" ,
42
43
" idtoken" ,
44
+ " incpatch" ,
43
45
" isatty" ,
44
46
" Jobf" ,
45
47
" kirsle" ,
48
+ " ldflags" ,
46
49
" manifoldco" ,
47
50
" mattn" ,
48
51
" mitchellh" ,
49
52
" moby" ,
53
+ " nfpms" ,
50
54
" nhooyr" ,
51
55
" nolint" ,
52
56
" nosec" ,
66
70
" tcpip" ,
67
71
" tfexec" ,
68
72
" tfstate" ,
73
+ " trimprefix" ,
69
74
" unconvert" ,
70
75
" webrtc" ,
71
76
" xerrors" ,
Original file line number Diff line number Diff line change @@ -2,17 +2,11 @@ INSTALL_DIR=$(shell go env GOPATH)/bin
2
2
GOOS =$(shell go env GOOS)
3
3
GOARCH =$(shell go env GOARCH)
4
4
5
- bin/coder :
6
- mkdir -p bin
7
- GOOS=$(GOOS ) GOARCH=$(GOARCH ) go build -o bin/coder-$(GOOS ) -$(GOARCH ) cmd/coder/main.go
8
- .PHONY : bin/coder
5
+ bin :
6
+ goreleaser build --single-target --snapshot --rm-dist
7
+ .PHONY : bin
9
8
10
- bin/coderd :
11
- mkdir -p bin
12
- go build -o bin/coderd cmd/coderd/main.go
13
- .PHONY : bin/coderd
14
-
15
- build : site/out bin/coder bin/coderd
9
+ build : site/out bin
16
10
.PHONY : build
17
11
18
12
# Runs migrations to output a dump of the database.
@@ -55,9 +49,9 @@ fmt: fmt/prettier fmt/sql
55
49
gen : database/generate peerbroker/proto provisionersdk/proto provisionerd/proto
56
50
.PHONY : gen
57
51
58
- install :
52
+ install : bin
59
53
@echo " --- Copying from bin to $( INSTALL_DIR) "
60
- cp -r ./bin $(INSTALL_DIR )
54
+ cp -r ./dist/coder_ $( GOOS ) _ $( GOARCH ) $(INSTALL_DIR )
61
55
@echo " -- CLI available at $( shell ls $( INSTALL_DIR) /coder* ) "
62
56
.PHONY : install
63
57
@@ -92,4 +86,10 @@ site/out:
92
86
./scripts/yarn_install.sh
93
87
cd site && yarn build
94
88
cd site && yarn export
89
+ # Restores GITKEEP files!
90
+ git checkout HEAD site/out
95
91
.PHONY : site/out
92
+
93
+ snapshot :
94
+ goreleaser release --snapshot --rm-dist
95
+ .PHONY : snapshot
Original file line number Diff line number Diff line change 1
- package cmd
1
+ package cli
2
2
3
3
import (
4
4
"context"
@@ -25,12 +25,12 @@ import (
25
25
"github.com/coder/coder/provisionersdk/proto"
26
26
)
27
27
28
- func Root () * cobra.Command {
28
+ func daemon () * cobra.Command {
29
29
var (
30
30
address string
31
31
)
32
32
root := & cobra.Command {
33
- Use : "coderd " ,
33
+ Use : "daemon " ,
34
34
RunE : func (cmd * cobra.Command , args []string ) error {
35
35
logger := slog .Make (sloghuman .Sink (os .Stderr ))
36
36
accessURL := & url.URL {
Original file line number Diff line number Diff line change 1
- package cmd_test
1
+ package cli_test
2
2
3
3
import (
4
4
"context"
5
5
"testing"
6
6
7
7
"github.com/stretchr/testify/require"
8
8
9
- "github.com/coder/coder/coderd/cmd "
9
+ "github.com/coder/coder/cli/clitest "
10
10
)
11
11
12
- func TestRoot (t * testing.T ) {
12
+ func TestDaemon (t * testing.T ) {
13
13
t .Parallel ()
14
14
ctx , cancelFunc := context .WithCancel (context .Background ())
15
15
go cancelFunc ()
16
- err := cmd .Root ().ExecuteContext (ctx )
16
+ root , _ := clitest .New (t , "daemon" )
17
+ err := root .ExecuteContext (ctx )
17
18
require .ErrorIs (t , err , context .Canceled )
18
19
}
Original file line number Diff line number Diff line change @@ -64,6 +64,7 @@ func Root() *cobra.Command {
64
64
`Additional help topics:` , header .Sprint ("Additional help:" ),
65
65
).Replace (cmd .UsageTemplate ()))
66
66
67
+ cmd .AddCommand (daemon ())
67
68
cmd .AddCommand (login ())
68
69
cmd .AddCommand (projects ())
69
70
cmd .AddCommand (workspaces ())
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -24,17 +24,12 @@ function create_initial_user() {
24
24
# Run yarn install, to make sure node_modules are ready to go
25
25
" $PROJECT_ROOT /scripts/yarn_install.sh"
26
26
27
- # Do initial build - a dev build for coderd.
28
- # It's OK that we don't build the front-end before - because the front-end
29
- # assets are handled by the `yarn dev` devserver.
30
- make bin/coderd
31
-
32
27
# This is a way to run multiple processes in parallel, and have Ctrl-C work correctly
33
28
# to kill both at the same time. For more details, see:
34
29
# https://stackoverflow.com/questions/3004811/how-do-you-run-multiple-programs-in-parallel-from-a-bash-script
35
30
(
36
31
trap ' kill 0' SIGINT
37
32
create_initial_user &
38
33
CODERV2_HOST=http://127.0.0.1:3000 yarn --cwd=./site dev &
39
- ./bin/coderd
34
+ go run cmd/coder/main.go daemon
40
35
)
You can’t perform that action at this time.
0 commit comments