Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable ARM64 on macOS for Miniforge and Mambaforge. #331

Merged
merged 19 commits into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
124 changes: 124 additions & 0 deletions .github/workflows/example-13.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
name: "Example 13: Apple Silicon"

on:
pull_request:
branches:
- "*"
push:
branches:
- "develop"
- "main"
- "master"
schedule:
# Note that cronjobs run on master/main by default
- cron: "0 0 * * *"

jobs:
example-13-1:
# prevent cronjobs from running on forks
if:
(github.event_name == 'schedule' && github.repository ==
'conda-incubator/setup-miniconda') || (github.event_name != 'schedule')
name: Ex13 (os=${{ matrix.os }} variant=${{ matrix.variant }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["macos-14"]
variant: ["Miniforge3", "Mambaforge", "Miniconda"]
steps:
- uses: actions/checkout@v4
- uses: ./
if: matrix.variant != 'Miniconda'
id: setup-miniforge
continue-on-error: true
with:
auto-update-conda: true
architecture: arm64
miniforge-variant: ${{ matrix.variant }}
miniforge-version: latest
- name: Conda info
shell: bash -el {0}
run: conda info
- name: Conda list
shell: bash -el {0}
run: conda list
- name: Environment
shell: bash -el {0}
run: printenv | sort
- name: Create an environment
shell: bash -el {0}
run: conda create -n unused --dry-run zlib
- name: Run mamba
shell: bash -el {0}
run: mamba --version
- name: Check arm64
shell: bash -el {0}
run:
python -c "import platform; assert platform.machine() == 'arm64',
platform.machine()"
dbast marked this conversation as resolved.
Show resolved Hide resolved
- uses: ./
if: matrix.variant == 'Miniconda'
id: setup-miniconda
continue-on-error: true
with:
auto-update-conda: true
miniconda-version: latest
- name: Conda info
shell: bash -el {0}
run: conda info
- name: Conda list
shell: bash -el {0}
run: conda list
- name: Environment
shell: bash -el {0}
run: printenv | sort
- name: Create an environment
shell: bash -el {0}
run: conda create -n unused --dry-run zlib
- name: Run mamba
shell: bash -el {0}
run: mamba --version
- name: Check arm64
shell: bash -el {0}
run:
python -c "import platform; assert platform.machine() == 'arm64',
platform.machine()"
example-13-2:
# prevent cronjobs from running on forks
if:
(github.event_name == 'schedule' && github.repository ==
'conda-incubator/setup-miniconda') || (github.event_name != 'schedule')
name: Ex13 (os=${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["macos-14"]
steps:
- uses: actions/checkout@v4
- uses: ./
id: setup-miniconda
continue-on-error: true
with:
miniforge-version: latest
dbast marked this conversation as resolved.
Show resolved Hide resolved
- name: Conda info
shell: bash -el {0}
run: conda info
- name: Conda list
shell: bash -el {0}
run: conda list
- name: Environment
shell: bash -el {0}
run: printenv | sort
- name: Create an environment
shell: bash -el {0}
run: conda create -n unused --dry-run zlib
- name: Run mamba
shell: bash -el {0}
run: mamba --version
- name: Check arm64
shell: bash -el {0}
run:
python -c "import platform; assert platform.machine() == 'arm64',
platform.machine()"
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# CHANGELOG

## [v3.0.2] (UNRELEASED)

### Fixes

- [#312] Enable ARM64 on macOS for Miniforge and Mambaforge.

## [v3.0.1] (2023-11-29)

### Fixes
Expand Down
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ possibility of automatically activating the `test` environment on all shells.
| [Configure conda solver](#example-12-configure-conda-solver) | [![Configure conda solver][ex12-badge]][ex12] |
| [Caching packages](#caching-packages) | [![Caching Example Status][caching-badge]][caching] |
| [Caching environments](#caching-environments) | [![Caching Env Example Status][caching-env-badge]][caching-env] |
| [Apple Silicon](#example-13-apple-silicon) | [![Apple Silicon][ex13-badge]][ex13] |

[ex1]:
https://github.com/conda-incubator/setup-miniconda/actions/workflows/example-1.yml
Expand Down Expand Up @@ -107,6 +108,10 @@ possibility of automatically activating the `test` environment on all shells.
https://github.com/conda-incubator/setup-miniconda/actions/workflows/example-12.yml
[ex12-badge]:
https://github.com/conda-incubator/setup-miniconda/actions/workflows/example-12.yml/badge.svg?branch=main
[ex13]:
https://github.com/conda-incubator/setup-miniconda/actions/workflows/example-13.yml
[ex13-badge]:
https://github.com/conda-incubator/setup-miniconda/actions/workflows/example-13.yml/badge.svg?branch=main

## Other Workflows

Expand Down Expand Up @@ -596,6 +601,31 @@ jobs:
python-version: "3.9"
```

### Example 13: Apple Silicon

```yaml
jobs:
example-13:
name: Ex13 (os=${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["macos-14"]
steps:
- uses: actions/checkout@v4
- uses: ./
id: setup-miniconda
continue-on-error: true
with:
miniconda-version: latest
- name: Check arm64
shell: bash -el {0}
run:
python -c "import platform; assert platform.machine() == 'arm64',
platform.machine()"
```

## Caching

### Caching packages
Expand Down
4 changes: 1 addition & 3 deletions dist/setup/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48148,8 +48148,6 @@ const RULES = [
(i) => !!(i.installerUrl &&
!constants.KNOWN_EXTENSIONS.includes(urlExt(i.installerUrl))) &&
`'installer-url' extension '${urlExt(i.installerUrl)}' must be one of: ${constants.KNOWN_EXTENSIONS}`,
(i) => !!(!i.minicondaVersion && i.architecture !== "x64") &&
`'architecture: ${i.architecture}' requires "miniconda-version"`,
(i) => !!(i.architecture === "x86" && !constants.IS_WINDOWS) &&
`'architecture: ${i.architecture}' is only available for recent versions on Windows`,
(i) => !!(!["latest", ""].includes(i.minicondaVersion) &&
Expand Down Expand Up @@ -48552,7 +48550,7 @@ function downloadMiniforge(inputs, options) {
return __awaiter(this, void 0, void 0, function* () {
const tool = inputs.miniforgeVariant.trim() || constants.MINIFORGE_DEFAULT_VARIANT;
const version = inputs.miniforgeVersion.trim() || constants.MINIFORGE_DEFAULT_VERSION;
const arch = constants.MINIFORGE_ARCHITECTURES[inputs.architecture];
const arch = constants.MINIFORGE_ARCHITECTURES[inputs.architecture.toLowerCase()];
// Check valid arch
if (!arch) {
throw new Error(`Invalid 'architecture: ${inputs.architecture}'`);
Expand Down
3 changes: 0 additions & 3 deletions src/input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,6 @@ const RULES: IRule[] = [
`'installer-url' extension '${urlExt(i.installerUrl)}' must be one of: ${
constants.KNOWN_EXTENSIONS
}`,
(i) =>
!!(!i.minicondaVersion && i.architecture !== "x64") &&
`'architecture: ${i.architecture}' requires "miniconda-version"`,
(
i, // Miniconda x86 is only published for Windows lately (last Linux was 2019, last MacOS 2015)
) =>
Expand Down
3 changes: 2 additions & 1 deletion src/installer/download-miniforge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ export async function downloadMiniforge(
inputs.miniforgeVariant.trim() || constants.MINIFORGE_DEFAULT_VARIANT;
const version =
inputs.miniforgeVersion.trim() || constants.MINIFORGE_DEFAULT_VERSION;
const arch = constants.MINIFORGE_ARCHITECTURES[inputs.architecture];
const arch =
constants.MINIFORGE_ARCHITECTURES[inputs.architecture.toLowerCase()];

// Check valid arch
if (!arch) {
Expand Down