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

chore(core): Add additional API checks 🎬 #9867

Merged
merged 5 commits into from
Nov 14, 2023

Conversation

ermshiperete
Copy link
Contributor

@ermshiperete ermshiperete commented Oct 26, 2023

  • Add additional checks for the symbols file:
    • if a line with a method name gets changed, the package version number in that line also needs to be updated
  • Add additional checks for the API:
    • for major API changes (methods renamed or removed as reflected in the .symbols file) the API version
      numbers needs to be incremented
    • the API version numbers in the .symbols file and in CORE_API_VERSION.md need to match

Closes #9801

@keymanapp-test-bot skip

@keymanapp-test-bot
Copy link

keymanapp-test-bot bot commented Oct 26, 2023

User Test Results

Test specification and instructions

User tests are not required

@keymanapp-test-bot keymanapp-test-bot bot added this to the A17S24 milestone Oct 26, 2023
@github-actions github-actions bot added linux/ common/ common/resources/ Build infrastructure core/ Keyman Core labels Oct 26, 2023
@ermshiperete ermshiperete force-pushed the chore/linux/9801_coreversion branch from ff88242 to 7f166a6 Compare October 26, 2023 15:47
@github-actions github-actions bot added the docs label Oct 26, 2023
@ermshiperete ermshiperete linked an issue Oct 26, 2023 that may be closed by this pull request
This change adds additional checks for the symbols file:

- if a line with a method name gets changed, the package version number
  in that line also needs to be updated
- for major API changes (methods renamed or removed) the API version
  numbers needs to be incremented
- the API version numbers in the .symbols file and in `CORE_API_VERSION.md`
  need to match
@ermshiperete ermshiperete force-pushed the chore/linux/9801_coreversion branch from 7f166a6 to 30250e3 Compare October 26, 2023 16:04
Copy link
Member

@mcdurdin mcdurdin left a comment

Choose a reason for hiding this comment

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

Given the changes to trigger-builds impacts all platforms and every build, I would like to split them out into a separate branch for discussion and review. The changes shouldn't be buried.

I haven't yet reviewed the other aspects of this PR

@ermshiperete ermshiperete changed the base branch from refactor/linux/packagingScript to chore/linux/9801_apiversion October 27, 2023 13:24
@ermshiperete ermshiperete changed the title Add Core API version number 🎬 chore(core): Add additional API checks 🎬 Oct 27, 2023
@ermshiperete
Copy link
Contributor Author

I split out the Core API version change into #9877.

@mcdurdin mcdurdin modified the milestones: A17S24, A17S25 Oct 27, 2023
Comment on lines 22 to 23
"--git-ref=GIT_REF The ref of the HEAD commit, e.g. HEAD of the PR branch (for verify action)" \
"--git-base=GIT_BASE The ref of the base commit, e.g. HEAD of the master branch (for verify action)"
Copy link
Member

Choose a reason for hiding this comment

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

Should these be SHAs or commitishes/refs, tag names, branch names or what? 😁

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
"--git-ref=GIT_REF The ref of the HEAD commit, e.g. HEAD of the PR branch (for verify action)" \
"--git-base=GIT_BASE The ref of the base commit, e.g. HEAD of the master branch (for verify action)"
"--git-ref=GIT_REF The SHA of the HEAD commit, e.g. of the PR branch (for verify action)" \
"--git-base=GIT_BASE The ref of the base commit, usually the name of the base branch, e.g. master, stable-16.0 (for verify action)"

cd "${REPO_ROOT}/linux"
}

is_symbols_file_changed() {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
is_symbols_file_changed() {
#
# Compare the SHA of the base and head commits for changes to the .symbols file
#
is_symbols_file_changed() {


check_api_not_changed() {
# Checks that the API did not change compared to what's documented in the .symbols file
tmpDir=$(mktemp -d)
Copy link
Member

Choose a reason for hiding this comment

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

Cleanup?

# .symbols file changed, now check if the package version got updated as well
# Note: We don't check that ALL changes in that file have an updated package version -
# we hope this gets flagged in code review.
if ! git log -p -1 -- "debian/${PKG_NAME}.symbols" | grep -q "${PKG_VERSION}"; then
Copy link
Member

Choose a reason for hiding this comment

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

${PKG_VERSION} could just be ${VERSION} I think? And then we can eliminate all of that from this script?

Comment on lines +103 to +105
# .symbols file changed, now check if the package version got updated as well
# Note: We don't check that ALL changes in that file have an updated package version -
# we hope this gets flagged in code review.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
# .symbols file changed, now check if the package version got updated as well
# Note: We don't check that ALL changes in that file have an updated package version -
# we hope this gets flagged in code review.
# .symbols file changed, now check if the package version got updated as well
# Note: We don't check that ALL changes in that file have an updated package version -
# we hope this gets flagged in code review.
# Note: This version number check may not match the actual released version, if the branch
# is out of date when it is merged to the release branch (master/beta/stable-x.y). If this
# is considered important, then make sure the branch is up to date, and wait for test
# builds to complete, before merging.

get_api_version_in_symbols_file() {
# Extract 1 from "libkeymancore.so.1 libkeymancore #MINVER#"
local firstline
firstline=$(head -1 "debian/${PKG_NAME}.symbols")
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
firstline=$(head -1 "debian/${PKG_NAME}.symbols")
firstline="$(head -1 "debian/${PKG_NAME}.symbols")"

Base automatically changed from chore/linux/9801_apiversion to master November 3, 2023 03:13
@mcdurdin mcdurdin modified the milestones: A17S25, A17S26 Nov 13, 2023
@github-actions github-actions bot removed the core/ Keyman Core label Nov 13, 2023
@github-actions github-actions bot added chore core/ Keyman Core labels Nov 13, 2023
Comment on lines 139 to 143
git checkout "${GIT_SHA}" -- "debian/${PKG_NAME}.symbols"
NEW_VERSION=$(get_api_version_in_symbols_file)
git checkout "${GIT_BASE}" -- "debian/${PKG_NAME}.symbols"
OLD_VERSION=$(get_api_version_in_symbols_file)
git checkout "${GIT_SHA}" -- "debian/${PKG_NAME}.symbols"
Copy link
Member

Choose a reason for hiding this comment

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

We could reduce the number of checkouts by switching order of operations here, but it's not terribly important.

Addresses code review comment.
@ermshiperete ermshiperete merged commit 039e859 into master Nov 14, 2023
2 checks passed
@ermshiperete ermshiperete deleted the chore/linux/9801_coreversion branch November 14, 2023 09:26
@github-actions github-actions bot added core/ Keyman Core and removed core/ Keyman Core labels Nov 14, 2023
@keyman-server
Copy link
Collaborator

Changes in this pull request will be available for download in Keyman version 17.0.210-alpha

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat(core): Add API version number
3 participants