Skip to content

Commit

Permalink
Use -Xswiftc -warnings-as-errors on CI.
Browse files Browse the repository at this point in the history
Add a hook to the Makefile for swift build|test commands.

Use that hook for CI to pass -Xswiftc -warnings-as-errors.
  • Loading branch information
thomasvl committed Aug 16, 2023
1 parent 908d1ba commit d9e26c9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ jobs:
esac
- name: Build
working-directory: main
run: make build
run: make build "SWIFT_BUILD_TEST_HOOK=-Xswiftc -warnings-as-errors"
- name: Test runtime
working-directory: main
run: make test-runtime
run: make test-runtime "SWIFT_BUILD_TEST_HOOK=-Xswiftc -warnings-as-errors"
- name: Cache protobuf
id: cache-protobuf
uses: actions/cache@v3
Expand Down
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ SWIFT_CONFORMANCE_PLUGIN=.build/debug/Conformance
# override this value.
CONFORMANCE_TEST_RUNNER?=${GOOGLE_PROTOBUF_CHECKOUT}/conformance_test_runner

# Hook to pass arge to swift build|test (mainly for the CI setup)
SWIFT_BUILD_TEST_HOOK?=

# The directories within Protos/ with the exception of "upstream". Use for the
# maintenance of the 'Reference' target and test-plugin.
PROTOS_DIRS=Conformance protoc-gen-swiftTests SwiftProtobuf SwiftProtobufPluginLibrary SwiftProtobufPluginLibraryTests SwiftProtobufTests
Expand Down Expand Up @@ -98,7 +101,7 @@ all: build

# Builds all the targets of the package.
build:
${SWIFT} build
${SWIFT} build ${SWIFT_BUILD_TEST_HOOK}

# Anything that needs the plugin should do a build.
${PROTOC_GEN_SWIFT}: build
Expand Down Expand Up @@ -143,7 +146,7 @@ check-version-numbers:
# and functional tests for the Swift code generated by the plugin.
#
test-runtime: build
${SWIFT} test
${SWIFT} test ${SWIFT_BUILD_TEST_HOOK}

#
# Test the plugin by itself:
Expand Down

0 comments on commit d9e26c9

Please sign in to comment.