@@ -11496,7 +11496,7 @@ function getRustTarget(args) {
11496
11496
}
11497
11497
return ( ( _c = TARGET_ALIASES [ process . platform ] ) === null || _c === void 0 ? void 0 : _c [ target ] ) || target ;
11498
11498
}
11499
- function getManifestDir ( args ) {
11499
+ function getWorkingDirectory ( ) {
11500
11500
const workspace = process . env . GITHUB_WORKSPACE ;
11501
11501
let workdir = core . getInput ( 'working-directory' ) ;
11502
11502
if ( workdir . length > 0 ) {
@@ -11505,6 +11505,10 @@ function getManifestDir(args) {
11505
11505
else {
11506
11506
workdir = workspace ;
11507
11507
}
11508
+ return workdir ;
11509
+ }
11510
+ function getManifestDir ( args ) {
11511
+ const workdir = getWorkingDirectory ( ) ;
11508
11512
const manifestPath = getCliValue ( args , '--manifest-path' ) || getCliValue ( args , '-m' ) ;
11509
11513
return manifestPath ? path . dirname ( path . join ( workdir , manifestPath ) ) : workdir ;
11510
11514
}
@@ -11518,21 +11522,37 @@ async function getRustToolchain(args) {
11518
11522
if ( rustToolchain . length > 0 ) {
11519
11523
return rustToolchain ;
11520
11524
}
11525
+ const root = process . env . GITHUB_WORKSPACE ;
11521
11526
const manifestDir = getManifestDir ( args ) ;
11522
- const rustToolchainToml = path . join ( manifestDir , 'rust-toolchain.toml' ) ;
11523
- if ( ( 0 , fs_1 . existsSync ) ( rustToolchainToml ) ) {
11524
- const content = await fs_1 . promises . readFile ( rustToolchainToml ) ;
11525
- rustToolchain = parseRustToolchain ( content . toString ( ) ) ;
11526
- core . info ( `Found Rust toolchain ${ rustToolchain } in rust-toolchain.toml ` ) ;
11527
- }
11528
- else if ( ( 0 , fs_1 . existsSync ) ( path . join ( manifestDir , 'rust-toolchain' ) ) ) {
11529
- rustToolchain = ( await fs_1 . promises . readFile ( path . join ( manifestDir , 'rust-toolchain' ) ) )
11530
- . toString ( )
11531
- . trim ( ) ;
11532
- if ( rustToolchain . includes ( '[toolchain]' ) ) {
11533
- rustToolchain = parseRustToolchain ( rustToolchain ) ;
11527
+ let currentDir = manifestDir ;
11528
+ while ( true ) {
11529
+ const toolchainToml = path . join ( currentDir , 'rust-toolchain.toml' ) ;
11530
+ const toolchain = path . join ( currentDir , 'rust-toolchain' ) ;
11531
+ if ( ( 0 , fs_1 . existsSync ) ( toolchainToml ) ) {
11532
+ const content = await fs_1 . promises . readFile ( toolchainToml ) ;
11533
+ rustToolchain = parseRustToolchain ( content . toString ( ) ) ;
11534
+ core . info ( `Found Rust toolchain ${ rustToolchain } in rust-toolchain.toml ` ) ;
11535
+ break ;
11534
11536
}
11535
- core . info ( `Found Rust toolchain ${ rustToolchain } in rust-toolchain ` ) ;
11537
+ else {
11538
+ core . debug ( `${ toolchainToml } doesn't exist` ) ;
11539
+ }
11540
+ if ( ( 0 , fs_1 . existsSync ) ( toolchain ) ) {
11541
+ rustToolchain = ( await fs_1 . promises . readFile ( toolchain ) ) . toString ( ) . trim ( ) ;
11542
+ if ( rustToolchain . includes ( '[toolchain]' ) ) {
11543
+ rustToolchain = parseRustToolchain ( rustToolchain ) ;
11544
+ }
11545
+ core . info ( `Found Rust toolchain ${ rustToolchain } in rust-toolchain ` ) ;
11546
+ break ;
11547
+ }
11548
+ else {
11549
+ core . debug ( `${ toolchain } doesn't exist` ) ;
11550
+ }
11551
+ if ( currentDir === root ) {
11552
+ core . debug ( `No rust-toolchain.toml or rust-toolchain found inside ${ root } ` ) ;
11553
+ break ;
11554
+ }
11555
+ currentDir = path . dirname ( currentDir ) ;
11536
11556
}
11537
11557
return rustToolchain ;
11538
11558
}
@@ -11744,10 +11764,11 @@ async function dockerBuild(container, maturinRelease, args) {
11744
11764
'echo "::group::Install Rust"' ,
11745
11765
`which rustup > /dev/null || curl --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain ${ rustToolchain } ` ,
11746
11766
'export PATH="$HOME/.cargo/bin:$PATH"' ,
11767
+ `echo "Install Rust toolchain ${ rustToolchain } "` ,
11747
11768
`rustup override set ${ rustToolchain } ` ,
11748
11769
`rustup component add llvm-tools-preview || true` ,
11749
11770
'echo "::endgroup::"' ,
11750
- 'export PATH="$PATH:/opt/python/cp37-cp37m/bin:/opt/python/cp38-cp38/bin:/opt/python/cp39-cp39/bin:/opt/python/cp310-cp310/bin:/opt/python/cp311-cp311/bin"' ,
11771
+ 'export PATH="$PATH:/opt/python/cp37-cp37m/bin:/opt/python/cp38-cp38/bin:/opt/python/cp39-cp39/bin:/opt/python/cp310-cp310/bin:/opt/python/cp311-cp311/bin:/opt/python/cp312-cp312/bin "' ,
11751
11772
'echo "::group::Install maturin"' ,
11752
11773
`curl -L ${ url } | tar -xz -C /usr/local/bin` ,
11753
11774
'maturin --version || true' ,
@@ -11814,13 +11835,7 @@ async function dockerBuild(container, maturinRelease, args) {
11814
11835
dockerEnvs . push ( env ) ;
11815
11836
}
11816
11837
}
11817
- let workdir = core . getInput ( 'working-directory' ) ;
11818
- if ( workdir . length > 0 ) {
11819
- workdir = path . join ( workspace , workdir ) ;
11820
- }
11821
- else {
11822
- workdir = workspace ;
11823
- }
11838
+ const workdir = getWorkingDirectory ( ) ;
11824
11839
const dockerVolumes = [ ] ;
11825
11840
const ssh_auth_sock = process . env . SSH_AUTH_SOCK ;
11826
11841
if ( ssh_auth_sock ) {
@@ -11927,11 +11942,12 @@ async function hostBuild(maturinRelease, args) {
11927
11942
const target = getRustTarget ( args ) ;
11928
11943
const rustToolchain = await getRustToolchain ( args ) ;
11929
11944
const rustupComponents = core . getInput ( 'rustup-components' ) ;
11930
- const workdir = core . getInput ( 'working-directory' ) || process . cwd ( ) ;
11945
+ const workdir = getWorkingDirectory ( ) ;
11931
11946
const sccache = core . getBooleanInput ( 'sccache' ) ;
11932
11947
const isUniversal2 = args . includes ( '--universal2' ) || target === 'universal2-apple-darwin' ;
11933
11948
core . startGroup ( 'Install Rust target' ) ;
11934
11949
if ( rustToolchain . length > 0 ) {
11950
+ core . info ( `Installing Rust toolchain ${ rustToolchain } ` ) ;
11935
11951
await exec . exec ( 'rustup' , [ 'override' , 'set' , rustToolchain ] ) ;
11936
11952
await exec . exec ( 'rustup' , [ 'component' , 'add' , 'llvm-tools-preview' ] , {
11937
11953
ignoreReturnCode : true
0 commit comments