Skip to content

Commit

Permalink
Allow '+' character in apt, brew, mingw, & mswin inputs, add CI (#22)
Browse files Browse the repository at this point in the history
* Allow '+' character in apt, brew, mingw, & mswin inputs

* [CI] add Ubuntu & macOS 'plus' jobs

Co-authored-by: Lars Kanis <[email protected]>
  • Loading branch information
MSP-Greg and larskanis authored Aug 1, 2022
1 parent 48dadf0 commit b0eda52
Show file tree
Hide file tree
Showing 8 changed files with 131 additions and 23 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,33 @@ jobs:
- name: gem install openssl
if: (matrix.ruby >= '2.4') && (matrix.ruby <= '3.2')
run: gem install openssl -N

plus:
name: >-
plus ${{ matrix.os }} ${{ matrix.ruby }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-20.04, macos-11 ]
ruby: [ '3.0' ]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Ruby Install
uses: ./
with:
ruby-version: ${{ matrix.ruby }}
apt-get: g++
brew: libxml++3

- name: Info
run: |
ruby -v
echo ''
gcc --version
echo ''
bundler version
echo ''
gem --version
8 changes: 4 additions & 4 deletions apt.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

const core = require('@actions/core')

const { execSync, grpSt, grpEnd } = require('./common')
const { execSync, grpSt, grpEnd, getInput } = require('./common')

// group start time
let msSt

// clean inputs
let apt = core.getInput('apt-get').replace(/[^a-z_ \d.-]+/gi, '').trim().toLowerCase()

export const run = async () => {
try {
// clean input
let apt = getInput('apt-get')

if (apt !== '') {

// fix for server timeout issues
Expand Down
7 changes: 4 additions & 3 deletions brew.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ const { execSync, grpSt, grpEnd } = require('./common')
// group start time
let msSt

// clean inputs
let brew = core.getInput('brew').replace(/[^a-z_ \d.@-]+/gi, '').trim().toLowerCase()

export const run = async () => {
try {
// clean input
// use different regex than getInput in common.js. Some packages contain @ character
let brew = core.getInput('brew').replace(/[^a-z_ \d.+@-]+/gi, '').trim().toLowerCase()

if (brew !== '') {
let needUpdate = true

Expand Down
4 changes: 3 additions & 1 deletion common.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ export const log = (logText, color = 'yel') => {
console.log(`${colors[color]}${logText}${rst}`)
}

export const getInput = (name) => core.getInput(name).replace(/[^a-z_ \d.-]+/gi, '').trim().toLowerCase()
// Used by apt, mingw, & mswin for input 'cleaning'. Brew also uses
// @ character in package names, so regex is in brew.js.
export const getInput = (name) => core.getInput(name).replace(/[^a-z_ \d.+-]+/gi, '').trim().toLowerCase()

// convert windows path like C:\Users\runneradmin to /c/Users/runneradmin
export const win2nix = (path) => {
Expand Down
91 changes: 83 additions & 8 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ __nccwpck_require__.r(__webpack_exports__);

const core = __nccwpck_require__(186)

const { execSync, grpSt, grpEnd } = __nccwpck_require__(390)
const { execSync, grpSt, grpEnd, getInput } = __nccwpck_require__(390)

// group start time
let msSt

// clean inputs
let apt = core.getInput('apt-get').replace(/[^a-z_ \d.-]+/gi, '').trim().toLowerCase()

const run = async () => {
try {
// clean input
let apt = getInput('apt-get')

if (apt !== '') {

// fix for server timeout issues
Expand Down Expand Up @@ -94,11 +94,12 @@ const { execSync, grpSt, grpEnd } = __nccwpck_require__(390)
// group start time
let msSt

// clean inputs
let brew = core.getInput('brew').replace(/[^a-z_ \d.@-]+/gi, '').trim().toLowerCase()

const run = async () => {
try {
// clean input
// use different regex than getInput in common.js. Some packages contain @ character
let brew = core.getInput('brew').replace(/[^a-z_ \d.+@-]+/gi, '').trim().toLowerCase()

if (brew !== '') {
let needUpdate = true

Expand Down Expand Up @@ -250,7 +251,9 @@ const log = (logText, color = 'yel') => {
console.log(`${colors[color]}${logText}${rst}`)
}

const getInput = (name) => core.getInput(name).replace(/[^a-z_ \d.-]+/gi, '').trim().toLowerCase()
// Used by apt, mingw, & mswin for input 'cleaning'. Brew also uses
// @ character in package names, so regex is in brew.js.
const getInput = (name) => core.getInput(name).replace(/[^a-z_ \d.+-]+/gi, '').trim().toLowerCase()

// convert windows path like C:\Users\runneradmin to /c/Users/runneradmin
const win2nix = (path) => {
Expand Down Expand Up @@ -1097,6 +1100,13 @@ Object.defineProperty(exports, "summary", ({ enumerable: true, get: function ()
*/
var summary_2 = __nccwpck_require__(327);
Object.defineProperty(exports, "markdownSummary", ({ enumerable: true, get: function () { return summary_2.markdownSummary; } }));
/**
* Path exports
*/
var path_utils_1 = __nccwpck_require__(981);
Object.defineProperty(exports, "toPosixPath", ({ enumerable: true, get: function () { return path_utils_1.toPosixPath; } }));
Object.defineProperty(exports, "toWin32Path", ({ enumerable: true, get: function () { return path_utils_1.toWin32Path; } }));
Object.defineProperty(exports, "toPlatformPath", ({ enumerable: true, get: function () { return path_utils_1.toPlatformPath; } }));
//# sourceMappingURL=core.js.map

/***/ }),
Expand Down Expand Up @@ -1234,6 +1244,71 @@ exports.OidcClient = OidcClient;

/***/ }),

/***/ 981:
/***/ (function(__unused_webpack_module, exports, __nccwpck_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;
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.toPlatformPath = exports.toWin32Path = exports.toPosixPath = void 0;
const path = __importStar(__nccwpck_require__(17));
/**
* toPosixPath converts the given path to the posix form. On Windows, \\ will be
* replaced with /.
*
* @param pth. Path to transform.
* @return string Posix path.
*/
function toPosixPath(pth) {
return pth.replace(/[\\]/g, '/');
}
exports.toPosixPath = toPosixPath;
/**
* toWin32Path converts the given path to the win32 form. On Linux, / will be
* replaced with \\.
*
* @param pth. Path to transform.
* @return string Win32 path.
*/
function toWin32Path(pth) {
return pth.replace(/[/]/g, '\\');
}
exports.toWin32Path = toWin32Path;
/**
* toPlatformPath converts the given path to a platform-specific path. It does
* this by replacing instances of / and \ with the platform-specific path
* separator.
*
* @param pth The path to platformize.
* @return string The platform-specific path.
*/
function toPlatformPath(pth) {
return pth.replace(/[/\\]/g, path.sep);
}
exports.toPlatformPath = toPlatformPath;
//# sourceMappingURL=path-utils.js.map

/***/ }),

/***/ 327:
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {

Expand Down
4 changes: 2 additions & 2 deletions dist/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "setup-ruby-pkgs",
"version": "1.32.0",
"version": "1.32.1",
"description": "Install packages and update builds tools for Ruby",
"main": "index.js",
"scripts": {
Expand All @@ -23,7 +23,7 @@
"author": "MSP-Greg",
"license": "MIT",
"dependencies": {
"@actions/core": "^1.8.0",
"@actions/core": "^1.9.0",
"@actions/http-client": "^2.0.1"
},
"devDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "setup-ruby-pkgs",
"version": "1.32.0",
"version": "1.32.1",
"description": "Install packages and update builds tools for Ruby",
"main": "index.js",
"scripts": {
Expand All @@ -23,7 +23,7 @@
"author": "MSP-Greg",
"license": "MIT",
"dependencies": {
"@actions/core": "^1.8.0",
"@actions/core": "^1.9.0",
"@actions/http-client": "^2.0.1"
},
"devDependencies": {
Expand Down
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@


"@actions/core@^1.8.0":
version "1.8.2"
resolved "https://registry.yarnpkg.com/@actions/core/-/core-1.8.2.tgz#67539d669ae9b751430469e9ae4d83e0525973ac"
integrity sha512-FXcBL7nyik8K5ODeCKlxi+vts7torOkoDAKfeh61EAkAy1HAvwn9uVzZBY0f15YcQTcZZ2/iSGBFHEuioZWfDA==
version "1.9.0"
resolved "https://registry.yarnpkg.com/@actions/core/-/core-1.9.0.tgz#20c1baac5d4bd2508ba1fc3e5f3fc4b8a80d4082"
integrity sha512-5pbM693Ih59ZdUhgk+fts+bUWTnIdHV3kwOSr+QIoFHMLg7Gzhwm0cifDY/AG68ekEJAkHnQVpcy4f6GjmzBCA==
dependencies:
"@actions/http-client" "^2.0.1"

Expand Down

0 comments on commit b0eda52

Please sign in to comment.