Skip to content

Commit

Permalink
Fall back to miniconda3 latest when no bundled version + empty with p…
Browse files Browse the repository at this point in the history
…arams

Fixes the no "with"-parameters case on osx-arm64 while there is no bundled
version available.
  • Loading branch information
dbast committed Feb 27, 2024
1 parent f023502 commit 82cbdc0
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 8 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/example-13.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ jobs:
fail-fast: false
matrix:
os: ["macos-14"]
variant: ["Miniforge3", "Mambaforge", "Miniconda", "no-variant"]
variant:
["Miniforge3", "Mambaforge", "Miniconda", "no-variant", "empty-with"]
steps:
- uses: actions/checkout@v4
- uses: ./
Expand All @@ -46,10 +47,14 @@ jobs:
miniconda-version: latest
- uses: ./
if: matrix.variant == 'no-variant'
id: setup-miniconda2
id: setup-miniconda-no-variant
continue-on-error: true
with:
miniforge-version: latest
- uses: ./
if: matrix.variant == 'empty-with'
id: setup-miniconda-empty-with
continue-on-error: true
- name: Conda info
shell: bash -el {0}
run: conda info
Expand Down
10 changes: 7 additions & 3 deletions dist/setup/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48920,7 +48920,8 @@ function downloadMiniconda(pythonMajorVersion, inputs) {
}
let extension = constants.IS_UNIX ? "sh" : "exe";
let osName = constants.OS_NAMES[process.platform];
const minicondaInstallerName = `Miniconda${pythonMajorVersion}-${inputs.minicondaVersion}-${osName}-${arch}.${extension}`;
let minicondaVersion = inputs.minicondaVersion || "latest";
const minicondaInstallerName = `Miniconda${pythonMajorVersion}-${minicondaVersion}-${osName}-${arch}.${extension}`;
core.info(minicondaInstallerName);
// Check version name
let versions = yield minicondaVersions(arch);
Expand Down Expand Up @@ -48948,7 +48949,7 @@ exports.downloadMiniconda = downloadMiniconda;
exports.minicondaDownloader = {
label: "download Miniconda",
provides: (inputs, options) => __awaiter(void 0, void 0, void 0, function* () {
return inputs.minicondaVersion !== "" && inputs.installerUrl === "";
return inputs.installerUrl === "";
}),
installerPath: (inputs, options) => __awaiter(void 0, void 0, void 0, function* () {
return {
Expand Down Expand Up @@ -49175,12 +49176,15 @@ const bundled_miniconda_1 = __nccwpck_require__(3390);
* - add any new RULEs in ../input.ts, for example if the installer is not
* compatible with some architectures
* - add a test!
* - The order is impprtant:
* - the first provider that provides according to the inputs/options is used.
* - the last provider has a fallback in case of no inputs given.
*/
const INSTALLER_PROVIDERS = [
bundled_miniconda_1.bundledMinicondaUser,
download_url_1.urlDownloader,
download_miniconda_1.minicondaDownloader,
download_miniforge_1.miniforgeDownloader,
download_miniconda_1.minicondaDownloader,
];
/** See if any provider works with the given inputs and options */
function getLocalInstallerPath(inputs, options) {
Expand Down
5 changes: 3 additions & 2 deletions src/installer/download-miniconda.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ export async function downloadMiniconda(

let extension: string = constants.IS_UNIX ? "sh" : "exe";
let osName: string = constants.OS_NAMES[process.platform];
const minicondaInstallerName: string = `Miniconda${pythonMajorVersion}-${inputs.minicondaVersion}-${osName}-${arch}.${extension}`;
let minicondaVersion = inputs.minicondaVersion || "latest";
const minicondaInstallerName: string = `Miniconda${pythonMajorVersion}-${minicondaVersion}-${osName}-${arch}.${extension}`;
core.info(minicondaInstallerName);

// Check version name
Expand Down Expand Up @@ -90,7 +91,7 @@ export async function downloadMiniconda(
export const minicondaDownloader: types.IInstallerProvider = {
label: "download Miniconda",
provides: async (inputs, options) => {
return inputs.minicondaVersion !== "" && inputs.installerUrl === "";
return inputs.installerUrl === "";
},
installerPath: async (inputs, options) => {
return {
Expand Down
5 changes: 4 additions & 1 deletion src/installer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,15 @@ import { bundledMinicondaUser } from "./bundled-miniconda";
* - add any new RULEs in ../input.ts, for example if the installer is not
* compatible with some architectures
* - add a test!
* - The order is impprtant:
* - the first provider that provides according to the inputs/options is used.
* - the last provider has a fallback in case of no inputs given.
*/
const INSTALLER_PROVIDERS: types.IInstallerProvider[] = [
bundledMinicondaUser,
urlDownloader,
minicondaDownloader,
miniforgeDownloader,
minicondaDownloader,
];

/** See if any provider works with the given inputs and options */
Expand Down

0 comments on commit 82cbdc0

Please sign in to comment.