Skip to content

Commit b0eda52

Browse files
MSP-Greglarskanis
andauthored
Allow '+' character in apt, brew, mingw, & mswin inputs, add CI (#22)
* Allow '+' character in apt, brew, mingw, & mswin inputs * [CI] add Ubuntu & macOS 'plus' jobs Co-authored-by: Lars Kanis <[email protected]>
1 parent 48dadf0 commit b0eda52

File tree

8 files changed

+131
-23
lines changed

8 files changed

+131
-23
lines changed

.github/workflows/ruby.yml

+30
Original file line numberDiff line numberDiff line change
@@ -95,3 +95,33 @@ jobs:
9595
- name: gem install openssl
9696
if: (matrix.ruby >= '2.4') && (matrix.ruby <= '3.2')
9797
run: gem install openssl -N
98+
99+
plus:
100+
name: >-
101+
plus ${{ matrix.os }} ${{ matrix.ruby }}
102+
strategy:
103+
fail-fast: false
104+
matrix:
105+
os: [ ubuntu-20.04, macos-11 ]
106+
ruby: [ '3.0' ]
107+
runs-on: ${{ matrix.os }}
108+
steps:
109+
- name: Checkout
110+
uses: actions/checkout@v2
111+
112+
- name: Ruby Install
113+
uses: ./
114+
with:
115+
ruby-version: ${{ matrix.ruby }}
116+
apt-get: g++
117+
brew: libxml++3
118+
119+
- name: Info
120+
run: |
121+
ruby -v
122+
echo ''
123+
gcc --version
124+
echo ''
125+
bundler version
126+
echo ''
127+
gem --version

apt.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22

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

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

77
// group start time
88
let msSt
99

10-
// clean inputs
11-
let apt = core.getInput('apt-get').replace(/[^a-z_ \d.-]+/gi, '').trim().toLowerCase()
12-
1310
export const run = async () => {
1411
try {
12+
// clean input
13+
let apt = getInput('apt-get')
14+
1515
if (apt !== '') {
1616

1717
// fix for server timeout issues

brew.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@ const { execSync, grpSt, grpEnd } = require('./common')
77
// group start time
88
let msSt
99

10-
// clean inputs
11-
let brew = core.getInput('brew').replace(/[^a-z_ \d.@-]+/gi, '').trim().toLowerCase()
12-
1310
export const run = async () => {
1411
try {
12+
// clean input
13+
// use different regex than getInput in common.js. Some packages contain @ character
14+
let brew = core.getInput('brew').replace(/[^a-z_ \d.+@-]+/gi, '').trim().toLowerCase()
15+
1516
if (brew !== '') {
1617
let needUpdate = true
1718

common.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,9 @@ export const log = (logText, color = 'yel') => {
9797
console.log(`${colors[color]}${logText}${rst}`)
9898
}
9999

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

102104
// convert windows path like C:\Users\runneradmin to /c/Users/runneradmin
103105
export const win2nix = (path) => {

dist/index.js

+83-8
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,16 @@ __nccwpck_require__.r(__webpack_exports__);
1313

1414
const core = __nccwpck_require__(186)
1515

16-
const { execSync, grpSt, grpEnd } = __nccwpck_require__(390)
16+
const { execSync, grpSt, grpEnd, getInput } = __nccwpck_require__(390)
1717

1818
// group start time
1919
let msSt
2020

21-
// clean inputs
22-
let apt = core.getInput('apt-get').replace(/[^a-z_ \d.-]+/gi, '').trim().toLowerCase()
23-
2421
const run = async () => {
2522
try {
23+
// clean input
24+
let apt = getInput('apt-get')
25+
2626
if (apt !== '') {
2727

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

97-
// clean inputs
98-
let brew = core.getInput('brew').replace(/[^a-z_ \d.@-]+/gi, '').trim().toLowerCase()
99-
10097
const run = async () => {
10198
try {
99+
// clean input
100+
// use different regex than getInput in common.js. Some packages contain @ character
101+
let brew = core.getInput('brew').replace(/[^a-z_ \d.+@-]+/gi, '').trim().toLowerCase()
102+
102103
if (brew !== '') {
103104
let needUpdate = true
104105

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

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

255258
// convert windows path like C:\Users\runneradmin to /c/Users/runneradmin
256259
const win2nix = (path) => {
@@ -1097,6 +1100,13 @@ Object.defineProperty(exports, "summary", ({ enumerable: true, get: function ()
10971100
*/
10981101
var summary_2 = __nccwpck_require__(327);
10991102
Object.defineProperty(exports, "markdownSummary", ({ enumerable: true, get: function () { return summary_2.markdownSummary; } }));
1103+
/**
1104+
* Path exports
1105+
*/
1106+
var path_utils_1 = __nccwpck_require__(981);
1107+
Object.defineProperty(exports, "toPosixPath", ({ enumerable: true, get: function () { return path_utils_1.toPosixPath; } }));
1108+
Object.defineProperty(exports, "toWin32Path", ({ enumerable: true, get: function () { return path_utils_1.toWin32Path; } }));
1109+
Object.defineProperty(exports, "toPlatformPath", ({ enumerable: true, get: function () { return path_utils_1.toPlatformPath; } }));
11001110
//# sourceMappingURL=core.js.map
11011111

11021112
/***/ }),
@@ -1234,6 +1244,71 @@ exports.OidcClient = OidcClient;
12341244

12351245
/***/ }),
12361246

1247+
/***/ 981:
1248+
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
1249+
1250+
"use strict";
1251+
1252+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
1253+
if (k2 === undefined) k2 = k;
1254+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
1255+
}) : (function(o, m, k, k2) {
1256+
if (k2 === undefined) k2 = k;
1257+
o[k2] = m[k];
1258+
}));
1259+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
1260+
Object.defineProperty(o, "default", { enumerable: true, value: v });
1261+
}) : function(o, v) {
1262+
o["default"] = v;
1263+
});
1264+
var __importStar = (this && this.__importStar) || function (mod) {
1265+
if (mod && mod.__esModule) return mod;
1266+
var result = {};
1267+
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
1268+
__setModuleDefault(result, mod);
1269+
return result;
1270+
};
1271+
Object.defineProperty(exports, "__esModule", ({ value: true }));
1272+
exports.toPlatformPath = exports.toWin32Path = exports.toPosixPath = void 0;
1273+
const path = __importStar(__nccwpck_require__(17));
1274+
/**
1275+
* toPosixPath converts the given path to the posix form. On Windows, \\ will be
1276+
* replaced with /.
1277+
*
1278+
* @param pth. Path to transform.
1279+
* @return string Posix path.
1280+
*/
1281+
function toPosixPath(pth) {
1282+
return pth.replace(/[\\]/g, '/');
1283+
}
1284+
exports.toPosixPath = toPosixPath;
1285+
/**
1286+
* toWin32Path converts the given path to the win32 form. On Linux, / will be
1287+
* replaced with \\.
1288+
*
1289+
* @param pth. Path to transform.
1290+
* @return string Win32 path.
1291+
*/
1292+
function toWin32Path(pth) {
1293+
return pth.replace(/[/]/g, '\\');
1294+
}
1295+
exports.toWin32Path = toWin32Path;
1296+
/**
1297+
* toPlatformPath converts the given path to a platform-specific path. It does
1298+
* this by replacing instances of / and \ with the platform-specific path
1299+
* separator.
1300+
*
1301+
* @param pth The path to platformize.
1302+
* @return string The platform-specific path.
1303+
*/
1304+
function toPlatformPath(pth) {
1305+
return pth.replace(/[/\\]/g, path.sep);
1306+
}
1307+
exports.toPlatformPath = toPlatformPath;
1308+
//# sourceMappingURL=path-utils.js.map
1309+
1310+
/***/ }),
1311+
12371312
/***/ 327:
12381313
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
12391314

dist/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "setup-ruby-pkgs",
3-
"version": "1.32.0",
3+
"version": "1.32.1",
44
"description": "Install packages and update builds tools for Ruby",
55
"main": "index.js",
66
"scripts": {
@@ -23,7 +23,7 @@
2323
"author": "MSP-Greg",
2424
"license": "MIT",
2525
"dependencies": {
26-
"@actions/core": "^1.8.0",
26+
"@actions/core": "^1.9.0",
2727
"@actions/http-client": "^2.0.1"
2828
},
2929
"devDependencies": {

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "setup-ruby-pkgs",
3-
"version": "1.32.0",
3+
"version": "1.32.1",
44
"description": "Install packages and update builds tools for Ruby",
55
"main": "index.js",
66
"scripts": {
@@ -23,7 +23,7 @@
2323
"author": "MSP-Greg",
2424
"license": "MIT",
2525
"dependencies": {
26-
"@actions/core": "^1.8.0",
26+
"@actions/core": "^1.9.0",
2727
"@actions/http-client": "^2.0.1"
2828
},
2929
"devDependencies": {

yarn.lock

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33

44

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

0 commit comments

Comments
 (0)