Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fail CI builds with a better error when APIs are unexpectedly changed #5993

Merged
merged 10 commits into from
May 5, 2021

Conversation

tylerbutler
Copy link
Member

@tylerbutler tylerbutler commented Apr 29, 2021

This PR adds a new CI-specific npm script, npm run build:docs:ci, that will fail the build with a (somewhat) more helpful error like this:

@fluidframework/driver-utils: Warning: You have changed the public API signature for this project. Please copy the file "_api-extractor-temp/driver-utils.api.md" to "E:\code\FluidFramework\api-report\driver-utils.api.md", or perform a local build (which does this automatically). See the Git repo documentation for more info.

Running npm run build:docs locally will update the API report and output a warning like this:

@fluidframework/driver-utils: Warning: You have changed the public API signature for this project. Updating E:\code\FluidFramework\api-report\driver-utils.api.md

@anthony-murphy
Copy link
Contributor

anthony-murphy commented Apr 29, 2021

how does this fail the build? its not obvious to me

@tylerbutler
Copy link
Member Author

@anthony-murphy
Copy link
Contributor

The example is useful, but i still don't see how it does it, like what is the mechanism, build:docs:ci looks to be the same a build doc, but somehow that one fails the build

"build:compile": "concurrently npm:tsc npm:build:esnext",
"build:docs": "api-extractor run --local && copyfiles -u 1 ./_api-extractor-temp/doc-models/* ../../_api-extractor-temp/",
"build:docs:ci": "api-extractor run",
"build:docs:ci": "api-extractor run && copyfiles -u 1 ./_api-extractor-temp/doc-models/* ../../../_api-extractor-temp/",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh. is it just the lack of the --local right here?

@tylerbutler
Copy link
Member Author

The example is useful, but i still don't see how it does it, like what is the mechanism, build:docs:ci looks to be the same a build doc, but somehow that one fails the build

I misunderstood your question. Sorry! The only difference between the docs CI and the local docs builds is that the --local flag is passed when building locally. That flag causes api-extractor to automatically update the API report rather than failing the build with an error. From the api-extractor docs on the flag:

Indicates that API Extractor is running as part of a local build, e.g. on a developer's machine. This disables certain validation that would normally be performed for a ship/production build. For example, the *.api.md report file is automatically copied in a local build.

Comment on lines 322 to 326
* value is whatever params the ValueType needs to complete that operation. Similar to ISerializableValue, it is
* serializable via JSON.stringify/parse but differs in that it has no equivalency with an in-memory value - rather
* it just describes an operation to be applied to an already-in-memory value.
* @alpha
*/
export interface IValueTypeOperationValue {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ChumpChief With the deprecation and removal of ValueTypes, can this interface be completely removed?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately no - Sequence still uses MapKernel to use valuetypes and we don't have a plan in place to change that.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yuck. OK. We'll make sense of this as part of API review. :)

@tylerbutler tylerbutler merged commit 3e269fe into microsoft:main May 5, 2021
@tylerbutler tylerbutler deleted the docs/fail-ci branch May 5, 2021 18:22
tylerbutler added a commit to tylerbutler/FluidFramework that referenced this pull request May 5, 2021
tylerbutler added a commit that referenced this pull request May 6, 2021
Now that we're failing builds due to unexpected public API changes, the package build scripts have been updated to do a local docs build so that API reports are updated when devs run local builds. This changes fluid-build to enforce this new structure and fixes all the incorrect scripts.
@tylerbutler tylerbutler added area: dds Issues related to distributed data structures area: dds: sharedstring area: driver Driver related issues area: examples Changes that focus on our examples area: framework Framework is a tag for issues involving the developer framework. Eg Aqueduct area: host Host related issues area: loader Loader related issues area: runtime Runtime related issues area: server Server related issues (routerlicious) area: tests Tests to add, test infrastructure improvements, etc area: tools labels May 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: dds: sharedstring area: dds Issues related to distributed data structures area: driver Driver related issues area: examples Changes that focus on our examples area: framework Framework is a tag for issues involving the developer framework. Eg Aqueduct area: host Host related issues area: loader Loader related issues area: runtime Runtime related issues area: server Server related issues (routerlicious) area: tests Tests to add, test infrastructure improvements, etc area: tools
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants