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

build: Update for Mac M1 support #980

Merged
merged 12 commits into from
May 11, 2022
Merged

Conversation

Eric-Warehime
Copy link
Contributor

Summary

Adds M1 support

  • CPATH/LIBRARY_PATH updated for new homebrew installation location
  • archtype.sh updated to include m1 arch
  • UTF-8 unit tests were failing, so I've updated those

Test Plan

Tests run locally on my M1 machine.
Will need to update CI to include M1 arm64 test support.

@codecov-commenter
Copy link

codecov-commenter commented Apr 28, 2022

Codecov Report

Merging #980 (7aa758a) into develop (9b93cc3) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff            @@
##           develop     #980   +/-   ##
========================================
  Coverage    60.15%   60.15%           
========================================
  Files           41       41           
  Lines         5702     5702           
========================================
  Hits          3430     3430           
  Misses        1825     1825           
  Partials       447      447           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9b93cc3...7aa758a. Read the comment docs.

@Eric-Warehime
Copy link
Contributor Author

Requires algorand/go-algorand#3920 since we depend on some go-algorand pkgs in indexer as well.

@Eric-Warehime Eric-Warehime marked this pull request as ready for review April 28, 2022 22:21
@@ -22,7 +21,7 @@ func TestPrintableUTF8OrEmpty(t *testing.T) {
},
{
"Asset 510285544",
"8J+qmSBNb25leQ==",
Copy link
Contributor

Choose a reason for hiding this comment

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

Why did this need to change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure of the exact root cause, but from what I can tell, that string is 🪙 Money, want which returns a printable string (failing the test which expects it not to be printable) while the new string 🪙 Money, want\n includes newline and is not printable (as anticipated) on the newline character.

It looks like the most recent update to the unicode bits in go is golang/go@8ec5a05 which started in 1.16. That could be the root cause if we were expecting the moon symbol to fail since we're on 1.13. But I haven't dug that deep on it.

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 also reminded me that I forgot to update golang in this PR. Updating with that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

#943 also includes changes to this test so it must be failing on golang1.16 as well.

@Eric-Warehime
Copy link
Contributor Author

Updated go-algorand submodule to include the most recent commits (the golang 1.17 updates). Also added the ledger changes (to resolve #936 ) from #943 (although I wasn't able to cherry-pick this since it's on a fork, credit goes to Tsachi for these changes).

@Eric-Warehime Eric-Warehime added the Enhancement New feature or request label May 10, 2022
@Eric-Warehime Eric-Warehime requested a review from winder May 10, 2022 16:22
@Eric-Warehime
Copy link
Contributor Author

It looks like go vet with go1.14 is failing on the submodule...Not sure if we need to keep compatibility w/ go1.14, but I will look into this further.

@winder winder mentioned this pull request May 10, 2022
@winder
Copy link
Contributor

winder commented May 10, 2022

@Eric-Warehime I believe go-algorand is using 1.16 specific functionality. We have to disable the 1.14.7 / 1.15.15 tests.

}
resourcesForAddress[creatable] = normalizeAccountResource(appResource)
default:
err1 = fmt.Errorf("checkModifiedState() unexpected creatable type %v", creatable.Type)
Copy link
Contributor

Choose a reason for hiding this comment

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

@tolikzinovyev could you review this section? It seems reasonable, but should we call normalizeAccountResource(ar) for the AssetCreatable case?

Copy link
Contributor

Choose a reason for hiding this comment

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

I would only suggest to do one of the following:

  1. Keep normalizeAccountResource() unchanged and call it after the switch.
  2. Change normalizeAccountResource() into normalizeAppResource() that would accept and return ledgercore.AppResource.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Went with changing normalizeAccountResource to convertAppResource which will return an AccountResource with normalized fields. I think it's more properly named and avoids calling the function when it's not necessary for AssetResources.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@tolikzinovyev Let me know if you have any feedback on these changes. 😄

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks fine!

@winder winder requested a review from tolikzinovyev May 10, 2022 17:09
@Eric-Warehime Eric-Warehime changed the title Update for Mac M1 support build: Update for Mac M1 support May 10, 2022
@winder
Copy link
Contributor

winder commented May 10, 2022

api/Makefile - The oapi-codegen version should be changed to v1.3.7, and go get changed to go install
Makefile - Use go install instead of go get to install mockery.
.circleci/config.yml - Use go install instead of go get to install golint

Copy link
Contributor

@winder winder left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants