diff --git a/.github/workflows/example-13.yml b/.github/workflows/example-13.yml index 716e6e63..599a58b9 100644 --- a/.github/workflows/example-13.yml +++ b/.github/workflows/example-13.yml @@ -50,7 +50,7 @@ jobs: miniconda-version: latest - uses: ./ if: matrix.variant == 'no-variant' - id: setup-miniconda-no-variant + id: setup-miniforge-no-variant continue-on-error: true with: miniforge-version: latest diff --git a/.github/workflows/example-15.yml b/.github/workflows/example-15.yml new file mode 100644 index 00000000..2efc3f77 --- /dev/null +++ b/.github/workflows/example-15.yml @@ -0,0 +1,78 @@ +name: "Example 15: Linux ARM" + +on: + pull_request: + branches: + - "*" + push: + branches: + - "develop" + - "main" + - "master" + schedule: + # Note that cronjobs run on master/main by default + - cron: "0 0 * * *" + +jobs: + example-15: + # prevent cronjobs from running on forks + if: + (github.event_name == 'schedule' && github.repository == + 'conda-incubator/setup-miniconda') || (github.event_name != 'schedule') + name: Ex15 (os=${{ matrix.os }} variant=${{ matrix.variant }}) + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: ["ubuntu-24.04-arm"] + variant: ["Miniforge3", "Miniconda", "no-variant", "empty-with"] + steps: + - uses: actions/checkout@v4 + - uses: ./ + if: matrix.variant == 'Miniforge3' + id: setup-miniforge + continue-on-error: true + with: + auto-update-conda: true + miniforge-variant: ${{ matrix.variant }} + miniforge-version: latest + - uses: ./ + if: matrix.variant == 'Miniconda' + id: setup-miniconda + continue-on-error: true + with: + auto-update-conda: true + miniconda-version: latest + - uses: ./ + if: matrix.variant == 'no-variant' + id: setup-miniforge-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 + - 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 + if: matrix.variant == 'Miniforge3' + shell: bash -el {0} + run: mamba --version + - name: Install Python + shell: bash -el {0} + run: conda install -y python + - name: Check architecture + shell: bash -el {0} + run: | + python -c "import platform; assert platform.machine() == 'aarch64', platform.machine()" diff --git a/README.md b/README.md index 4820180f..3d03620d 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,7 @@ possibility of automatically activating the `test` environment on all shells. | [Caching environments](#caching-environments) | [![Caching Env Example Status][caching-env-badge]][caching-env] | | [Apple Silicon](#example-13-apple-silicon) | [![Apple Silicon][ex13-badge]][ex13] | | [Remove defaults](#example-14-remove-defaults-channel) | [![Remove defaults][ex14-badge]][ex14] | +| [Linux ARM](#example-15-linux-arm) | [![Linux ARM][ex15-badge]][ex15] | [ex1]: https://github.com/conda-incubator/setup-miniconda/actions/workflows/example-1.yml @@ -117,6 +118,10 @@ possibility of automatically activating the `test` environment on all shells. https://github.com/conda-incubator/setup-miniconda/actions/workflows/example-14.yml [ex14-badge]: https://github.com/conda-incubator/setup-miniconda/actions/workflows/example-14.yml/badge.svg?branch=main +[ex15]: + https://github.com/conda-incubator/setup-miniconda/actions/workflows/example-15.yml +[ex15-badge]: + https://github.com/conda-incubator/setup-miniconda/actions/workflows/example-15.yml/badge.svg?branch=main ## Other Workflows @@ -595,10 +600,10 @@ jobs: steps: - uses: actions/checkout@v4 - uses: ./ - id: setup-miniconda + id: setup-miniforge continue-on-error: true with: - miniconda-version: latest + miniforge-version: latest - name: Check arm64 shell: bash -el {0} run: | @@ -635,6 +640,31 @@ jobs: conda config --show-sources ``` +### Example 15: Linux ARM + +```yaml +jobs: + example-15: + name: Ex15 (os=${{ matrix.os }}) + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: ["ubuntu-24.04-arm"] + steps: + - uses: actions/checkout@v4 + - uses: ./ + id: setup-miniconda + continue-on-error: true + with: + miniforge-version: latest + - name: Check ARM + shell: bash -el {0} + run: | + conda install -y python + python -c "import platform; assert platform.machine() == 'aarch64', platform.machine()" +``` + ## Caching ### Caching packages diff --git a/dist/delete/index.js b/dist/delete/index.js index fdfeb41e..a0261489 100644 --- a/dist/delete/index.js +++ b/dist/delete/index.js @@ -28231,9 +28231,9 @@ exports.MINICONDA_ARCHITECTURES = { exports.MINIFORGE_ARCHITECTURES = { x64: "x86_64", x86_64: "x86_64", - aarch64: "aarch64", // To be supported by github runners + aarch64: "aarch64", ppc64le: "ppc64le", // To be supported by github runners - arm64: "arm64", // To be supported by github runners + arm64: "arm64", }; exports.OS_NAMES = { win32: "Windows", @@ -28523,9 +28523,14 @@ const RULES = [ */ function parseInputs() { return __awaiter(this, void 0, void 0, function* () { + let arch = core.getInput("architecture") || process.arch; + if (arch === "arm64" && constants.IS_LINUX) { + // https://github.com/conda-incubator/setup-miniconda/issues/385 + arch = "aarch64"; + } const inputs = Object.freeze({ activateEnvironment: core.getInput("activate-environment"), - architecture: core.getInput("architecture") || process.arch, + architecture: arch, condaBuildVersion: core.getInput("conda-build-version"), condaConfigFile: core.getInput("condarc-file"), condaVersion: core.getInput("conda-version"), diff --git a/dist/setup/index.js b/dist/setup/index.js index 1324d1e4..7c2762aa 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -47108,9 +47108,9 @@ exports.MINICONDA_ARCHITECTURES = { exports.MINIFORGE_ARCHITECTURES = { x64: "x86_64", x86_64: "x86_64", - aarch64: "aarch64", // To be supported by github runners + aarch64: "aarch64", ppc64le: "ppc64le", // To be supported by github runners - arm64: "arm64", // To be supported by github runners + arm64: "arm64", }; exports.OS_NAMES = { win32: "Windows", @@ -47700,9 +47700,14 @@ const RULES = [ */ function parseInputs() { return __awaiter(this, void 0, void 0, function* () { + let arch = core.getInput("architecture") || process.arch; + if (arch === "arm64" && constants.IS_LINUX) { + // https://github.com/conda-incubator/setup-miniconda/issues/385 + arch = "aarch64"; + } const inputs = Object.freeze({ activateEnvironment: core.getInput("activate-environment"), - architecture: core.getInput("architecture") || process.arch, + architecture: arch, condaBuildVersion: core.getInput("conda-build-version"), condaConfigFile: core.getInput("condarc-file"), condaVersion: core.getInput("conda-version"), @@ -48010,10 +48015,6 @@ function downloadMiniconda(pythonMajorVersion, inputs) { if (!arch) { throw new Error(`Invalid arch "${inputs.architecture}"!`); } - // Backwards compatibility: ARM64 used to map to aarch64 - if (arch === "arm64" && constants.IS_LINUX) { - arch = constants.MINICONDA_ARCHITECTURES["aarch64"]; - } let extension = constants.IS_UNIX ? "sh" : "exe"; let osName = constants.OS_NAMES[process.platform]; let minicondaVersion = inputs.minicondaVersion || "latest"; diff --git a/src/constants.ts b/src/constants.ts index af1a21de..d52f2fa2 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -31,9 +31,9 @@ export const MINICONDA_ARCHITECTURES: types.IArchitectures = { export const MINIFORGE_ARCHITECTURES: types.IArchitectures = { x64: "x86_64", x86_64: "x86_64", - aarch64: "aarch64", // To be supported by github runners + aarch64: "aarch64", ppc64le: "ppc64le", // To be supported by github runners - arm64: "arm64", // To be supported by github runners + arm64: "arm64", }; export const OS_NAMES: types.IOperatingSystems = { diff --git a/src/input.ts b/src/input.ts index 21a7a0b3..1662fb71 100644 --- a/src/input.ts +++ b/src/input.ts @@ -79,9 +79,14 @@ const RULES: IRule[] = [ * Parse, validate, and normalize string-ish inputs from a workflow action's `with` */ export async function parseInputs(): Promise { + let arch = core.getInput("architecture") || process.arch; + if (arch === "arm64" && constants.IS_LINUX) { + // https://github.com/conda-incubator/setup-miniconda/issues/385 + arch = "aarch64"; + } const inputs: types.IActionInputs = Object.freeze({ activateEnvironment: core.getInput("activate-environment"), - architecture: core.getInput("architecture") || process.arch, + architecture: arch, condaBuildVersion: core.getInput("conda-build-version"), condaConfigFile: core.getInput("condarc-file"), condaVersion: core.getInput("conda-version"), diff --git a/src/installer/download-miniconda.ts b/src/installer/download-miniconda.ts index abc2473b..fbde4dbf 100644 --- a/src/installer/download-miniconda.ts +++ b/src/installer/download-miniconda.ts @@ -52,10 +52,6 @@ export async function downloadMiniconda( if (!arch) { throw new Error(`Invalid arch "${inputs.architecture}"!`); } - // Backwards compatibility: ARM64 used to map to aarch64 - if (arch === "arm64" && constants.IS_LINUX) { - arch = constants.MINICONDA_ARCHITECTURES["aarch64"]; - } let extension: string = constants.IS_UNIX ? "sh" : "exe"; let osName: string = constants.OS_NAMES[process.platform];