Skip to content

Commit

Permalink
feat: build for release
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Jul 5, 2021
1 parent b6a5842 commit 7d2acdf
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 53 deletions.
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,16 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
<!-- markdownlint-disable -->
<table>
<tr>
<td align="center"><a href="https://github.com/s-weigand"><img src="https://avatars2.githubusercontent.com/u/9513634?v=4" width="100px;" alt=""/><br /><sub><b>Sebastian Weigand</b></sub></a><br /><a href="https://github.com/s-weigand/setup-conda/commits?author=s-weigand" title="Code">💻</a> <a href="#ideas-s-weigand" title="Ideas, Planning, & Feedback">🤔</a> <a href="#infra-s-weigand" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="#maintenance-s-weigand" title="Maintenance">🚧</a> <a href="https://github.com/s-weigand/setup-conda/commits?author=s-weigand" title="Tests">⚠️</a> <a href="https://github.com/s-weigand/setup-conda/pulls?q=is%3Apr+reviewed-by%3As-weigand" title="Reviewed Pull Requests">👀</a></td>
<td align="center"><a href="https://santi.uy"><img src="https://avatars3.githubusercontent.com/u/3905501?v=4" width="100px;" alt=""/><br /><sub><b>Santiago Castro</b></sub></a><br /><a href="https://github.com/s-weigand/setup-conda/commits?author=bryant1410" title="Documentation">📖</a></td>
<td align="center"><a href="https://github.com/d-chambers"><img src="https://avatars2.githubusercontent.com/u/11671536?v=4" width="100px;" alt=""/><br /><sub><b>Derrick</b></sub></a><br /><a href="https://github.com/s-weigand/setup-conda/commits?author=d-chambers" title="Documentation">📖</a></td>
<td align="center"><a href="https://github.com/basic-ph"><img src="https://avatars2.githubusercontent.com/u/35763852?v=4" width="100px;" alt=""/><br /><sub><b>Pietro Fumiani</b></sub></a><br /><a href="https://github.com/s-weigand/setup-conda/issues?q=author%3Abasic-ph" title="Bug reports">🐛</a></td>
<td align="center"><a href="https://github.com/dcdenu4"><img src="https://avatars3.githubusercontent.com/u/2659980?v=4" width="100px;" alt=""/><br /><sub><b>Doug</b></sub></a><br /><a href="https://github.com/s-weigand/setup-conda/issues?q=author%3Adcdenu4" title="Bug reports">🐛</a></td>
<td align="center"><a href="https://github.com/s-weigand"><img src="https://avatars2.githubusercontent.com/u/9513634?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Sebastian Weigand</b></sub></a><br /><a href="https://github.com/s-weigand/setup-conda/commits?author=s-weigand" title="Code">💻</a> <a href="#ideas-s-weigand" title="Ideas, Planning, & Feedback">🤔</a> <a href="#infra-s-weigand" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="#maintenance-s-weigand" title="Maintenance">🚧</a> <a href="https://github.com/s-weigand/setup-conda/commits?author=s-weigand" title="Tests">⚠️</a> <a href="https://github.com/s-weigand/setup-conda/pulls?q=is%3Apr+reviewed-by%3As-weigand" title="Reviewed Pull Requests">👀</a></td>
<td align="center"><a href="https://santi.uy"><img src="https://avatars3.githubusercontent.com/u/3905501?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Santiago Castro</b></sub></a><br /><a href="https://github.com/s-weigand/setup-conda/commits?author=bryant1410" title="Documentation">📖</a></td>
<td align="center"><a href="https://github.com/d-chambers"><img src="https://avatars2.githubusercontent.com/u/11671536?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Derrick</b></sub></a><br /><a href="https://github.com/s-weigand/setup-conda/commits?author=d-chambers" title="Documentation">📖</a></td>
<td align="center"><a href="https://github.com/basic-ph"><img src="https://avatars2.githubusercontent.com/u/35763852?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Pietro Fumiani</b></sub></a><br /><a href="https://github.com/s-weigand/setup-conda/issues?q=author%3Abasic-ph" title="Bug reports">🐛</a></td>
<td align="center"><a href="https://github.com/dcdenu4"><img src="https://avatars3.githubusercontent.com/u/2659980?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Doug</b></sub></a><br /><a href="https://github.com/s-weigand/setup-conda/issues?q=author%3Adcdenu4" title="Bug reports">🐛</a></td>
<td align="center"><a href="http://ocefpaf.github.io/python4oceanographers"><img src="https://avatars.githubusercontent.com/u/950575?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Filipe</b></sub></a><br /><a href="https://github.com/s-weigand/setup-conda/issues?q=author%3Aocefpaf" title="Bug reports">🐛</a></td>
</tr>
</table>

<!-- markdownlint-enable -->
<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->

