diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 702af62..73c640b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -21,14 +21,28 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest, macos-latest] + os: [windows-latest] steps: - uses: actions/checkout@v2 + - run: | + npm install + npm run all - uses: ./ + - name: Run conda list + run: conda list + - name: init pwsh + run: conda init --system powershell - name: Install Python - run: mamba install -y -c conda-forge python + shell: powershell + # run: echo "%PATH%" && CALL activate.bat base && conda info && echo "%PATH%" + run: | + conda activate base + conda env list + echo "$env:path" + - name: Install stuff + run: conda activate base && mamba.bat install -y -c conda-forge xtensor - name: Install Notebook and widgets - run: mamba install -y -c notebook ipywidgets + run: mamba.bat install -y -c conda-forge notebook ipywidgets - name: List the packages - run: mamba list + run: mamba.bat list diff --git a/dist/index.js b/dist/index.js index b0510f2..329520b 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1021,6 +1021,15 @@ function installMamba() { yield exec.exec('conda', ['install', '-y', '-c', 'conda-forge', 'mamba']); }); } +function activate(os) { + return __awaiter(this, void 0, void 0, function* () { + if (os === 'win32') { + const basePath = process.env.CONDA; + const activateFile = path.join(basePath, 'condabin', 'activate.bat'); + yield exec.exec('conda', ['shell.powershell', activateFile, 'base']); + } + }); +} function run() { return __awaiter(this, void 0, void 0, function* () { try { @@ -1029,6 +1038,8 @@ function run() { fixPermissions(os); core.debug('Add conda to the path'); yield addPath(os); + core.debug('Activate the environment'); + activate(os); core.debug('Installing mamba'); yield installMamba(); } diff --git a/src/main.ts b/src/main.ts index 75dbd11..44486e6 100644 --- a/src/main.ts +++ b/src/main.ts @@ -22,8 +22,13 @@ async function addPath(os: string): Promise { const bin = path.join(basePath, 'condabin') core.addPath(bin) } else if (os === 'win32') { - const bin = path.join(basePath, 'Scripts') - core.addPath(bin) + core.addPath(path.join(basePath, 'Library', 'bin')) + core.addPath(path.join(basePath, 'condabin')) + core.addPath(path.join(basePath, 'bin')) + core.addPath(path.join(basePath, 'Scripts')) + core.addPath(path.join(basePath, 'Library', 'usr', 'bin')) + core.addPath(path.join(basePath, 'Library', 'mingw-w64', 'bin')) + core.addPath(path.join(basePath)) } else { const bin = path.join(basePath, 'bin') core.addPath(bin) @@ -34,6 +39,14 @@ async function installMamba(): Promise { await exec.exec('conda', ['install', '-y', '-c', 'conda-forge', 'mamba']) } +async function activate(os: string): Promise { + if (os === 'win32') { + const basePath = process.env.CONDA as string + const activateFile = path.join(basePath, 'condabin', 'activate.bat') + await exec.exec('conda', ['shell.powershell', activateFile, 'base']) + } +} + async function run(): Promise { try { const os = process.platform @@ -44,6 +57,9 @@ async function run(): Promise { core.debug('Add conda to the path') await addPath(os) + core.debug('Activate the environment') + activate(os) + core.debug('Installing mamba') await installMamba() } catch (error) {