-
Notifications
You must be signed in to change notification settings - Fork 17
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
[ci] Add tests for non-native architectures #622
[ci] Add tests for non-native architectures #622
Conversation
It is a false positive. The warning reported in the CI (check here) will disappear in future CI runs once the migration to BackgroundService is completed. For now, we can ignore the CI issue here. |
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.
Awesome! Just a few comments and questions...
Also, wish for the future: Have our own GitHub ARM runners (https://actuated.dev/blog/native-arm64-for-github-actions)
.github/containers/nox-cross-arch/arm64-ubuntu-20.04-python-3.11.Dockerfile
Show resolved
Hide resolved
47de1b5
to
b90d647
Compare
The CI complains:
but the file exists, and I have tested the link in my local environment. Edit: Fixed. Needed an entry in the |
b1bbb97
to
ec6ecd6
Compare
250b5e3
to
c051101
Compare
There are still issues with this:
Also the URL looks very weird. I think the easiest solution for this would be to move the contents of |
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.
Sorry for the messy review. So as a summary, I would:
- Try the NOP approach for running the job in PRs (and running on
push
too) so we can have a branch protection rule. - Add the
pytest_max
nox
session to the matrix. - Remove
-R
fromnox
invocation.
With this I think we are ready to merge (unless the CI is unbearably slow and we need to address when to run it before merging).
.github/workflows/ci.yaml
Outdated
--net=host \ | ||
--platform linux/${{ matrix.arch }} \ | ||
localhost/nox-cross-arch:latest \ | ||
nox -R -e ${{ matrix.nox-session }} |
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.
A way to still get the debug info about dependencies would be something like /bin/sh -c "nox --install-only -e ${{ matrix.nox-session }}; pip freeze; nox -e ${{ matrix.nox-session }}
.
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.
Makes sense. Done
One more comment, if you can maybe let the job run once in this PR it might be interesting to know how much time does it get to run in GitHub Actions. |
Done |
As mentioned in threads, |
I removed the filter to run it only on merge_group events, to get some test results. |
1bd1a43
to
017cdfb
Compare
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.
Just 2 more comments, one small and one that might be important.
Great to see it green! So the cache makes a big difference but still with cache it is in the 15+m so I think we should proceed with only running on the merge queue. As we talked about, push is not necessary as the exact same commit tested in the merge queue will be pushed, so we'll be testing the exact same code twice. |
017cdfb
to
587a79c
Compare
Pushing the workaround in a bit. |
OK, another option I guess it would be to create a fake non matrix job with the same name, maybe that's easier and less confusing as it could still be marked as skipped |
I'm thinking about: # TODO: Add comment explaining what is this for
nox-cross-arch-dummy:
name: Cross-arch tests with nox
if: never()
runs-on: ${{ matrix.os }}
steps:
- name: Dummy step
run: true
nox-cross-arch:
name: Cross-arch tests with nox
if: github.event_name == 'merge_group'
strategy:
fail-fast: false
# Before adding new items to this matrix, make sure that a dockerfile
# exists for the combination of items in the matrix.
# Refer to .github/containers/nox-cross-arch/README.md to learn how to
# add and name new dockerfiles.
matrix:
arch:
- arm64
os:
- ubuntu-20.04
python:
- "3.11"
nox-session:
- "pytest_min"
- "pytest_max"
runs-on: ${{ matrix.os }}
steps:
- name: Fetch sources
uses: actions/checkout@v3
#... |
Oh, no, we should fake the ones that run in the queue, so it is more boilerplate, as we need 2 dummy jobs (actually one per matrix item in the future). |
Another workaround would be to create a dummy job that runs only on merge_group events, and marking it as a dependency for the nox-cross-arch job. I need to read a bit more about the issue. Maybe the CI handles |
Not sure if it is worth it in this case, but just in case: # TODO: Add comment explaining what is this for
nox-cross-arch-dummy-min:
name: Cross-arch tests with nox (arm64, ubuntu-20.04, 3.11, pytest_min)
if: never()
runs-on: ${{ matrix.os }}
steps:
- name: Dummy step
run: true
nox-cross-arch-dummy-max:
name: Cross-arch tests with nox (arm64, ubuntu-20.04, 3.11, pytest_max)
if: never()
runs-on: ${{ matrix.os }}
steps:
- name: Dummy step
run: true
nox-cross-arch:
name: Cross-arch tests with nox
if: github.event_name == 'merge_group'
strategy:
fail-fast: false
# Before adding new items to this matrix, make sure that a dockerfile
# exists for the combination of items in the matrix.
# Refer to .github/containers/nox-cross-arch/README.md to learn how to
# add and name new dockerfiles.
matrix:
arch:
- arm64
os:
- ubuntu-20.04
python:
- "3.11"
nox-session:
- "pytest_min"
- "pytest_max"
runs-on: ${{ matrix.os }}
steps:
- name: Fetch sources
uses: actions/checkout@v3
#... |
Ah, yeah, that's not bad to have a job that "merges" all the matrix jobs for cross-arch and we add that as the branch protection 👍 |
# TODO: Add comment explaining what is this for
nox-cross-arch-all:
needs: ["nox-cross-arch"]
name: Cross-arch tests with nox
if: github.event_name == 'merge_group'
runs-on: ubuntu-20.04
steps:
- name: Dummy step
run: true
nox-cross-arch:
name: Cross-arch tests with nox
if: github.event_name == 'merge_group'
strategy:
fail-fast: false
# Before adding new items to this matrix, make sure that a dockerfile
# exists for the combination of items in the matrix.
# Refer to .github/containers/nox-cross-arch/README.md to learn how to
# add and name new dockerfiles.
matrix:
arch:
- arm64
os:
- ubuntu-20.04
python:
- "3.11"
nox-session:
- "pytest_min"
- "pytest_max"
runs-on: ${{ matrix.os }}
steps:
- name: Fetch sources
uses: actions/checkout@v3
#... I think this should work. For merge queues For PRs |
Yep, that's exactly what I was thinking of. |
Added the workaround. |
7a8fe42
to
f7d9b86
Compare
Jobs are not being created, it seems like something is wrong:
|
.github/workflows/ci.yaml
Outdated
@@ -176,7 +284,7 @@ jobs: | |||
|
|||
publish-docs: | |||
name: Publish documentation website to GitHub pages | |||
needs: ["nox", "test-installation"] | |||
needs: ["nox", "nox-cross-arch", "test-installation"] |
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.
Also this, just to make the jobs graph look prettier :P
needs: ["nox", "nox-cross-arch", "test-installation"] | |
needs: ["nox", "nox-cross-arch-all", "test-installation"] |
# https://github.com/orgs/community/discussions/9141 | ||
nox-cross-arch-all: | ||
name: Cross-arch tests with nox | ||
needs: ["nox-cross-arch"] |
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.
needs: ["nox-cross-arch"] | |
needs: ["nox-cross-arch"] | |
runs-on: ubuntu-20.04 |
Oops that looks like a bug. Checking. |
This job runs if `nox-cross-arch` ran and succeeded. This is required because, when the `nox-cross-arch` job is skipped, its inner matrix is not expanded, and branch protection rules on the inner-matrix jobs get stuck. So instead of `nox-cross-arch`, this job can be used in the branch protection rules. Signed-off-by: Tiyash Basu <[email protected]>
f7d9b86
to
e9b34c8
Compare
Fixed. |
This change introduces a new job to the CI to test the SDK on non-native architectures. Github CI ATM provides amd64 runners by default, so the new job targets testing on arch64 for now.
The tests are run in containers running on the target platform(s). The container definitions are supposed to exist in the directory .github/containers/nox-cross-arch. A definition for an arm64-ubuntu20.04-python3.11 container can be found there.
Since the tests take quite a while to run, given that they run on emulations, this step runs only on the
merge_group
event.