Skip to content

Commit 06d0bf6

Browse files
committed
Allow control for docker-compose file in integration tests, tolerate PR commenting failures for unprivileged contributors
1 parent 1ee3be3 commit 06d0bf6

File tree

6 files changed

+17
-3
lines changed

6 files changed

+17
-3
lines changed

makefiles/test-integration.mk

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ GO ?= go
33
# Override in app Makefile to add custom ldflags, example BUILD_LDFLAGS="-s -w"
44
BUILD_LDFLAGS ?= ""
55
INTEGRATION_TEST_TARGET ?= -coverpkg ./internal/... integration_test.go
6+
INTEGRATION_DOCKER_COMPOSE ?= ./docker-compose.integration-test.yml
67

78
## Run integration tests
89
test-integration:
@@ -12,10 +13,10 @@ test-integration:
1213

1314
## Start dependencies for integration tests or local dev via docker-compose up
1415
start-deps:
15-
@test ! -f ./docker-compose.integration-test.yml || docker-compose -p "$(shell basename $$PWD)" -f ./docker-compose.integration-test.yml up -d
16+
@test ! -f $(INTEGRATION_DOCKER_COMPOSE) || docker-compose -p "$(shell basename $$PWD)" -f $(INTEGRATION_DOCKER_COMPOSE) up -d
1617

1718
## Stop dependencies for integration tests or local dev via docker-compose down
1819
stop-deps:
19-
@test ! -f ./docker-compose.integration-test.yml || docker-compose -p "$(shell basename $$PWD)" -f ./docker-compose.integration-test.yml down
20+
@test ! -f $(INTEGRATION_DOCKER_COMPOSE) || docker-compose -p "$(shell basename $$PWD)" -f $(INTEGRATION_DOCKER_COMPOSE) down
2021

2122
.PHONY: test-integration start-deps stop-deps

templates/github/workflows/bench.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,16 +76,19 @@ jobs:
7676
export REF_NAME=new
7777
BENCH_COUNT=5 make bench
7878
OUTPUT=$(make bench-stat-diff)
79+
echo "${OUTPUT}"
7980
OUTPUT="${OUTPUT//'%'/'%25'}"
8081
OUTPUT="${OUTPUT//$'\n'/'%0A'}"
8182
OUTPUT="${OUTPUT//$'\r'/'%0D'}"
8283
echo "::set-output name=diff::$OUTPUT"
8384
OUTPUT=$(make bench-stat)
85+
echo "${OUTPUT}"
8486
OUTPUT="${OUTPUT//'%'/'%25'}"
8587
OUTPUT="${OUTPUT//$'\n'/'%0A'}"
8688
OUTPUT="${OUTPUT//$'\r'/'%0D'}"
8789
echo "::set-output name=result::$OUTPUT"
8890
- name: Comment Benchmark Result
91+
continue-on-error: true
8992
uses: marocchino/sticky-pull-request-comment@v2
9093
with:
9194
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

templates/github/workflows/cloc.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,16 @@ jobs:
1818
- name: Count Lines Of Code
1919
id: loc
2020
run: |
21-
curl -OL https://github.com/vearutop/sccdiff/releases/download/v1.0.1/linux_amd64.tar.gz && tar xf linux_amd64.tar.gz
21+
curl -sLO https://github.com/vearutop/sccdiff/releases/download/v1.0.1/linux_amd64.tar.gz && tar xf linux_amd64.tar.gz
2222
OUTPUT=$(cd pr && ../sccdiff -basedir ../base)
23+
echo "${OUTPUT}"
2324
OUTPUT="${OUTPUT//'%'/'%25'}"
2425
OUTPUT="${OUTPUT//$'\n'/'%0A'}"
2526
OUTPUT="${OUTPUT//$'\r'/'%0D'}"
2627
echo "::set-output name=diff::$OUTPUT"
2728
2829
- name: Comment Code Lines
30+
continue-on-error: true
2931
uses: marocchino/sticky-pull-request-comment@v2
3032
with:
3133
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

templates/github/workflows/gorelease.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,13 @@ jobs:
2828
run: |
2929
test -e ~/go/bin/gorelease || go install golang.org/x/exp/cmd/gorelease@latest
3030
OUTPUT=$(gorelease || exit 0)
31+
echo "${OUTPUT}"
3132
OUTPUT="${OUTPUT//'%'/'%25'}"
3233
OUTPUT="${OUTPUT//$'\n'/'%0A'}"
3334
OUTPUT="${OUTPUT//$'\r'/'%0D'}"
3435
echo "::set-output name=report::$OUTPUT"
3536
- name: Comment Report
37+
continue-on-error: true
3638
uses: marocchino/sticky-pull-request-comment@v2
3739
with:
3840
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

templates/github/workflows/test-integration.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,16 +61,19 @@ jobs:
6161
make test-integration
6262
go tool cover -func=./integration.coverprofile | sed -e 's/.go:[0-9]*:\t/.go\t/g' | sed -e 's/\t\t*/\t/g' > integration.txt
6363
OUTPUT=$(test -e integration-base.txt && (diff integration-base.txt integration.txt || exit 0) || cat integration.txt)
64+
echo "${OUTPUT}"
6465
OUTPUT="${OUTPUT//'%'/'%25'}"
6566
OUTPUT="${OUTPUT//$'\n'/'%0A'}"
6667
OUTPUT="${OUTPUT//$'\r'/'%0D'}"
6768
TOTAL=$(grep 'total:' integration.txt)
69+
echo "${TOTAL}"
6870
echo "::set-output name=diff::$OUTPUT"
6971
echo "::set-output name=total::$TOTAL"
7072
- name: Store base coverage
7173
if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' }}
7274
run: cp integration.txt integration-base.txt
7375
- name: Comment Test Coverage
76+
continue-on-error: true
7477
if: matrix.go-version == '1.17.x'
7578
uses: marocchino/sticky-pull-request-comment@v2
7679
with:

templates/github/workflows/test-unit.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,16 +59,19 @@ jobs:
5959
make test-unit
6060
go tool cover -func=./unit.coverprofile | sed -e 's/.go:[0-9]*:\t/.go\t/g' | sed -e 's/\t\t*/\t/g' > unit.txt
6161
OUTPUT=$(test -e unit-base.txt && (diff unit-base.txt unit.txt || exit 0) || cat unit.txt)
62+
echo "${OUTPUT}"
6263
OUTPUT="${OUTPUT//'%'/'%25'}"
6364
OUTPUT="${OUTPUT//$'\n'/'%0A'}"
6465
OUTPUT="${OUTPUT//$'\r'/'%0D'}"
6566
TOTAL=$(grep 'total:' unit.txt)
67+
echo "${TOTAL}"
6668
echo "::set-output name=diff::$OUTPUT"
6769
echo "::set-output name=total::$TOTAL"
6870
- name: Store base coverage
6971
if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' }}
7072
run: cp unit.txt unit-base.txt
7173
- name: Comment Test Coverage
74+
continue-on-error: true
7275
if: matrix.go-version == '1.17.x'
7376
uses: marocchino/sticky-pull-request-comment@v2
7477
with:

0 commit comments

Comments
 (0)