From 496feeaf1cf45f9891d5dc9446069da4fd25b532 Mon Sep 17 00:00:00 2001 From: Gonzalo Pena-Castellanos Date: Thu, 26 May 2022 11:46:22 -0500 Subject: [PATCH] Add warning to master branch --- .github/workflows/caching-envs-example.yml | 20 +++-- README.md | 89 ++++++++++++---------- dist/setup/index.js | 60 ++++++++++++++- src/setup.ts | 4 + src/warnings.ts | 15 ++++ 5 files changed, 137 insertions(+), 51 deletions(-) create mode 100644 src/warnings.ts diff --git a/.github/workflows/caching-envs-example.yml b/.github/workflows/caching-envs-example.yml index bb1d842d..f62c7ece 100644 --- a/.github/workflows/caching-envs-example.yml +++ b/.github/workflows/caching-envs-example.yml @@ -27,11 +27,11 @@ jobs: - name: Setup Mambaforge uses: conda-incubator/setup-miniconda@v2 with: - miniforge-variant: Mambaforge - miniforge-version: latest - activate-environment: anaconda-client-env - use-mamba: true - + miniforge-variant: Mambaforge + miniforge-version: latest + activate-environment: anaconda-client-env + use-mamba: true + - name: Get Date id: get-date run: echo "::set-output name=today::$(/bin/date -u '+%Y%m%d')" @@ -41,12 +41,18 @@ jobs: uses: actions/cache@v2 with: path: ${{ env.CONDA }}/envs - key: conda-${{ runner.os }}--${{ runner.arch }}--${{ steps.get-date.outputs.today }}-${{ hashFiles('etc/example-environment-caching.yml') }}-${{ env.CACHE_NUMBER }} + key: + conda-${{ runner.os }}--${{ runner.arch }}--${{ + steps.get-date.outputs.today }}-${{ + hashFiles('etc/example-environment-caching.yml') }}-${{ + env.CACHE_NUMBER }} env: # Increase this value to reset cache if etc/example-environment.yml has not changed CACHE_NUMBER: 0 id: cache - name: Update environment - run: mamba env update -n anaconda-client-env -f etc/example-environment-caching.yml + run: + mamba env update -n anaconda-client-env -f + etc/example-environment-caching.yml if: steps.cache.outputs.cache-hit != 'true' diff --git a/README.md b/README.md index b0639cf0..29894efc 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ possibility of automatically activating the `test` environment on all shells. > Each of the examples below is discussed in a dedicated section below. | Documentation | Workflow Status | -| ----------------------------------------------- | ----------------------------------------------------------------| +| ----------------------------------------------- | --------------------------------------------------------------- | | [Basic usage](#example-1-basic-usage) | [![Basic Usage Status][ex1-badge]][ex1] | | [Other shells](#example-2-other-shells) | [![Other Shells Status][ex2-badge]][ex2] | | [Other options](#example-3-other-options) | [![Other Options Status][ex3-badge]][ex3] | @@ -575,61 +575,66 @@ as they are not included in the conda package cache. ### Caching environments -The first installation step should setup a Miniconda variant without -specifying a environment file. +The first installation step should setup a Miniconda variant without specifying +a environment file. ```yaml - - name: Setup Mambaforge - uses: conda-incubator/setup-miniconda@v2 - with: - miniforge-variant: Mambaforge - miniforge-version: latest - activate-environment: anaconda-client-env - use-mamba: true +- name: Setup Mambaforge + uses: conda-incubator/setup-miniconda@v2 + with: + miniforge-variant: Mambaforge + miniforge-version: latest + activate-environment: anaconda-client-env + use-mamba: true ``` -It's a good idea to refresh the cache every 24 hours to avoid inconsistencies -of package versions between the CI pipeline and local installations. -Here we ensure that this happens by adding the current date to the cache key. -You can remove the "Get Date" step below if you use a resolved environment file product of +It's a good idea to refresh the cache every 24 hours to avoid inconsistencies of +package versions between the CI pipeline and local installations. Here we ensure +that this happens by adding the current date to the cache key. You can remove +the "Get Date" step below if you use a resolved environment file product of `conda env export` or `conda list --explicit`. ```yaml - - name: Get Date - id: get-date - run: echo "::set-output name=today::$(/bin/date -u '+%Y%m%d')" - shell: bash +- name: Get Date + id: get-date + run: echo "::set-output name=today::$(/bin/date -u '+%Y%m%d')" + shell: bash - - name: Cache Conda env - uses: actions/cache@v2 - with: - path: ${{ env.CONDA }}/envs - key: conda-${{ runner.os }}--${{ runner.arch }}--${{ steps.get-date.outputs.today }}-${{ hashFiles('etc/example-environment-caching.yml') }}-${{ env.CACHE_NUMBER }} - env: - # Increase this value to reset cache if etc/example-environment.yml has not changed - CACHE_NUMBER: 0 - id: cache +- name: Cache Conda env + uses: actions/cache@v2 + with: + path: ${{ env.CONDA }}/envs + key: + conda-${{ runner.os }}--${{ runner.arch }}--${{ + steps.get-date.outputs.today }}-${{ + hashFiles('etc/example-environment-caching.yml') }}-${{ env.CACHE_NUMBER + }} + env: + # Increase this value to reset cache if etc/example-environment.yml has not changed + CACHE_NUMBER: 0 + id: cache ``` -Keep in mind that hashing `etc/example-environment-caching.yml` is not the -same as hashing a resolved environment file. `conda` (and `mamba`) resolves -the dependencies declared in the YAML file according to the packages -available on the channels at installation time. Since packages are updated -all the time, you will not see these changes reflected in the cache until -the key gets updated by date. +Keep in mind that hashing `etc/example-environment-caching.yml` is not the same +as hashing a resolved environment file. `conda` (and `mamba`) resolves the +dependencies declared in the YAML file according to the packages available on +the channels at installation time. Since packages are updated all the time, you +will not see these changes reflected in the cache until the key gets updated by +date. -**This means that the same environment file can make your tests pass locally -but fail on CI, or the other way around. In that case, reset the cache -manually to see if that leads to consistent results, or use a resolved -environment file.** +**This means that the same environment file can make your tests pass locally but +fail on CI, or the other way around. In that case, reset the cache manually to +see if that leads to consistent results, or use a resolved environment file.** -Finally, update the environment based on the environment file if the cache -does not exist. +Finally, update the environment based on the environment file if the cache does +not exist. ```yaml - - name: Update environment - run: mamba env update -n anaconda-client-env -f etc/example-environment-caching.yml - if: steps.cache.outputs.cache-hit != 'true' +- name: Update environment + run: + mamba env update -n anaconda-client-env -f + etc/example-environment-caching.yml + if: steps.cache.outputs.cache-hit != 'true' ``` ### Use a default shell diff --git a/dist/setup/index.js b/dist/setup/index.js index efc29f33..b023700c 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -6483,7 +6483,59 @@ exports.updatePython = { /***/ }), /* 114 */, -/* 115 */, +/* 115 */ +/***/ (function(__unusedmodule, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.warnBranchChange = void 0; +const core = __importStar(__webpack_require__(470)); +/** + * Warn about deprecation of master branch + */ +function warnBranchChange() { + return __awaiter(this, void 0, void 0, function* () { + core.warning(` +The master branch is deprecated and will be removed in a future release. + +Please change your action to use the latest version, or point to the main branch. +conda-incubator/setup-minicando@main +`); + }); +} +exports.warnBranchChange = warnBranchChange; + + +/***/ }), /* 116 */, /* 117 */, /* 118 */ @@ -20548,6 +20600,7 @@ const input = __importStar(__webpack_require__(265)); const outputs = __importStar(__webpack_require__(405)); const installer = __importStar(__webpack_require__(555)); const conda = __importStar(__webpack_require__(259)); +const warnings = __importStar(__webpack_require__(115)); const env = __importStar(__webpack_require__(956)); const baseTools = __importStar(__webpack_require__(49)); /** @@ -20561,6 +20614,9 @@ function setupMiniconda(inputs) { mambaInInstaller: false, condaConfig: Object.assign({}, inputs.condaConfig), }; + // Warn about the deprecation of the master branch + yield core.group(`Deprecation warning!`, warnings.warnBranchChange); + core.warning("myInput was not set"); yield core.group(`Creating bootstrap condarc file in ${constants.CONDARC_PATH}...`, conda.bootstrapConfig); const installerInfo = yield core.group("Ensuring installer...", () => installer.getLocalInstallerPath(inputs, options)); // The desired installer may change the options @@ -30000,7 +30056,7 @@ module.exports.safeLoad = safeLoad; /* 771 */ /***/ (function(module) { -module.exports = {"_args":[["cheerio@1.0.0-rc.3","/home/weg/projects/actions/setup-miniconda"]],"_from":"cheerio@1.0.0-rc.3","_id":"cheerio@1.0.0-rc.3","_inBundle":false,"_integrity":"sha512-0td5ijfUPuubwLUu0OBoe98gZj8C/AA+RW3v67GPlGOrvxWjZmBXiBCRU+I8VEiNyJzjth40POfHiz2RB3gImA==","_location":"/cheerio","_phantomChildren":{},"_requested":{"type":"version","registry":true,"raw":"cheerio@1.0.0-rc.3","name":"cheerio","escapedName":"cheerio","rawSpec":"1.0.0-rc.3","saveSpec":null,"fetchSpec":"1.0.0-rc.3"},"_requiredBy":["/get-hrefs"],"_resolved":"https://registry.npmjs.org/cheerio/-/cheerio-1.0.0-rc.3.tgz","_spec":"1.0.0-rc.3","_where":"/home/weg/projects/actions/setup-miniconda","author":{"name":"Matt Mueller","email":"mattmuelle@gmail.com","url":"mat.io"},"bugs":{"url":"https://github.com/cheeriojs/cheerio/issues"},"dependencies":{"css-select":"~1.2.0","dom-serializer":"~0.1.1","entities":"~1.1.1","htmlparser2":"^3.9.1","lodash":"^4.15.0","parse5":"^3.0.1"},"description":"Tiny, fast, and elegant implementation of core jQuery designed specifically for the server","devDependencies":{"benchmark":"^2.1.0","coveralls":"^2.11.9","expect.js":"~0.3.1","istanbul":"^0.4.3","jquery":"^3.0.0","jsdom":"^9.2.1","jshint":"^2.9.2","mocha":"^3.1.2","xyz":"~1.1.0"},"engines":{"node":">= 0.6"},"files":["index.js","lib"],"homepage":"https://github.com/cheeriojs/cheerio#readme","keywords":["htmlparser","jquery","selector","scraper","parser","html"],"license":"MIT","main":"./index.js","name":"cheerio","repository":{"type":"git","url":"git://github.com/cheeriojs/cheerio.git"},"scripts":{"test":"make test"},"version":"1.0.0-rc.3"}; +module.exports = {"_args":[["cheerio@1.0.0-rc.3","/Users/gpenacastellanos/Dropbox (Personal)/develop/conda-incubator/setup-miniconda"]],"_from":"cheerio@1.0.0-rc.3","_id":"cheerio@1.0.0-rc.3","_inBundle":false,"_integrity":"sha512-0td5ijfUPuubwLUu0OBoe98gZj8C/AA+RW3v67GPlGOrvxWjZmBXiBCRU+I8VEiNyJzjth40POfHiz2RB3gImA==","_location":"/cheerio","_phantomChildren":{},"_requested":{"type":"version","registry":true,"raw":"cheerio@1.0.0-rc.3","name":"cheerio","escapedName":"cheerio","rawSpec":"1.0.0-rc.3","saveSpec":null,"fetchSpec":"1.0.0-rc.3"},"_requiredBy":["/get-hrefs"],"_resolved":"https://registry.npmjs.org/cheerio/-/cheerio-1.0.0-rc.3.tgz","_spec":"1.0.0-rc.3","_where":"/Users/gpenacastellanos/Dropbox (Personal)/develop/conda-incubator/setup-miniconda","author":{"name":"Matt Mueller","email":"mattmuelle@gmail.com","url":"mat.io"},"bugs":{"url":"https://github.com/cheeriojs/cheerio/issues"},"dependencies":{"css-select":"~1.2.0","dom-serializer":"~0.1.1","entities":"~1.1.1","htmlparser2":"^3.9.1","lodash":"^4.15.0","parse5":"^3.0.1"},"description":"Tiny, fast, and elegant implementation of core jQuery designed specifically for the server","devDependencies":{"benchmark":"^2.1.0","coveralls":"^2.11.9","expect.js":"~0.3.1","istanbul":"^0.4.3","jquery":"^3.0.0","jsdom":"^9.2.1","jshint":"^2.9.2","mocha":"^3.1.2","xyz":"~1.1.0"},"engines":{"node":">= 0.6"},"files":["index.js","lib"],"homepage":"https://github.com/cheeriojs/cheerio#readme","keywords":["htmlparser","jquery","selector","scraper","parser","html"],"license":"MIT","main":"./index.js","name":"cheerio","repository":{"type":"git","url":"git://github.com/cheeriojs/cheerio.git"},"scripts":{"test":"make test"},"version":"1.0.0-rc.3"}; /***/ }), /* 772 */ diff --git a/src/setup.ts b/src/setup.ts index 60412d08..aa42955f 100644 --- a/src/setup.ts +++ b/src/setup.ts @@ -8,6 +8,7 @@ import * as input from "./input"; import * as outputs from "./outputs"; import * as installer from "./installer"; import * as conda from "./conda"; +import * as warnings from "./warnings"; import * as env from "./env"; import * as baseTools from "./base-tools"; @@ -21,7 +22,10 @@ async function setupMiniconda(inputs: types.IActionInputs): Promise { mambaInInstaller: false, condaConfig: { ...inputs.condaConfig }, }; + // Warn about the deprecation of the master branch + await core.group(`Deprecation warning!`, warnings.warnBranchChange); + core.warning("myInput was not set"); await core.group( `Creating bootstrap condarc file in ${constants.CONDARC_PATH}...`, conda.bootstrapConfig diff --git a/src/warnings.ts b/src/warnings.ts new file mode 100644 index 00000000..6572404a --- /dev/null +++ b/src/warnings.ts @@ -0,0 +1,15 @@ +import * as core from "@actions/core"; + +/** + * Warn about deprecation of master branch + */ +export async function warnBranchChange(): Promise { + core.warning( + ` +The master branch is deprecated and will be removed in a future release. + +Please change your action to use the latest version, or point to the main branch. +conda-incubator/setup-minicando@main +` + ); +}