Skip to content

Commit

Permalink
support miniforge-version: latest, add more architectures (#140)
Browse files Browse the repository at this point in the history
* support miniforge-version: latest, add more architectures

* add x86 alias for miniforge architectures

* fix miniforge latest link again, tests, etc
  • Loading branch information
bollwyvl authored Jan 2, 2021
1 parent f2eab79 commit e23d871
Show file tree
Hide file tree
Showing 7 changed files with 72 additions and 28 deletions.
7 changes: 2 additions & 5 deletions .github/workflows/example-10.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,13 @@ jobs:
fail-fast: false
matrix:
os: ["ubuntu", "macos", "windows"]
include:
- os: windows
miniforge-version: 4.9.2-4
steps:
- uses: actions/checkout@v2
- uses: ./
id: setup-miniconda
with:
environment-file: etc/example-environment.yml
miniforge-version: ${{ matrix.miniforge-version }}
miniforge-version: latest
- run: |
conda info
conda list
Expand Down Expand Up @@ -67,7 +64,7 @@ jobs:
- os: macos
environment-file: etc/example-empty-channels-environment.yml
miniforge-variant: Mambaforge-pypy3
miniforge-version: 4.9.2-4
miniforge-version: latest
- os: windows
environment-file: etc/example-explicit.Windows.conda.lock
condarc-file: etc/example-condarc.yml
Expand Down
9 changes: 2 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -382,23 +382,19 @@ jobs:
strategy:
matrix:
os: ["ubuntu", "macos", "windows"]
include:
- os: windows
miniforge-version: 4.9.2-4
steps:
- uses: actions/checkout@v2
- uses: conda-incubator/setup-miniconda@v2
id: setup-miniconda
with:
environment-file: etc/example-environment.yml
miniforge-version: ${{ matrix.miniforge-version }}
miniforge-version: latest
```

In addition to `Miniforge3`, with `conda` and `CPython`, for each
of its many supported platforms and architectures, additional variants including
`Mambaforge` (which comes pre-installed `mamba` in addition to `conda` on all platforms)
and `Miniforge-pypy3`/`Mamabaforge-pypy3` (which replace `CPython` with `pypy3`
on Linux/MacOs) are available. The specific version can also be overridden.
on Linux/MacOS) are available. A specific version can also be provided.

```yaml
jobs:
Expand All @@ -424,7 +420,6 @@ jobs:
steps:
- uses: actions/checkout@v2
- uses: conda-incubator/setup-miniconda@v2
id: setup-miniconda
with:
condarc-file: ${{ matrix.condarc-file }}
environment-file: ${{ matrix.environment-file }}
Expand Down
15 changes: 12 additions & 3 deletions dist/delete/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1161,7 +1161,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.PYTHON_SPEC = exports.WIN_PERMS_FOLDERS = exports.PROFILES = exports.ENV_VAR_CONDA_PKGS = exports.CONDA_CACHE_FOLDER = exports.CONDARC_PATH = exports.BOOTSTRAP_CONDARC = exports.FORCED_ERRORS = exports.IGNORED_WARNINGS = exports.MAMBA_SUBCOMMANDS = exports.KNOWN_EXTENSIONS = exports.BASE_ENV_NAMES = exports.MINIFORGE_URL_PREFIX = exports.OS_NAMES = exports.ARCHITECTURES = exports.MINICONDA_BASE_URL = exports.IS_UNIX = exports.IS_LINUX = exports.IS_MAC = exports.IS_WINDOWS = exports.MINICONDA_DIR_PATH = void 0;
exports.PYTHON_SPEC = exports.WIN_PERMS_FOLDERS = exports.PROFILES = exports.ENV_VAR_CONDA_PKGS = exports.CONDA_CACHE_FOLDER = exports.CONDARC_PATH = exports.BOOTSTRAP_CONDARC = exports.FORCED_ERRORS = exports.IGNORED_WARNINGS = exports.MAMBA_SUBCOMMANDS = exports.KNOWN_EXTENSIONS = exports.BASE_ENV_NAMES = exports.MINIFORGE_URL_PREFIX = exports.OS_NAMES = exports.MINIFORGE_ARCHITECTURES = exports.MINICONDA_ARCHITECTURES = exports.MINICONDA_BASE_URL = exports.IS_UNIX = exports.IS_LINUX = exports.IS_MAC = exports.IS_WINDOWS = exports.MINICONDA_DIR_PATH = void 0;
const os = __importStar(__webpack_require__(87));
const path = __importStar(__webpack_require__(622));
//-----------------------------------------------------------------------
Expand All @@ -1173,19 +1173,28 @@ exports.IS_MAC = process.platform === "darwin";
exports.IS_LINUX = process.platform === "linux";
exports.IS_UNIX = exports.IS_MAC || exports.IS_LINUX;
exports.MINICONDA_BASE_URL = "https://repo.anaconda.com/miniconda/";
exports.ARCHITECTURES = {
/** Processor architectures supported by Miniconda */
exports.MINICONDA_ARCHITECTURES = {
x64: "x86_64",
x86: "x86",
ARM64: "aarch64",
ARM32: "armv7l",
};
/** Processor architectures supported by Miniforge */
exports.MINIFORGE_ARCHITECTURES = {
x64: "x86_64",
x86_64: "x86_64",
aarch64: "aarch64",
ppc64le: "ppc64le",
arm64: "arm64",
};
exports.OS_NAMES = {
win32: "Windows",
darwin: "MacOSX",
linux: "Linux",
};
/** Common download prefix */
exports.MINIFORGE_URL_PREFIX = "https://github.com/conda-forge/miniforge/releases/download";
exports.MINIFORGE_URL_PREFIX = "https://github.com/conda-forge/miniforge/releases";
/** Names for a conda `base` env */
exports.BASE_ENV_NAMES = ["root", "base", ""];
/**
Expand Down
33 changes: 26 additions & 7 deletions dist/setup/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9358,7 +9358,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.PYTHON_SPEC = exports.WIN_PERMS_FOLDERS = exports.PROFILES = exports.ENV_VAR_CONDA_PKGS = exports.CONDA_CACHE_FOLDER = exports.CONDARC_PATH = exports.BOOTSTRAP_CONDARC = exports.FORCED_ERRORS = exports.IGNORED_WARNINGS = exports.MAMBA_SUBCOMMANDS = exports.KNOWN_EXTENSIONS = exports.BASE_ENV_NAMES = exports.MINIFORGE_URL_PREFIX = exports.OS_NAMES = exports.ARCHITECTURES = exports.MINICONDA_BASE_URL = exports.IS_UNIX = exports.IS_LINUX = exports.IS_MAC = exports.IS_WINDOWS = exports.MINICONDA_DIR_PATH = void 0;
exports.PYTHON_SPEC = exports.WIN_PERMS_FOLDERS = exports.PROFILES = exports.ENV_VAR_CONDA_PKGS = exports.CONDA_CACHE_FOLDER = exports.CONDARC_PATH = exports.BOOTSTRAP_CONDARC = exports.FORCED_ERRORS = exports.IGNORED_WARNINGS = exports.MAMBA_SUBCOMMANDS = exports.KNOWN_EXTENSIONS = exports.BASE_ENV_NAMES = exports.MINIFORGE_URL_PREFIX = exports.OS_NAMES = exports.MINIFORGE_ARCHITECTURES = exports.MINICONDA_ARCHITECTURES = exports.MINICONDA_BASE_URL = exports.IS_UNIX = exports.IS_LINUX = exports.IS_MAC = exports.IS_WINDOWS = exports.MINICONDA_DIR_PATH = void 0;
const os = __importStar(__webpack_require__(87));
const path = __importStar(__webpack_require__(622));
//-----------------------------------------------------------------------
Expand All @@ -9370,19 +9370,28 @@ exports.IS_MAC = process.platform === "darwin";
exports.IS_LINUX = process.platform === "linux";
exports.IS_UNIX = exports.IS_MAC || exports.IS_LINUX;
exports.MINICONDA_BASE_URL = "https://repo.anaconda.com/miniconda/";
exports.ARCHITECTURES = {
/** Processor architectures supported by Miniconda */
exports.MINICONDA_ARCHITECTURES = {
x64: "x86_64",
x86: "x86",
ARM64: "aarch64",
ARM32: "armv7l",
};
/** Processor architectures supported by Miniforge */
exports.MINIFORGE_ARCHITECTURES = {
x64: "x86_64",
x86_64: "x86_64",
aarch64: "aarch64",
ppc64le: "ppc64le",
arm64: "arm64",
};
exports.OS_NAMES = {
win32: "Windows",
darwin: "MacOSX",
linux: "Linux",
};
/** Common download prefix */
exports.MINIFORGE_URL_PREFIX = "https://github.com/conda-forge/miniforge/releases/download";
exports.MINIFORGE_URL_PREFIX = "https://github.com/conda-forge/miniforge/releases";
/** Names for a conda `base` env */
exports.BASE_ENV_NAMES = ["root", "base", ""];
/**
Expand Down Expand Up @@ -28242,7 +28251,7 @@ function minicondaVersions(arch) {
function downloadMiniconda(pythonMajorVersion, inputs) {
return __awaiter(this, void 0, void 0, function* () {
// Check valid arch
const arch = constants.ARCHITECTURES[inputs.architecture];
const arch = constants.MINICONDA_ARCHITECTURES[inputs.architecture];
if (!arch) {
throw new Error(`Invalid arch "${inputs.architecture}"!`);
}
Expand Down Expand Up @@ -34166,16 +34175,26 @@ const base = __importStar(__webpack_require__(122));
function downloadMiniforge(inputs, options) {
return __awaiter(this, void 0, void 0, function* () {
const version = inputs.miniforgeVersion.trim();
const arch = constants.ARCHITECTURES[inputs.architecture];
const arch = constants.MINIFORGE_ARCHITECTURES[inputs.architecture];
// Check valid arch
if (!arch) {
throw new Error(`Invalid 'architecture: ${inputs.architecture}'`);
}
const tool = inputs.miniforgeVariant.trim();
const extension = constants.IS_UNIX ? "sh" : "exe";
const osName = constants.OS_NAMES[process.platform];
const fileName = [tool, version, osName, `${arch}.${extension}`].join("-");
const url = [constants.MINIFORGE_URL_PREFIX, version, fileName].join("/");
let fileName;
let url;
if (version === "latest") {
// e.g. https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-x86_64.sh
fileName = [tool, osName, `${arch}.${extension}`].join("-");
url = [constants.MINIFORGE_URL_PREFIX, version, "download", fileName].join("/");
}
else {
// e.g. https://github.com/conda-forge/miniforge/releases/download/4.9.2-5/Miniforge3-4.9.2-5-Linux-x86_64.sh
fileName = [tool, version, osName, `${arch}.${extension}`].join("-");
url = [constants.MINIFORGE_URL_PREFIX, "download", version, fileName].join("/");
}
core.info(`Will fetch ${tool} ${version} from ${url}`);
return yield base.ensureLocalInstaller({ url, tool, version, arch });
});
Expand Down
14 changes: 12 additions & 2 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,23 @@ export const IS_UNIX: boolean = IS_MAC || IS_LINUX;
export const MINICONDA_BASE_URL: string =
"https://repo.anaconda.com/miniconda/";

export const ARCHITECTURES: types.IArchitectures = {
/** Processor architectures supported by Miniconda */
export const MINICONDA_ARCHITECTURES: types.IArchitectures = {
x64: "x86_64",
x86: "x86",
ARM64: "aarch64", // To be supported by github runners
ARM32: "armv7l", // To be supported by github runners
};

/** Processor architectures supported by Miniforge */
export const MINIFORGE_ARCHITECTURES: types.IArchitectures = {
x64: "x86_64",
x86_64: "x86_64",
aarch64: "aarch64", // To be supported by github runners
ppc64le: "ppc64le", // To be supported by github runners
arm64: "arm64", // To be supported by github runners
};

export const OS_NAMES: types.IOperatingSystems = {
win32: "Windows",
darwin: "MacOSX",
Expand All @@ -30,7 +40,7 @@ export const OS_NAMES: types.IOperatingSystems = {

/** Common download prefix */
export const MINIFORGE_URL_PREFIX =
"https://github.com/conda-forge/miniforge/releases/download";
"https://github.com/conda-forge/miniforge/releases";

/** Names for a conda `base` env */
export const BASE_ENV_NAMES = ["root", "base", ""];
Expand Down
2 changes: 1 addition & 1 deletion src/installer/download-miniconda.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export async function downloadMiniconda(
inputs: types.IActionInputs
): Promise<string> {
// Check valid arch
const arch: string = constants.ARCHITECTURES[inputs.architecture];
const arch: string = constants.MINICONDA_ARCHITECTURES[inputs.architecture];
if (!arch) {
throw new Error(`Invalid arch "${inputs.architecture}"!`);
}
Expand Down
20 changes: 17 additions & 3 deletions src/installer/download-miniforge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export async function downloadMiniforge(
options: types.IDynamicOptions
): Promise<string> {
const version = inputs.miniforgeVersion.trim();
const arch = constants.ARCHITECTURES[inputs.architecture];
const arch = constants.MINIFORGE_ARCHITECTURES[inputs.architecture];

// Check valid arch
if (!arch) {
Expand All @@ -23,8 +23,22 @@ export async function downloadMiniforge(
const tool = inputs.miniforgeVariant.trim();
const extension = constants.IS_UNIX ? "sh" : "exe";
const osName = constants.OS_NAMES[process.platform];
const fileName = [tool, version, osName, `${arch}.${extension}`].join("-");
const url = [constants.MINIFORGE_URL_PREFIX, version, fileName].join("/");

let fileName: string;
let url: string;
if (version === "latest") {
// e.g. https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-x86_64.sh
fileName = [tool, osName, `${arch}.${extension}`].join("-");
url = [constants.MINIFORGE_URL_PREFIX, version, "download", fileName].join(
"/"
);
} else {
// e.g. https://github.com/conda-forge/miniforge/releases/download/4.9.2-5/Miniforge3-4.9.2-5-Linux-x86_64.sh
fileName = [tool, version, osName, `${arch}.${extension}`].join("-");
url = [constants.MINIFORGE_URL_PREFIX, "download", version, fileName].join(
"/"
);
}

core.info(`Will fetch ${tool} ${version} from ${url}`);

Expand Down

0 comments on commit e23d871

Please sign in to comment.