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

Update Makefile and CI scripts to remove 'ci' folder and 'ci-' prefix. #130

Merged
merged 7 commits into from Feb 7, 2024

Conversation

kevinlind
Copy link
Contributor

Description

Update Makefile and CI scripts to remove the "ci" folder during builds and "ci-" prefix in Makefile targets. The use of the "ci" folder is no longer needed. Additionally, the copy step to the "ci" folder may get skipped if an earlier step fails and aborts the task. It is less error prone to reference files directly from the build folders than using the "ci" folder.

Related Issue

Motivation and Context

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

(./code/gradlew -p code/$(EXTENSION-LIBRARY-FOLDER-NAME) lint)


ci-build: create-ci
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Move below and renamed to "assemble-phone"

(mv $(AAR_FILE_DIR)/$(EXTENSION-LIBRARY-FOLDER-NAME)-phone-release.aar $(AAR_FILE_DIR)/$(MODULE_NAME)-release-$(LIB_VERSION).aar)
(cp -r ./code/$(EXTENSION-LIBRARY-FOLDER-NAME)/build $(BUILD-ASSEMBLE-LOCATION))

ci-build-app:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved below and renamed to "assemble-phone"

Comment on lines -16 to -24
BUILD-ASSEMBLE-LOCATION = ./ci/assemble
ROOT_DIR=$(shell git rev-parse --show-toplevel)

PROJECT_NAME = $(shell cat $(ROOT_DIR)/code/gradle.properties | grep "moduleProjectName" | cut -d'=' -f2)
AAR_NAME = $(shell cat $(ROOT_DIR)/code/gradle.properties | grep "moduleAARName" | cut -d'=' -f2)
MODULE_NAME = $(shell cat $(ROOT_DIR)/code/gradle.properties | grep "moduleName" | cut -d'=' -f2)
LIB_VERSION = $(shell cat $(ROOT_DIR)/code/gradle.properties | grep "moduleVersion" | cut -d'=' -f2)
SOURCE_FILE_DIR = $(ROOT_DIR)/code/$(PROJECT_NAME)
AAR_FILE_DIR = $(ROOT_DIR)/code/$(PROJECT_NAME)/build/outputs/aar
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I removed the step from "ci-build"/"assemble-phone" which renamed the assembled .aar file, which required all these variables. I don't think we need to rename the .aar anymore as it is not used in the publish task anymore.

Makefile Outdated
(./code/gradlew -p code/${EXTENSION-LIBRARY-FOLDER-NAME} publishReleasePublicationToSonatypeRepository)

ci-publish-main: clean build-release
publish-main: clean assemble-phone-release
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've kept this as publish-main but I'm open to just renaming it publish, similar to the User Profile project.

Copy link
Contributor

Choose a reason for hiding this comment

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

Userprofile keep them as
ci-publish-staging
ci-publish

Should we follow to make it standard?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It seems to be a mistake that they kept the ci- prefix just for those two targets. There are other targets which are called in CI which do not use the prefix.
I'm fine with renaming from publish-main to just publish.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Core team responded saying the ci- prefix is preserved because these targets are meant to only be run in CI. I've updated the Make file to add the ci- prefix back while renaming ci-publish-main to ci-publish.

Copy link

codecov bot commented Feb 5, 2024

Codecov Report

Merging #130 (920d254) into dev-v3.0.0 (7e293dc) will not change coverage.
The diff coverage is n/a.

Additional details and impacted files
@@              Coverage Diff              @@
##             dev-v3.0.0     #130   +/-   ##
=============================================
  Coverage         84.30%   84.30%           
  Complexity          406      406           
=============================================
  Files                30       30           
  Lines              1643     1643           
  Branches            235      235           
=============================================
  Hits               1385     1385           
  Misses              165      165           
  Partials             93       93           
Flag Coverage Δ
functional-tests 67.07% <ø> (ø)
unit-tests 80.34% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

- store_artifacts:
path: ci/javadoc/build/reports
path: code/edge/build/dokka/javadoc
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we put into
code/edge/build/docs/javadoc
as Userprofile?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is reading the generated HTML files after running Javadoc. Edge is using Dokka to generate the Javadocs so this is the path where the files are located. We may want to move away from Dokka, as it appears the other extensions using Kotlin are not using it. But if we do, that will be in another PR.

@@ -134,13 +134,12 @@ jobs:
# Code coverage upload using Codecov
# See options explanation here: https://docs.codecov.com/docs/codecov-uploader
- codecov/upload:
file: ci/unit-test/build/reports/jacoco/platformUnitTestJacocoReport/platformUnitTestJacocoReport.xml
file: code/edge/build/reports/jacoco/platformUnitTestJacocoReport/platformUnitTestJacocoReport.xml
Copy link
Contributor

Choose a reason for hiding this comment

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

How about use
code/edge/build/reports/coverage/test/phone/debug/report.xml

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That directory doesn't exist in Edge when running the unit tests. Keep in mind I'm only renaming the Makefile targets and I haven't changed the Gradle files. If the common Gradle files change how Jacoco is setup, then these file locations may change later.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've updated the Gradle task used to generate the coverage reports and the generated report location. The report location now matches what you suggested. Thanks!


- android/run-tests:
test-command: make ci-unit-test
test-command: make unit-test
Copy link
Contributor

Choose a reason for hiding this comment

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

Userprofile uses make unit-test-coverage which include running unit test and create coverage. Do you want to include that in this PR or later?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's not clear to me that it is needed to have a separate Makefile target which just runs the unit-test without producing a coverage file. I don't see that User Profile is running their unit-test target, only unit-test-coverage. I would prefer to keep the target name as unit-test while having it produce the coverage files.

Copy link
Contributor

Choose a reason for hiding this comment

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

They have both unit-test and unit-test-coverage.
unit-test can be used for running locally.
unit-test-coverage will run both unit test and unit test coverage.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've updated the Make file to include coverage and non-coverage testing targets so we are consistent with Core team's implementation.

# The test command
test-command: make ci-functional-test
test-command: make functional-test
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you want to change functional-test-coverage now or later?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!

Makefile Outdated
(./code/gradlew -p code/${EXTENSION-LIBRARY-FOLDER-NAME} publishReleasePublicationToSonatypeRepository)

ci-publish-main: clean build-release
publish-main: clean assemble-phone-release
Copy link
Contributor

Choose a reason for hiding this comment

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

Userprofile keep them as
ci-publish-staging
ci-publish

Should we follow to make it standard?

Makefile Outdated
ci-generate-library-release:
(./code/gradlew -p code/${EXTENSION-LIBRARY-FOLDER-NAME} assemblePhoneRelease)
assemble-phone-debug:
(./code/gradlew -p code/${EXTENSION-LIBRARY-FOLDER-NAME} assemblePhoneDebug)
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we use {EXTENSION-LIBRARY-FOLDER-NAME}
Or
(EXTENSION-LIBRARY-FOLDER-NAME)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

GNU allows both for variable expansion. However we should be consistent, plus some have reported weird errors when mixing both types in the same line. Let's stick with using $() instead of curly braces.

@kevinlind kevinlind merged commit c449867 into adobe:dev-v3.0.0 Feb 7, 2024
7 checks passed
@kevinlind kevinlind deleted the remove-ci-folder branch February 7, 2024 23:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants