-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
feat(ci): run unit test jobs on arm64 machines additionally #12864
base: master
Are you sure you want to change the base?
Conversation
@galargh : I assume you'll mark it ready for review when it is. |
Yes, it is ready for review now :) |
cmd/ci/main.go
Outdated
return [][]string{{"ubuntu-latest"}} | ||
} | ||
|
||
namesToRunners := map[string][][]string{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure how much I like this TBH. Editing yaml for this kind of data seems much more convenient than string hardcoded into map[string][][]string
.
From a design perspective, the code here is entirely CI specific. It should live somewhere inside .github
folder?
I do think the long term goal is to desolve this into itests themselves in form of annotations or struct tags on "Test Suit" (see testify).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do think the long term goal is to desolve this into itests themselves in form of annotations or struct tags on "Test Suit" (see testify).
I'd treat this as a mid-step towards that desired goal. It's going to be much easier to parse and manipulate the data from itests here. And then, the hardcoded info inside this tool will disappear.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I'd love to see more of this metadata live closer to the tests themselves with annotations, but I understand that is a bigger step. This to me has better readability than jq commands in yaml files we have now. I don't see this making things worse and is actually improving what we have now, so 👍 from me.
The idea of moving this into the .github directory seems good/reasonable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@galargh : any thoughts on moving this to .github
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I took some time coming up to speed on how lotus tests are working within CI. Apologies if I'm raising points that were covered in previous PRs. My comments are partly coming from trying to get my head around the data model and structuring how the tests. Feel free to disregard if my comments are off or don't make sense.
SKIP_CONFORMANCE: ${{ fromJson(steps.group.outputs.metadata).skip_conformance && '1' || '0' }} | ||
TEST_RUSTPROOFS_LOGS: ${{ fromJson(steps.group.outputs.metadata).test_rustproofs_logs && '1' || '0' }} | ||
FORMAT: ${{ fromJson(steps.group.outputs.metadata).format || 'standard-verbose' }} | ||
PACKAGES: ${{ join(fromJson(steps.group.outputs.metadata).packages, ' ') }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we set an environment variable when it is also referenced below as a param to gotestsum
? Basically I'm wondering if we should inline this to the gotestsum
call.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't matter much here because we literally execute a script to get these values, but it's a good security practice for some types of workflows so I tend to stick with it in general.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it - makes sense. I'm good to practice the right behavior here.
Should we adjust this line below to be consistent?
-- ${{ fromJson(steps.group.outputs.metadata).go_test_flags || '' }}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is seeming good to me, and certainly not making anything worse. My remaining comments are small nits.
I resolved all previous conversations that I believe are resolved now.
Before merging, it would be good to get input on #12864 (comment)
Also, is there an easy way to sanity check that we aren't reducing our coverage with this change (i.e., we didn't accidentally miss a test group execution context)?
} | ||
|
||
type Runner []string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add the explanatory comment for why Runner is []string
rather than just string
?
}, | ||
} | ||
|
||
if strings.HasPrefix(name, "itest-") { | ||
return []string{strings.Join([]string{".", "itests", strings.Join([]string{strings.TrimPrefix(name, "itest-"), "test.go"}, "_")}, string(os.PathSeparator))} | ||
if strings.HasPrefix(testGroupName, "itest-") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(nit) but maybe move this if to the top of the function to avoid the interleaving of concerns that we have now
nonItest map declaration
itest handling
nonItest handling
return []Runner{linux_x64} | ||
} | ||
|
||
testGroupNamesToRunners := map[string][]Runner{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: testGroupNameToRunner
(since the map key is a single test group name?
runs-on: ${{ matrix.runner }} | ||
strategy: | ||
matrix: | ||
runner: [ubuntu-latest, ubuntu-24.04-arm] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it. So this job needs to run on x86_64 and arm, which is accomplished by [ubuntu-latest, ubuntu-24.04-arm]
. Sounds good.
runner: [ubuntu-latest, ubuntu-24.04-arm] | |
# We need to cache for each architecture we support: x86_64 and arm | |
runner: [ubuntu-latest, ubuntu-24.04-arm] |
SKIP_CONFORMANCE: ${{ fromJson(steps.group.outputs.metadata).skip_conformance && '1' || '0' }} | ||
TEST_RUSTPROOFS_LOGS: ${{ fromJson(steps.group.outputs.metadata).test_rustproofs_logs && '1' || '0' }} | ||
FORMAT: ${{ fromJson(steps.group.outputs.metadata).format || 'standard-verbose' }} | ||
PACKAGES: ${{ join(fromJson(steps.group.outputs.metadata).packages, ' ') }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it - makes sense. I'm good to practice the right behavior here.
Should we adjust this line below to be consistent?
-- ${{ fromJson(steps.group.outputs.metadata).go_test_flags || '' }}
Related Issues
Resolves #12860
Proposed Changes
Start running
unit-*
jobs on arm64 machines in addition to x86_64 ones.Additional Info
In order to accommodate this change, I moved the test discovery code to a dedicated Go CLI. The important change in the structure of metadata is that now each test group can be associated with many target runners.
What's more, I split the test group discovery into part 1 which lists all the test groups, and part 2 which returns the metadata (e.g. runner information, etc.) for a given test group name. Thanks to this the outputs of the discovery job can be smaller and we minimise the risk of hitting the maximum output size limit.
Checklist
Before you mark the PR ready for review, please make sure that: