Skip to content

Commit

Permalink
Merge pull request conda-incubator#98 from bollwyvl/fix-gh-97-custom-…
Browse files Browse the repository at this point in the history
…win-installer

Refactor tool downloading and output, add Windows MiniForge example
  • Loading branch information
goanpeca authored Nov 17, 2020
2 parents 91aff5a + 0435053 commit 8246c3d
Show file tree
Hide file tree
Showing 9 changed files with 573 additions and 352 deletions.
32 changes: 29 additions & 3 deletions .github/workflows/example-5.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,22 @@ on:

jobs:
example-5-linux:
name: Ex5 PyPy Linux
name: Ex5 PyPy Linux Local
runs-on: "ubuntu-latest"
env:
MINIFORGE_URL: https://github.com/conda-forge/miniforge/releases/download/4.9.0-3/Miniforge-pypy3-4.9.0-3-Linux-x86_64.sh
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v2
- run: |
curl -L ${MINIFORGE_URL} > /tmp/some-built-installer-${{ github.run_number }}.sh
- uses: ./
with:
installer-url: https://github.com/conda-forge/miniforge/releases/download/4.8.3-2/Miniforge-pypy3-4.8.3-2-Linux-x86_64.sh
installer-url:
file:///tmp/some-built-installer-${{ github.run_number
}}.sh?foo=bar&baz#zzz
allow-softlinks: true
show-channel-urls: true
use-only-tar-bz2: true
Expand All @@ -39,7 +45,7 @@ jobs:
- uses: actions/checkout@v2
- uses: ./
with:
installer-url: https://github.com/conda-forge/miniforge/releases/download/4.8.3-2/Miniforge-pypy3-4.8.3-2-MacOSX-x86_64.sh
installer-url: https://github.com/conda-forge/miniforge/releases/download/4.9.0-3/Miniforge-pypy3-4.9.0-3-MacOSX-x86_64.sh?foo=bar&baz
allow-softlinks: true
show-channel-urls: true
use-only-tar-bz2: true
Expand All @@ -49,3 +55,23 @@ jobs:
conda list
conda config --show-sources
conda config --show
example-5-win:
name: Ex5 Windows
runs-on: "windows-latest"
steps:
- uses: actions/checkout@v2
- uses: ./
with:
installer-url:
https://github.com/conda-forge/miniforge/releases/download/4.9.0-3/Miniforge3-4.9.0-0-Windows-x86_64.exe?foo=bar&baz#${{
github.run_number }}
show-channel-urls: true
use-only-tar-bz2: true
activate-environment: ""
- shell: bash -l {0}
run: |
conda info
conda list
conda config --show-sources
conda config --show
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# CHANGELOG

## [v2.1.0][] (Unreleased)

## Fixes

- [#97][] fixes `installer-url` on Windows

## [v2.0.0][] (2020-11-08)

### Fixes
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,9 @@ which includes `conda` can be used in place of Miniconda. For example,
[miniforge](https://github.com/conda-forge/miniforge/releases) for platforms not
yet supported by Miniconda.

> Note: Installer downloads are cached based on their full URL: adding some
non-functional salt to the URL will prevent this behavior, e.g. `#${{ github.run_number }}`

```yaml
jobs:
example-5:
Expand Down
4 changes: 2 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ inputs:
installer-url:
description:
"If provided, this installer will be used instead of a miniconda
installer. Visit https://github.com/conda/constructor for more information
on creating installers"
installer, and cached based on its full URL
Visit https://github.com/conda/constructor for more information on creating installers"
required: false
default: ""
miniconda-version:
Expand Down
31 changes: 13 additions & 18 deletions dist/delete/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -447,22 +447,17 @@ var __importStar = (this && this.__importStar) || function (mod) {
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.consoleLog = void 0;
const core = __importStar(__webpack_require__(470));
// General use
//-----------------------------------------------------------------------
/**
* Pretty print section messages
*
* @param args
*/
function consoleLog(...args) {
for (let arg of args) {
core.info("\n# " + arg);
core.info("#".repeat(arg.length + 2) + "\n");
}
exports.cacheFolder = exports.ENV_VAR_CONDA_PKGS = void 0;
const os = __importStar(__webpack_require__(87));
const path = __importStar(__webpack_require__(622));
/** Where to put files. Should eventually be configurable */
const CONDA_CACHE_FOLDER = "conda_pkgs_dir";
/** the environment variable exported */
exports.ENV_VAR_CONDA_PKGS = "CONDA_PKGS_DIR";
function cacheFolder() {
return path.join(os.homedir(), CONDA_CACHE_FOLDER);
}
exports.consoleLog = consoleLog;
exports.cacheFolder = cacheFolder;


/***/ }),
Expand Down Expand Up @@ -510,10 +505,9 @@ const utils = __importStar(__webpack_require__(163));
function run() {
return __awaiter(this, void 0, void 0, function* () {
try {
let cacheFolder = "~/conda_pkgs_dir";
cacheFolder = cacheFolder.replace("~", os.homedir().replace("\\", "/"));
const cacheFolder = utils.cacheFolder();
if (fs.existsSync(cacheFolder) && fs.lstatSync(cacheFolder).isDirectory()) {
utils.consoleLog("Removing uncompressed packages to trim down cache folder...");
core.startGroup("Removing uncompressed packages to trim down cache folder...");
let fullPath;
for (let folder_or_file of fs.readdirSync(cacheFolder)) {
fullPath = path.join(cacheFolder, folder_or_file);
Expand All @@ -531,6 +525,7 @@ function run() {
}
}
}
core.endGroup();
}
}
catch (err) {
Expand Down
Loading

0 comments on commit 8246c3d

Please sign in to comment.