Skip to content

working-directory: #12

@kousu

Description

@kousu

I would like to use working-directory: to make my WSL tests test inside of WSL, not over the Windows mountpoint. The Windows virtual mountpoints in /mnt/c, /mnt/d, /c/, /d/, are slow (spinalcordtoolbox/spinalcordtoolbox#3575) and glitchy (spinalcordtoolbox/spinalcordtoolbox#3571).

  windows-wsl-ubuntu-20_04:
    name: WSL [Ubuntu 20.04]
    runs-on: windows-2019
    defaults:
      run:
        shell: wsl-bash {0} # https://github.com/marketplace/actions/setup-wsl#default-shell
        working-directory: /c/Users/runneradmin
    steps:
    - uses: Vampire/setup-wsl@v1
      with:
        distribution: Ubuntu-20.04
    - name: Dependencies
      run: |
        pwd # DEBUG
        sudo apt update && sudo DEBIAN_FRONTEND=noninteractive apt install -y gcc git curl mesa-utils

but as soon as my run gets to "Dependencies" it gives

Error: The directory name is invalid.

because working-directory: effectively runs cd on the outer system before calling shell: .

But if I use Windows-style paths:

        working-directory: C:\Users\runneradmin

it runs, but then pwd is /mnt/c/Users/runneradmin which is what I wanted to avoid in the first place.

If I simply do

  windows-wsl-ubuntu-20_04:
    name: WSL [Ubuntu 20.04]
    runs-on: windows-2019
    defaults:
      run:
        shell: wsl-bash {0} # https://github.com/marketplace/actions/setup-wsl#default-shell
    steps:
    - uses: Vampire/setup-wsl@v1
      with:
        distribution: Ubuntu-20.04
    - name: Dependencies
      run: |
        cd
        pwd # DEBUG
        sudo apt update && sudo DEBIAN_FRONTEND=noninteractive apt install -y gcc git curl mesa-utils

on the other hand, then pwd is /root, which works for me and is what I want, but then I need to paste that cd in to every step. Plus actions/checkout puts my repo in the Windows part, so I need to add:

    - uses: actions/checkout@v2
    - name: Copy from $GITHUB_WORKSPACE to ~
      run: cp -rp ../spinalcordtoolbox ~/spinalcordtoolbox

Any ideas on if there a way to tell wsl-bash to respect default: working-directory: ...? Or maybe a separate default: wsl-working-directory: ...?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions