Skip to content

Commit

Permalink
gh: fixup make targets
Browse files Browse the repository at this point in the history
  • Loading branch information
charlievieth committed Sep 12, 2024
1 parent 38c6b34 commit e8b7353
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 45 deletions.
35 changes: 0 additions & 35 deletions .github/workflows/codecov.yml

This file was deleted.

13 changes: 12 additions & 1 deletion .github/workflows/exhaustive.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,23 @@ jobs:
build:
runs-on: ubuntu-latest
steps:

- uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '>=1.23.x'

- name: Test Core
run: make codecov

- name: Upload results to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}

- name: Test
run: make release --jobs=$(nproc)
rune: make testgenpkg testgenerate testbenchmarks testskipped calibrate vet
2 changes: 1 addition & 1 deletion .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ jobs:
with:
go-version: '>=1.23.x'
- name: Test
run: make ci exhaustive --jobs=$(nproc)
run: make release
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
go-version: ['1.19', '1.20', '1.21.x', '1.22.x', '1.23.x']
go-version: ['1.19.x', '1.20.x', '1.21.x', '1.22.x', '1.23.x']
steps:
- uses: actions/checkout@v4

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
coverage.txt
*.out
*.test
/bin
Expand Down
14 changes: 8 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ test testshort testverbose:
exhaustive:
@GOGC=$(GO_GOGC) $(GO_TEST) $(EXHAUSTIVE_PKGS) -exhaustive

# Generate code coverage report for strcase/bytecase
.PHONY: codecov
codecov: override GO_COVER_FLAGS = -covermode=count
codecov: override GO_COVER_FLAGS += -coverprofile=coverage.txt
codecov: exhaustive

# Assert that there are no skipped tests
.PHONY: testskipped
testskipped:
Expand All @@ -46,8 +52,6 @@ testskipped:
exit 1; \
fi

# TODO: pass arguments to sub-make
#
# The gen package is separate from the strcase package (so we don't pollute
# our go.mod with its dependencies) so we need to cd into its directory to
# run the tests.
Expand All @@ -74,10 +78,8 @@ testall: exhaustive testskipped testgenerate testgenpkg
# CI tests
.PHONY: ci
ci: test
ci: testgenpkg
ci: testgenerate
ci: testbenchmarks
ci: lint
ci: vet

# Calibrate brute-force cutover
.PHONY: calibrate
Expand Down Expand Up @@ -145,7 +147,7 @@ pre-commit: .git/hooks/pre-commit

# Run pre-release tests (excluding: golangci-lint)
.PHONY: release
release: test exhaustive testgenpkg testgenerate testbenchmarks calibrate
release: exhaustive testgenpkg testgenerate testbenchmarks calibrate vet

# Print information about the version of go being used
.PHONY: env
Expand Down
5 changes: 4 additions & 1 deletion internal/tables/assigned/assigned_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ func TestAssignedRunes(t *testing.T) {
}
return a
}
for _, version := range []string{"13.0.0", "15.0.0"} {
for _, version := range []string{
"13.0.0",
unicode.Version, // 15.0.0 unless testing with go1.19
} {
version := version
t.Run(version, func(t *testing.T) {
t.Parallel()
Expand Down
11 changes: 11 additions & 0 deletions scripts/go-vet-harder
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,12 @@ VETTOOLS=(
DIR="$(mktemp -d -t 'go-vet-')"
trap 'rm -r $DIR' EXIT

touch "$DIR/vet"
go vet ./... >"$DIR/vet" 2>&1 &

for tool in "${VETTOOLS[@]}"; do
touch "$DIR/$tool"
"$tool" ./... >"$DIR/$tool" 2>&1 &
done

wait
Expand All @@ -41,10 +45,17 @@ fi
VETTOOLS+=(vet)
ERRORS=0
for tool in "${VETTOOLS[@]}"; do
if [[ -s "$DIR/$tool" ]]; then
printf "%s: ${RED}error${RESET}\n" "$tool"
if [[ -n $REPLACE ]]; then
sed "s/$REPLACE//g" "$DIR/$tool" | pr -o4 -t -
else
pr -o4 -t - "$DIR/$tool"
fi
ERRORS=1
else
printf "%s: ${GREEN}pass${RESET}\n" "$tool"
fi
done

exit $ERRORS
6 changes: 6 additions & 0 deletions scripts/test-benchmarks.bash
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ fi

echo '# Testing benchmarks'

if ! command -v readarray &>/dev/null; then
printf '%sSKIP%s\t%s\n' "${RED}" "${RESET}" \
"readarray not supported by this verison of bash"
exit 0
fi

# Go packages
readarray -t PACKAGES < <(go list ./...)
if ((${#PACKAGES[@]} == 0)); then
Expand Down

0 comments on commit e8b7353

Please sign in to comment.