Skip to content

Commit d8abc3a

Browse files
committed
Switch CI to an optimized ubuntu docker image
1 parent a2abcd4 commit d8abc3a

File tree

5 files changed

+32
-31
lines changed

5 files changed

+32
-31
lines changed

.circleci/config.yml

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ jobs:
77
- checkout
88
- restore_cache:
99
keys:
10-
- go-v1-{{ checksum "go.sum" }}
10+
- go-v3-{{ checksum "go.sum" }}
1111
# Fallback to using the latest cache if no exact match is found.
12-
- go-v1-
12+
- go-v3-
1313
- run: ./ci/fmt.sh
1414
- save_cache:
1515
paths:
16-
- /root/go
16+
- /root/gopath
1717
- /root/.cache/go-build
18-
key: go-v1-{{ checksum "go.sum" }}
18+
key: go-v3-{{ checksum "go.sum" }}
1919

2020
lint:
2121
docker:
@@ -24,15 +24,15 @@ jobs:
2424
- checkout
2525
- restore_cache:
2626
keys:
27-
- go-v1-{{ checksum "go.sum" }}
27+
- go-v3-{{ checksum "go.sum" }}
2828
# Fallback to using the latest cache if no exact match is found.
29-
- go-v1-
29+
- go-v3-
3030
- run: ./ci/lint.sh
3131
- save_cache:
3232
paths:
33-
- /root/go
33+
- /root/gopath
3434
- /root/.cache/go-build
35-
key: go-v1-{{ checksum "go.sum" }}
35+
key: go-v3-{{ checksum "go.sum" }}
3636

3737
test:
3838
docker:
@@ -41,18 +41,18 @@ jobs:
4141
- checkout
4242
- restore_cache:
4343
keys:
44-
- go-v1-{{ checksum "go.sum" }}
44+
- go-v3-{{ checksum "go.sum" }}
4545
# Fallback to using the latest cache if no exact match is found.
46-
- go-v1-
46+
- go-v3-
4747
- run: ./ci/test.sh
4848
- store_artifacts:
4949
path: ci/out
5050
destination: out
5151
- save_cache:
5252
paths:
53-
- /root/go
53+
- /root/gopath
5454
- /root/.cache/go-build
55-
key: go-v1-{{ checksum "go.sum" }}
55+
key: go-v3-{{ checksum "go.sum" }}
5656
- store_test_results:
5757
path: ci/out
5858

@@ -63,18 +63,20 @@ jobs:
6363
- checkout
6464
- restore_cache:
6565
keys:
66-
- go-v1-{{ checksum "go.sum" }}
66+
- go-v3-{{ checksum "go.sum" }}
6767
# Fallback to using the latest cache if no exact match is found.
68-
- go-v1-
68+
- go-v3-
6969
- run: ./ci/bench.sh
7070
- store_artifacts:
7171
path: ci/out
7272
destination: out
7373
- save_cache:
7474
paths:
75-
- /root/go
75+
- /root/gopath
7676
- /root/.cache/go-build
77-
key: go-v1-{{ checksum "go.sum" }}
77+
key: go-v3-{{ checksum "go.sum" }}
78+
- store_test_results:
79+
path: ci/out
7880

7981
workflows:
8082
version: 2

ci/bench.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ set -euo pipefail
44
cd "$(dirname "${0}")"
55
cd "$(git rev-parse --show-toplevel)"
66

7-
mkdir -p ci/out
7+
mkdir -p ci/out/gobench
88
benchArgs=(
99
"-vet=off"
1010
"-run=^$"
@@ -20,7 +20,7 @@ benchArgs=(
2020
if [[ ${CI-} ]]; then
2121
# https://circleci.com/docs/2.0/collect-test-data/
2222
go test "${benchArgs[@]}" | tee /dev/stderr |
23-
go run github.com/jstemmer/go-junit-report > ci/out/testReport.xml
23+
go run github.com/jstemmer/go-junit-report > ci/out/gobench/report.xml
2424
else
2525
go test "${benchArgs[@]}"
2626
fi

ci/image/Dockerfile

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
FROM archlinux/base
1+
FROM golang:1
22

3-
RUN pacman -Syu --noconfirm
3+
ENV DEBIAN_FRONTEND=noninteractive
4+
ENV GOPATH /root/gopath
5+
ENV GOFLAGS -mod=readonly
46

5-
RUN pacman -S --noconfirm go git shellcheck tar openssh gzip ca-certificates
6-
7-
RUN pacman -S --noconfirm gcc python2-pip && \
8-
pip2 install autobahntestsuite
9-
10-
RUN pacman -S --noconfirm npm && \
7+
RUN apt-get update && \
8+
apt-get install -y shellcheck python-pip npm && \
9+
pip2 install autobahntestsuite && \
1110
npm install -g prettier
1211

13-
ENV GOFLAGS -mod=readonly

ci/image/push.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
set -euo pipefail
44
cd "$(dirname "${0}")"
5+
cd "$(git rev-parse --show-toplevel)"
56

6-
docker build -t nhooyr/websocket-ci .
7+
docker build -f ./ci/image/Dockerfile -t nhooyr/websocket-ci .
78
docker push nhooyr/websocket-ci

ci/test.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@ set -euo pipefail
44
cd "$(dirname "${0}")"
55
cd "$(git rev-parse --show-toplevel)"
66

7-
mkdir -p ci/out
7+
mkdir -p ci/out/gotest
88
testFlags=(-race "-vet=off" "-coverprofile=ci/out/coverage.prof" "-coverpkg=./...")
99
if [[ ${CI-} ]]; then
1010
# https://circleci.com/docs/2.0/collect-test-data/
1111
go test "${testFlags[@]}" -v ./... 2>&1 | tee /dev/stderr |
12-
go run github.com/jstemmer/go-junit-report > ci/out/testReport.xml
12+
go run github.com/jstemmer/go-junit-report > ci/out/gotest/report.xml
1313
else
1414
go test "${testFlags[@]}" ./...
1515
fi
16-
go tool cover -html=ci/out/coverage.prof -o=ci/out/coverage.html
1716

17+
go tool cover -html=ci/out/coverage.prof -o=ci/out/coverage.html
1818
if [[ ${CI:-} ]]; then
1919
bash <(curl -s https://codecov.io/bash) -f ci/out/coverage.prof
2020
fi

0 commit comments

Comments
 (0)