Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Aug 30, 2024. It is now read-only.
/coder-v1-cliPublic archive

Commite99a75b

Browse files
authored
Build linux/windows on ubuntu runner (#202)
1 parent9b94c77 commite99a75b

File tree

7 files changed

+105
-58
lines changed

7 files changed

+105
-58
lines changed

‎.github/workflows/build.yaml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,18 @@ on: [push]
33

44
jobs:
55
build:
6+
runs-on:ubuntu-20.04
7+
steps:
8+
-name:Checkout
9+
uses:actions/checkout@v1
10+
-name:Build
11+
run:make -j build/linux build/windows
12+
-name:Upload
13+
uses:actions/upload-artifact@v2
14+
with:
15+
name:coder-cli
16+
path:./ci/bin/coder-cli-*
17+
build_darwin:
618
runs-on:macos-latest
719
steps:
820
-name:Checkout
@@ -17,7 +29,7 @@ jobs:
1729
p12-file-base64:${{ secrets.APPLE_DEVELOPER_CERTIFICATE_P12_BASE64 }}
1830
p12-password:${{ secrets.APPLE_DEVELOPER_CERTIFICATE_PASSWORD }}
1931
-name:Build
20-
run:./ci/steps/build.sh
32+
run:makebuild/macos
2133
env:
2234
AC_USERNAME:${{ secrets.AC_USERNAME }}
2335
AC_PASSWORD:${{ secrets.AC_PASSWORD }}

‎.github/workflows/release.yaml

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,25 @@ on:
44
name:create_github_release
55
jobs:
66
build:
7-
name:Create Release
7+
name:Build binaries
8+
runs-on:ubuntu-20.04
9+
steps:
10+
-name:Checkout code
11+
uses:actions/checkout@v2
12+
-name:Build
13+
run:make -j build/linux build/windows
14+
-name:Upload linux
15+
uses:actions/upload-artifact@v2
16+
with:
17+
name:coder-cli-linux-amd64
18+
path:./ci/bin/coder-cli-linux-amd64.tar.gz
19+
-name:Upload windows
20+
uses:actions/upload-artifact@v2
21+
with:
22+
name:coder-cli-windows-386
23+
path:./ci/bin/coder-cli-windows-386.zip
24+
build_darwin:
25+
name:Build darwin binary
826
runs-on:macos-latest
927
steps:
1028
-name:Checkout code
@@ -19,10 +37,25 @@ jobs:
1937
p12-file-base64:${{ secrets.APPLE_DEVELOPER_CERTIFICATE_P12_BASE64 }}
2038
p12-password:${{ secrets.APPLE_DEVELOPER_CERTIFICATE_PASSWORD }}
2139
-name:Build Release Assets
22-
run:./ci/steps/build.sh
40+
run:makebuild/macos
2341
env:
2442
AC_USERNAME:${{ secrets.AC_USERNAME }}
2543
AC_PASSWORD:${{ secrets.AC_PASSWORD }}
44+
-name:Upload darwin
45+
uses:actions/upload-artifact@v2
46+
with:
47+
name:coder-cli-darwin-amd64
48+
path:./ci/bin/coder-cli-darwin-amd64.zip
49+
draft_release:
50+
name:Create Release
51+
runs-on:ubuntu-20.04
52+
needs:
53+
-build_darwin
54+
-build
55+
steps:
56+
-uses:actions/download-artifact@v2
57+
-name:content
58+
run:sh -c "ls -al"
2659
-name:Create Release
2760
id:create_release
2861
uses:actions/create-release@v1
@@ -41,7 +74,7 @@ jobs:
4174
GITHUB_TOKEN:${{ secrets.GITHUB_TOKEN }}
4275
with:
4376
upload_url:${{ steps.create_release.outputs.upload_url }}
44-
asset_path:./ci/bin/coder-cli-linux-amd64.tar.gz
77+
asset_path:coder-cli-linux-amd64/coder-cli-linux-amd64.tar.gz
4578
asset_name:coder-cli-linux-amd64.tar.gz
4679
asset_content_type:application/tar+gzip
4780
-name:Upload MacOS Release
@@ -51,7 +84,7 @@ jobs:
5184
GITHUB_TOKEN:${{ secrets.GITHUB_TOKEN }}
5285
with:
5386
upload_url:${{ steps.create_release.outputs.upload_url }}
54-
asset_path:./ci/bin/coder-cli-darwin-amd64.zip
87+
asset_path:coder-cli-darwin-amd64/coder-cli-darwin-amd64.zip
5588
asset_name:coder-cli-darwin-amd64.zip
5689
asset_content_type:application/zip
5790
-name:Upload Windows Release
@@ -61,6 +94,6 @@ jobs:
6194
GITHUB_TOKEN:${{ secrets.GITHUB_TOKEN }}
6295
with:
6396
upload_url:${{ steps.create_release.outputs.upload_url }}
64-
asset_path:./ci/bin/coder-cli-windows-386.zip
97+
asset_path:coder-cli-windows-386/coder-cli-windows-386.zip
6598
asset_name:coder-cli-windows-386.zip
6699
asset_content_type:application/zip

‎Makefile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Makefile for Coder CLI
2+
3+
.PHONY: clean build build/macos build/windows build/linux
4+
5+
clean:
6+
rm -rf ./ci/bin
7+
8+
build: build/macos build/windows build/linux
9+
10+
build/macos:
11+
# requires darwin
12+
CGO_ENABLED=1 GOOS=darwin GOARCH=amd64 ./ci/steps/build.sh
13+
build/windows:
14+
CGO_ENABLED=0 GOOS=windows GOARCH=386 ./ci/steps/build.sh
15+
build/linux:
16+
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 ./ci/steps/build.sh

‎ci/integration/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
FROM ubuntu:20.04
22

3-
RUN apt-get update && apt-get install -y jq curl
3+
RUN apt-get update && apt-get install -y jq curl build-essential

‎ci/integration/setup_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func build(path string) error {
3737
cmd:=exec.Command(
3838
"sh","-c",
3939
fmt.Sprintf(
40-
"cd ../../ && mkdir -p %s &&./ci/steps/build.sh && cp ./ci/bin/%s %s/ && tar -xzf %s -C %s",
40+
"cd ../../ && mkdir -p %s &&makebuild/linux && cp ./ci/bin/%s %s/ && tar -xzf %s -C %s",
4141
dir,tar,dir,filepath.Join(dir,tar),dir),
4242
)
4343

‎ci/steps/build.sh

Lines changed: 35 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -10,52 +10,38 @@ cd "$(git rev-parse --show-toplevel)/ci/steps"
1010

1111
tag=$(git describe --tags)
1212

13-
build() {
14-
echo"--- building coder-cli for$GOOS-$GOARCH"
15-
16-
tmpdir=$(mktemp -d)
17-
go build -ldflags"-X cdr.dev/coder-cli/internal/version.Version=${tag}" -o"$tmpdir/coder" ../../cmd/coder
18-
# For MacOS builds to be notarized.
19-
cp ../gon.json$tmpdir/gon.json
20-
21-
pushd"$tmpdir"
22-
case"$GOOS"in
23-
"windows")
24-
artifact="coder-cli-$GOOS-$GOARCH.zip"
25-
mv coder coder.exe
26-
zip"$artifact" coder.exe
27-
;;
28-
"linux")
29-
artifact="coder-cli-$GOOS-$GOARCH.tar.gz"
30-
tar -czf"$artifact" coder
31-
;;
32-
"darwin")
33-
if [[${CI-} ]];then
34-
artifact="coder-cli-$GOOS-$GOARCH.zip"
35-
gon -log-level debug ./gon.json
36-
mv coder.zip$artifact
37-
else
38-
artifact="coder-cli-$GOOS-$GOARCH.tar.gz"
39-
tar -czf"$artifact" coder
40-
echo"--- warning: not in ci, skipping signed release of darwin"
41-
fi
42-
;;
43-
esac
44-
popd
45-
46-
mkdir -p ../bin
47-
cp"$tmpdir/$artifact" ../bin/$artifact
48-
rm -rf"$tmpdir"
49-
}
50-
51-
# Darwin builds do not work from Linux, so only try to build them from Darwin.
52-
# See: https://github.com/cdr/coder-cli/issues/20
53-
if [["$(uname)"=="Darwin" ]];then
54-
CGO_ENABLED=1 GOOS=darwin GOARCH=amd64 build
55-
else
56-
echo"--- warning: Darwin builds don't work on Linux."
57-
echo"--- please use an OSX machine to build Darwin tars."
58-
fi
59-
60-
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 build
61-
GOOS=windows GOARCH=386 build
13+
echo"--- building coder-cli for$GOOS-$GOARCH"
14+
15+
tmpdir=$(mktemp -d)
16+
go build -ldflags"-X cdr.dev/coder-cli/internal/version.Version=${tag}" -o"$tmpdir/coder" ../../cmd/coder
17+
18+
cp ../gon.json$tmpdir/gon.json
19+
20+
pushd"$tmpdir"
21+
case"$GOOS"in
22+
"windows")
23+
artifact="coder-cli-$GOOS-$GOARCH.zip"
24+
mv coder coder.exe
25+
zip"$artifact" coder.exe
26+
;;
27+
"linux")
28+
artifact="coder-cli-$GOOS-$GOARCH.tar.gz"
29+
tar -czf"$artifact" coder
30+
;;
31+
"darwin")
32+
if [[${CI-} ]];then
33+
artifact="coder-cli-$GOOS-$GOARCH.zip"
34+
gon -log-level debug ./gon.json
35+
mv coder.zip$artifact
36+
else
37+
artifact="coder-cli-$GOOS-$GOARCH.tar.gz"
38+
tar -czf"$artifact" coder
39+
echo"--- warning: not in ci, skipping signed release of darwin"
40+
fi
41+
;;
42+
esac
43+
popd
44+
45+
mkdir -p ../bin
46+
cp"$tmpdir/$artifact" ../bin/$artifact
47+
rm -rf"$tmpdir"

‎pkg/tcli/tcli.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ func NewContainerRunner(ctx context.Context, config *ContainerConfig) (*Containe
6767
"run",
6868
"--name",config.Name,
6969
"--network","host",
70-
"-it","-d",
70+
"--rm","-it","-d",
7171
}
7272
args=append(args,mountArgs(config.BindMounts)...)
7373
args=append(args,config.Image)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp