Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.

Commit c30c076

Browse files
authored
chore: cleanup ci scripts (#228)
1 parent b8067c0 commit c30c076

36 files changed

+107
-101
lines changed

.github/workflows/integration.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ jobs:
2323
with:
2424
go-version: '^1.14'
2525
- name: integration tests
26-
run: ./ci/steps/integration.sh
26+
run: ./ci/scripts/integration.sh

.github/workflows/test.yaml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ jobs:
1515
- name: fmt
1616
uses: ./ci/image
1717
with:
18-
args: ./ci/steps/fmt.sh
18+
args: make -j fmt
19+
- run: ./ci/scripts/files_changed.sh
1920
lint:
2021
runs-on: ubuntu-latest
2122
steps:
@@ -38,7 +39,7 @@ jobs:
3839
- name: test
3940
uses: ./ci/image
4041
with:
41-
args: ./ci/steps/unit_test.sh
42+
args: make -j test/go
4243
gendocs:
4344
runs-on: ubuntu-latest
4445
steps:
@@ -52,4 +53,5 @@ jobs:
5253
- name: generate-docs
5354
uses: ./ci/image
5455
with:
55-
args: ./ci/steps/gendocs.sh
56+
args: make -j gendocs
57+
- run: ./ci/scripts/files_changed.sh

Makefile

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Makefile for Coder CLI
22

3-
.PHONY: clean build build/macos build/windows build/linux
3+
.PHONY: clean build build/macos build/windows build/linux fmt lint gendocs test/go
4+
5+
PROJECT_ROOT := $(shell git rev-parse --show-toplevel)
6+
MAKE_ROOT := $(shell pwd)
47

58
clean:
69
rm -rf ./ci/bin
@@ -9,8 +12,24 @@ build: build/macos build/windows build/linux
912

1013
build/macos:
1114
# requires darwin
12-
CGO_ENABLED=1 GOOS=darwin GOARCH=amd64 ./ci/steps/build.sh
15+
CGO_ENABLED=1 GOOS=darwin GOARCH=amd64 ./ci/scripts/build.sh
1316
build/windows:
14-
CGO_ENABLED=0 GOOS=windows GOARCH=386 ./ci/steps/build.sh
17+
CGO_ENABLED=0 GOOS=windows GOARCH=386 ./ci/scripts/build.sh
1518
build/linux:
16-
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 ./ci/steps/build.sh
19+
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 ./ci/scripts/build.sh
20+
21+
fmt:
22+
go mod tidy
23+
gofmt -w -s .
24+
goimports -w "-local=$$(go list -m)" .
25+
26+
lint:
27+
golangci-lint run -c .golangci.yml
28+
29+
gendocs:
30+
rm -rf ./docs
31+
mkdir ./docs
32+
go run ./cmd/coder gen-docs ./docs
33+
34+
test/go:
35+
go test $$(go list ./... | grep -v pkg/tcli | grep -v ci/integration | grep -v coder-sdk)

ci/integration/envs_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,13 @@ import (
1010
"testing"
1111
"time"
1212

13-
"cdr.dev/coder-cli/coder-sdk"
14-
"cdr.dev/coder-cli/pkg/tcli"
1513
"cdr.dev/slog"
1614
"cdr.dev/slog/sloggers/slogtest"
1715
"cdr.dev/slog/sloggers/slogtest/assert"
1816
"github.com/google/go-cmp/cmp"
17+
18+
"cdr.dev/coder-cli/coder-sdk"
19+
"cdr.dev/coder-cli/pkg/tcli"
1920
)
2021

2122
func cleanupClient(ctx context.Context, t *testing.T) *coder.Client {

ci/integration/integration_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ import (
66
"testing"
77
"time"
88

9-
"cdr.dev/coder-cli/pkg/tcli"
109
"cdr.dev/slog/sloggers/slogtest/assert"
10+
11+
"cdr.dev/coder-cli/pkg/tcli"
1112
)
1213

1314
func run(t *testing.T, container string, execute func(t *testing.T, ctx context.Context, runner *tcli.ContainerRunner)) {

ci/integration/setup_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ import (
99
"strings"
1010
"testing"
1111

12-
"cdr.dev/coder-cli/pkg/tcli"
1312
"golang.org/x/xerrors"
13+
14+
"cdr.dev/coder-cli/pkg/tcli"
1415
)
1516

1617
// binpath is populated during package initialization with a path to the coder binary.

ci/integration/tags_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ import (
44
"context"
55
"testing"
66

7+
"cdr.dev/slog/sloggers/slogtest/assert"
8+
79
"cdr.dev/coder-cli/coder-sdk"
810
"cdr.dev/coder-cli/pkg/tcli"
9-
"cdr.dev/slog/sloggers/slogtest/assert"
1011
)
1112

1213
func TestTags(t *testing.T) {

ci/integration/users_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ import (
44
"context"
55
"testing"
66

7+
"cdr.dev/slog/sloggers/slogtest/assert"
8+
79
"cdr.dev/coder-cli/coder-sdk"
810
"cdr.dev/coder-cli/pkg/tcli"
9-
"cdr.dev/slog/sloggers/slogtest/assert"
1011
)
1112

1213
func TestUsers(t *testing.T) {

ci/steps/build.sh renamed to ci/scripts/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ popd() { builtin popd >/dev/null; }
66

77
set -euo pipefail
88

9-
cd "$(git rev-parse --show-toplevel)/ci/steps"
9+
cd "$(git rev-parse --show-toplevel)/ci/scripts"
1010

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

ci/scripts/files_changed.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
3+
set -euo pipefail
4+
5+
cd "$(git rev-parse --show-toplevel)"
6+
7+
if [[ $(git ls-files --other --modified --exclude-standard) ]]; then
8+
echo "Files have changed:"
9+
git -c color.ui=never status
10+
exit 1
11+
fi

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy