-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(script): fix coverage setup (#285)
- Loading branch information
1 parent
4fc0057
commit 8461f44
Showing
6 changed files
with
121 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
name: Pixa Continuous Integration | ||
name: Arcadia Continuous Integration | ||
|
||
on: | ||
push: | ||
|
||
|
@@ -7,24 +8,31 @@ jobs: | |
name: lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/setup-go@v5 | ||
- uses: actions/setup-go@v4 | ||
with: | ||
go-version: 1.22 | ||
- uses: actions/checkout@v4 | ||
go-version: 1.23 | ||
- uses: actions/checkout@v3 | ||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@v4 | ||
uses: golangci/golangci-lint-action@v3 | ||
with: | ||
version: v1.56.2 | ||
version: v1.60.3 | ||
args: --verbose | ||
|
||
test: | ||
strategy: | ||
matrix: | ||
go-version: [1.22] | ||
go-version: [1.23] | ||
platform: [ubuntu-latest, macos-latest] | ||
|
||
runs-on: ${{ matrix.platform }} | ||
|
||
env: | ||
COVER_DIR: ${{ github.workspace }}/coverage | ||
COVER_FILE: coverage.out | ||
COVER_OUT_PATH: ${{ github.workspace }}/coverage/coverage.out | ||
COVER_HTML_PATH: ${{ github.workspace }}/coverage/coverage.html | ||
GINKGO_REPORT: ginkgo.report | ||
|
||
steps: | ||
- name: Install Go | ||
uses: actions/setup-go@v5 | ||
|
@@ -34,16 +42,34 @@ jobs: | |
- name: Install goveralls | ||
run: go install github.com/mattn/goveralls@latest | ||
|
||
- name: Install ginkgo | ||
run: go install github.com/onsi/ginkgo/v2/[email protected] | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- run: go test -v -coverprofile=coverage.out ./... | ||
- name: Ensure coverage directory exists | ||
run: | | ||
mkdir -p ${{ github.workspace }}/coverage | ||
- name: Run tests and generate coverage profile with Ginkgo | ||
run: | | ||
ginkgo run -r -json-report {{env.GINKGO_REPORT}} -coverpkg=./... -coverprofile=coverage.out | ||
- uses: shogo82148/actions-goveralls@v1 | ||
- name: Apply coverage exclusions | ||
run: | | ||
${{ github.workspace }}/scripts/apply-coverage-exclusions.sh | ||
- name: Check coverage directory contents | ||
run: | | ||
echo "Contents of ${{ github.workspace }}/coverage:" | ||
ls -la ${{ github.workspace }}/coverage | ||
- name: Generate HTML coverage report | ||
run: | | ||
go tool cover -html=coverage.out -o ${{ github.workspace }}/coverage/coverage.html | ||
- name: Upload coverage to Coveralls | ||
uses: shogo82148/actions-goveralls@v1 | ||
with: | ||
path-to-profile: coverage.out | ||
|
||
- name: Send coverage | ||
env: | ||
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: goveralls -coverprofile=coverage.out -service=github |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,9 @@ | |
coverage | ||
coverage.out | ||
ginkgo.report | ||
report.json | ||
coverage.html | ||
|
||
dist/ | ||
.task/ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/bin/bash | ||
|
||
# Define paths relative to the root directory | ||
ROOT_DIR="$(git rev-parse --show-toplevel)" | ||
COVERAGE_FILE="$ROOT_DIR/coverage.out" | ||
EXCLUSIONS_FILE="$ROOT_DIR/scripts/coverage-exclusion-list.txt" | ||
|
||
# Check if required files exist | ||
if [ ! -f "$COVERAGE_FILE" ]; then | ||
echo "Error: Coverage file not found at $COVERAGE_FILE" | ||
exit 1 | ||
fi | ||
|
||
if [ ! -f "$EXCLUSIONS_FILE" ]; then | ||
echo "Error: Exclusions file not found at $EXCLUSIONS_FILE" | ||
exit 1 | ||
fi | ||
|
||
# Create a temporary file | ||
TEMP_FILE=$(mktemp) | ||
|
||
# Process the exclusions | ||
while IFS= read -r line || [[ -n "$line" ]]; do | ||
# Escape special characters in the line for use in sed | ||
escaped_line=$(echo "$line" | sed 's/[\/&]/\\&/g') | ||
|
||
# Remove matching lines from the coverage file | ||
sed "/${escaped_line}/d" "$COVERAGE_FILE" > "$TEMP_FILE" | ||
|
||
# Replace the original file with the modified content | ||
mv "$TEMP_FILE" "$COVERAGE_FILE" | ||
done < "$EXCLUSIONS_FILE" | ||
|
||
echo "Coverage exclusions have been applied successfully." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
github.com/snivilised/traverse/enums | ||
github.com/snivilised/traverse/internal/third | ||
github.com/snivilised/traverse/internal/laboratory/ |