Skip to content

Commit

Permalink
Make all GH workflows more similar
Browse files Browse the repository at this point in the history
Makes all common steps on all GH workflows the same.
  • Loading branch information
ifosch committed Oct 23, 2022
1 parent 7026073 commit f8d4193
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 22 deletions.
21 changes: 13 additions & 8 deletions .github/workflows/push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,34 @@ jobs:
test:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v2
-
name: Install Go
uses: actions/setup-go@v2
with:
go-version: '^1.16'
-
name: Prepare coverage
run: |
go install github.com/jandelgado/gcov2lcov@latest
-
name: Checkout
uses: actions/checkout@v2
-
name: Prepare coverage report
env:
CC_TEST_REPORTER_ID: ${{ secrets.CODECLIMATE_TOKEN }}
CC_TR_URL: "https://codeclimate.com/downloads/test-reporter"
CC_TR_BIN: "test-reporter-latest-linux-amd64"
run: |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter && \
mkdir -p coverage && \
curl -L ${CC_TR_URL}/${CC_TR_BIN} > ./cc-test-reporter && \
chmod +x ./cc-test-reporter && \
./cc-test-reporter before-build
-
name: Run tests
run: |
go get -u github.com/jandelgado/gcov2lcov && \
go test -v ./... -coverprofile=coverage.out -covermode=atomic && \
mkdir -p coverage && \
gcov2lcov -infile=coverage.out -outfile=coverage/lcov.info
go test -v ./... -race -coverprofile=coverage/gcov.out -covermode=atomic && \
gcov2lcov -infile=coverage/gcov.out -outfile=coverage/lcov.info
-
name: Push coverage
env:
Expand Down
21 changes: 13 additions & 8 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ jobs:
docker:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v2
-
name: Install Go
uses: actions/setup-go@v2
Expand All @@ -22,19 +19,27 @@ jobs:
echo ::set-output name=SOURCE_TAG::${GITHUB_REF#refs/tags/}
-
name: Prepare coverage
run: |
go install github.com/jandelgado/gcov2lcov@latest
-
name: Checkout
uses: actions/checkout@v2
-
name: Prepare coverage report
env:
CC_TEST_REPORTER_ID: ${{ secrets.CODECLIMATE_TOKEN }}
CC_TR_URL: "https://codeclimate.com/downloads/test-reporter"
CC_TR_BIN: "test-reporter-latest-linux-amd64"
run: |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter && \
mkdir -p coverage && \
curl -L ${CC_TR_URL}/${CC_TR_BIN} > ./cc-test-reporter && \
chmod +x ./cc-test-reporter && \
./cc-test-reporter before-build
-
name: Run tests
run: |
go install github.com/jandelgado/gcov2lcov && \
go test -v ./... -coverprofile=coverage.out -covermode=atomic && \
mkdir -p coverage && \
gcov2lcov -infile=coverage.out -outfile=coverage/lcov.info
go test -v ./... -race -coverprofile=coverage/gcov.out -covermode=atomic && \
gcov2lcov -infile=coverage/gcov.out -outfile=coverage/lcov.info
-
name: Push coverage
env:
Expand Down
17 changes: 11 additions & 6 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,21 @@ jobs:
name: Checkout
uses: actions/checkout@v2
-
name: Run tests
name: Prepare coverage report
env:
CC_TEST_REPORTER_ID: ${{ secrets.CODECLIMATE_TOKEN }}
CC_TR_URL: "https://codeclimate.com/downloads/test-reporter"
CC_TR_BIN: "test-reporter-latest-linux-amd64"
run: |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter && \
chmod +x ./cc-test-reporter && \
./cc-test-reporter before-build && \
go test -v ./... -race -coverprofile=coverage.out -covermode=atomic && \
mkdir -p coverage && \
gcov2lcov -infile=coverage.out -outfile=coverage/lcov.info
curl -L ${CC_TR_URL}/${CC_TR_BIN} > ./cc-test-reporter && \
chmod +x ./cc-test-reporter && \
./cc-test-reporter before-build
-
name: Run tests
run: |
go test -v ./... -race -coverprofile=coverage/gcov.out -covermode=atomic && \
gcov2lcov -infile=coverage/gcov.out -outfile=coverage/lcov.info
-
name: Push coverage
env:
Expand Down

0 comments on commit f8d4193

Please sign in to comment.