<!-- ALL-CONTRIBUTORS-LIST:END -->
Expand Down
2 changes: 1 addition & 1 deletion build.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"owner":"s-weigand","repo":"setup-conda","sha":"33fb1dc02728148e85d1f88a2e02b6e00c521065","ref":"refs/tags/v1.0.6","tagName":"v1.0.6","branch":"release","tags":["v1.0.6","v1"],"updated_at":"2021-06-29T17:10:04.700Z"}
{"owner":"s-weigand","repo":"setup-conda","sha":"705d889b6733b37d5eb3ea2ba8127e1356cb356a","ref":"refs/tags/v1.0.7","tagName":"v1.0.7","branch":"release","tags":["v1.0.7","v1"],"updated_at":"2021-07-05T17:10:47.305Z"}
63 changes: 26 additions & 37 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1948,13 +1948,34 @@ const addCondaToPath = (config) => __awaiter(void 0, void 0, void 0, function* (
core.endGroup();
});
/**
* Activates the conda base env.
* Parse `conda shell.<shell_name> activate <env_name>`scripts outputs
*
* @param activationStr Output of the activation script
* @param envExport Prefix to which is used to export an env variable
* @param osPathSep Character to separate path in the PATH variable
* @returns condaPaths
*/
exports.parseActivationScriptOutput = (activationStr, envExport, osPathSep) => __awaiter(void 0, void 0, void 0, function* () {
let condaPaths = [];
const lines = activationStr.split(envExport);
for (const line of lines) {
if (line.startsWith('PATH')) {
const paths = line.replace(/PATH\s?=|'|"|\n|\s/g, '').split(osPathSep);
condaPaths = paths
.filter((path) => path.toLowerCase().indexOf('miniconda') !== -1)
.filter((orig, index, self) => index === self.findIndex((subSetItem) => subSetItem === orig));
}
}
return condaPaths;
});
/**
* Activates the conda base env by changing the path and env variables.
*
* @param config Configuration of the action
*/
const activate_conda = (config) => __awaiter(void 0, void 0, void 0, function* () {
core.startGroup('Activating conda base');
let envVarsAndCondaPaths;
let condaPaths;
let activationStr = '';
const options = { listeners: {} };
options.listeners = {
Expand All @@ -1965,50 +1986,18 @@ const activate_conda = (config) => __awaiter(void 0, void 0, void 0, function* (
console.log('Conda activate script:');
if (config.os === 'win32') {
yield exec.exec('conda', ['shell.powershell', 'activate', 'base'], options);
envVarsAndCondaPaths = exports.parseActivationScriptOutput(activationStr, '$Env:', ';');
condaPaths = yield exports.parseActivationScriptOutput(activationStr, '$Env:', ';');
}
else {
yield exec.exec('conda', ['shell.bash', 'activate', 'base'], options);
envVarsAndCondaPaths = exports.parseActivationScriptOutput(activationStr, 'export ', ':');
condaPaths = yield exports.parseActivationScriptOutput(activationStr, 'export ', ':');
}
const { condaPaths, envVars } = yield envVarsAndCondaPaths;
console.log('\n\nData used for activation:\n', { condaPaths, envVars });
console.log('\n\nData used for activation:\n', { condaPaths });
for (const condaPath of condaPaths) {
sane_add_path(condaPath);
}
for (const varName in envVars) {
core.exportVariable(varName, envVars[varName]);
}
core.endGroup();
});
/**
* Parse `conda shell.<shell_name> activate <env_name>`scripts outputs
*
* @param activationStr Output of the activation script
* @param envExport Prefix to which is used to export an env variable
* @param osPathSep Character to separate path in the PATH variable
* @returns
*/
exports.parseActivationScriptOutput = (activationStr, envExport, osPathSep) => __awaiter(void 0, void 0, void 0, function* () {
let condaPaths = [];
const envVars = {};
const lines = activationStr.split(envExport);
for (const line of lines) {
if (line.startsWith('PATH')) {
const paths = line.replace(/PATH\s?=|'|"|\n|\s/g, '').split(osPathSep);
condaPaths = paths
.filter((path) => path.toLowerCase().indexOf('miniconda') !== -1)
.filter((orig, index, self) => index === self.findIndex((subSetItem) => subSetItem === orig));
}
else {
const [varName, varValue] = line.replace(/'|"|\n|\s/g, '').split('=');
if (varValue !== undefined) {
envVars[varName.trim()] = varValue.trim();
}
}
}
return { condaPaths, envVars };
});
const get_python_location = () => __awaiter(void 0, void 0, void 0, function* () {
core.startGroup('Getting original pythonLocation');
let pythonLocation = '';
Expand Down
9 changes: 0 additions & 9 deletions integrationtests/test_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,3 @@ def test_conda_channels():
assert returncode == 0
assert channel_list == expected
assert stderr == b""


def test_conda_env_vars_set():
"""Conda env_vars are set"""
assert "miniconda" in os.environ["CONDA_PREFIX"].lower()
assert "miniconda" in os.environ["CONDA_EXE"].lower()
assert "miniconda" in os.environ["CONDA_PYTHON_EXE"].lower()
assert os.environ["CONDA_SHLVL"] == "1"
assert os.environ["CONDA_DEFAULT_ENV"] != ""

0 comments on commit 7d2acdf

Please sign in to comment.