-
Notifications
You must be signed in to change notification settings - Fork 120
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: use rustup instead of actions-rs #2168
Conversation
# Build the tests before running to improve cross compilation speed | ||
- name: Run cargo build | ||
uses: actions-rs/cargo@v1.0.3 | ||
with: | ||
command: build | ||
args: --tests ${{ matrix.exclude }} ${{ matrix.target != 'native' && format('--target {0}', matrix.target) || '' }} ${{ matrix.args }} | ||
use-cross: ${{ matrix.target != 'native' }} | ||
- name: Run cargo/cross build | ||
run: | | ||
${{ matrix.target != 'native' && 'cross' || 'cargo' }} build --tests ${{ matrix.exclude }} ${{ matrix.target != 'native' && format('--target {0}', matrix.target) || '' }} ${{ matrix.args }} | ||
|
||
- name: Run cargo test | ||
uses: actions-rs/cargo@v1.0.3 | ||
with: | ||
command: test | ||
args: ${{ matrix.exclude }} ${{ matrix.target != 'native' && format('--target {0}', matrix.target) || '' }} ${{ matrix.args }} | ||
use-cross: ${{ matrix.target != 'native' }} | ||
- name: Run cargo/cross test | ||
run: | | ||
${{ matrix.target != 'native' && 'cross' || 'cargo' }} test ${{ matrix.exclude }} ${{ matrix.target != 'native' && format('--target {0}', matrix.target) || '' }} ${{ matrix.args }} |
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 a bit verbose. I could split this into different tasks but then we would be repeating ourselves, which given the long list of args seems worse.
- name: build with cargo
if: ${{ matrix.target == 'native' }}
run: cargo build
- name: build with cross
if: ${{ matrix.target != 'native' }}
run: cross build
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.
We might be able to invoke cross
regardless? Like if we don't pass a --target
to cross does it just default to the host? Or is that a required parameter?
The other option would be to set an env var:
- name: ...
env:
CARGO_EXEC: ${{ matrix.target != 'native' && 'cross' || 'cargo' }}
run: |
..
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.
lemme experiment with those options.
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 tried something similar to the env (bash variable) and ran into issues with windows/powershell having trouble parsing the command $exec build ...
. I can give that one another try.
Always using cross
seems to work but its a bit weird because it always tries to run in a docker container:
-
on platforms where cross docker images are available, we use the same docker image as the host system
-
on platforms where a cross docker image is not available, we use
cargo
// this is good -
seems weird because lets say we are on x86_linux and we invoke
cross build
. We will run inside a docker x86_linux docker container. At the very least this is a behavior change from before. Can we expect full parity between docker and the host system? For a networking library I am a bit hesitant.
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.
nah just do what we're doing if that's the case
# Build the tests before running to improve cross compilation speed | ||
- name: Run cargo build | ||
uses: actions-rs/cargo@v1.0.3 | ||
with: | ||
command: build | ||
args: --tests ${{ matrix.exclude }} ${{ matrix.target != 'native' && format('--target {0}', matrix.target) || '' }} ${{ matrix.args }} | ||
use-cross: ${{ matrix.target != 'native' }} | ||
- name: Run cargo/cross build | ||
run: | | ||
${{ matrix.target != 'native' && 'cross' || 'cargo' }} build --tests ${{ matrix.exclude }} ${{ matrix.target != 'native' && format('--target {0}', matrix.target) || '' }} ${{ matrix.args }} | ||
|
||
- name: Run cargo test | ||
uses: actions-rs/cargo@v1.0.3 | ||
with: | ||
command: test | ||
args: ${{ matrix.exclude }} ${{ matrix.target != 'native' && format('--target {0}', matrix.target) || '' }} ${{ matrix.args }} | ||
use-cross: ${{ matrix.target != 'native' }} | ||
- name: Run cargo/cross test | ||
run: | | ||
${{ matrix.target != 'native' && 'cross' || 'cargo' }} test ${{ matrix.exclude }} ${{ matrix.target != 'native' && format('--target {0}', matrix.target) || '' }} ${{ matrix.args }} |
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.
We might be able to invoke cross
regardless? Like if we don't pass a --target
to cross does it just default to the host? Or is that a required parameter?
The other option would be to set an env var:
- name: ...
env:
CARGO_EXEC: ${{ matrix.target != 'native' && 'cross' || 'cargo' }}
run: |
..
dbac5fb
to
024aab5
Compare
Resolved issues:
#2096
Description of changes:
This PR removes actions-rs GHA (deprecated) and replaces it with rustup operations.
Testing:
Existing tests should pass
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.