Compare commits

..
7 Commits
8 changed files with 52 additions and 6 deletions
+17 -4
View File
@@ -7,7 +7,7 @@ jobs:
matrix:
os: [ ubuntu-16.04, ubuntu-18.04, macos-latest, windows-latest ]
# Use various version syntaxes here for testing
ruby: [ 2.3, ruby-2.4, 2.5, ruby-2.6.5, 2.7.0, jruby, truffleruby ]
ruby: [ .ruby-version, 2.3, ruby-2.4, 2.5, ruby-2.6.5, 2.7.0, jruby, truffleruby ]
exclude:
- os: windows-latest
ruby: 2.3
@@ -21,8 +21,21 @@ jobs:
- uses: ./
with:
ruby-version: ${{ matrix.ruby }}
- run: ruby -v
- run: ruby --version
- run: ridk version
if: matrix.os == 'windows-latest'
- run: ruby -ropen-uri -e 'puts open(%{https://rubygems.org/}) { |f| f.read(2014) }'
- run: gem install json --no-document
- name: OpenSSL test
run: ruby -ropen-uri -e 'puts open(%{https://rubygems.org/}) { |f| f.read(2014) }'
- name: C extension test
run: gem install json --no-document
- name: Check that Bundler is installed
run: bundle --version
- name: Check that Bundler works
run: bundle install
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: yarn install
- run: yarn run lint
+1
View File
@@ -0,0 +1 @@
ruby-2.6.5
+5
View File
@@ -0,0 +1,5 @@
# Used for testing
source 'https://rubygems.org'
gem "path"
gem "json"
+7
View File
@@ -82,6 +82,13 @@ jobs:
* short version like `2.6`, automatically using the latest release matching that version (`2.6.5`)
* version only like `2.6.5`, assumes MRI for the engine
* engine only like `truffleruby`, uses the latest stable release of that implementation
* `.ruby-version` (also the default value) reads from the project's `.ruby-version` file
### Bundler
Currently, Bundler is guaranteed to be installed for all versions.
If the Ruby ships with Bundler (Ruby >= 2.6), that version is used.
Otherwise (Ruby < 2.6), the latest version of Bundler is installed when that Ruby was built.
## Limitations
+2 -2
View File
@@ -6,8 +6,8 @@ branding:
icon: download
inputs:
ruby-version:
description: 'Engine and version to use, see the syntax in the README'
required: true
description: 'Engine and version to use, see the syntax in the README. Reads from .ruby-version if unset.'
default: '.ruby-version'
outputs:
ruby-prefix:
description: 'The prefix of the installed ruby'
Generated Vendored
+10
View File
@@ -1428,6 +1428,11 @@ async function getLatestReleaseTag() {
}
async function getRubyEngineAndVersion(rubyVersion) {
if (rubyVersion === '.ruby-version') { // Read from .ruby-version
rubyVersion = fs.readFileSync('.ruby-version', 'utf8').trim()
console.log(`Using ${rubyVersion} as input from file .ruby-version`)
}
let engine, version
if (rubyVersion.match(/^\d+/)) { // X.Y.Z => ruby-X.Y.Z
engine = 'ruby'
@@ -6463,6 +6468,7 @@ __webpack_require__.r(__webpack_exports__);
// Most of this logic is from
// https://github.com/MSP-Greg/actions-ruby/blob/master/lib/main.js
const fs = __webpack_require__(747)
const core = __webpack_require__(470)
const exec = __webpack_require__(986)
const tc = __webpack_require__(533)
@@ -6488,6 +6494,10 @@ async function downloadExtractAndSetPATH(ruby) {
const newPath = setupPath(msys2, rubyPrefix)
core.exportVariable('PATH', newPath)
if (!fs.existsSync(`${rubyPrefix}\\bin\\bundle.cmd`)) {
await exec.exec(`${rubyPrefix}\\bin\\gem install bundler --no-document`)
}
return rubyPrefix
}
+5
View File
@@ -47,6 +47,11 @@ async function getLatestReleaseTag() {
}
async function getRubyEngineAndVersion(rubyVersion) {
if (rubyVersion === '.ruby-version') { // Read from .ruby-version
rubyVersion = fs.readFileSync('.ruby-version', 'utf8').trim()
console.log(`Using ${rubyVersion} as input from file .ruby-version`)
}
let engine, version
if (rubyVersion.match(/^\d+/)) { // X.Y.Z => ruby-X.Y.Z
engine = 'ruby'
+5
View File
@@ -1,6 +1,7 @@
// Most of this logic is from
// https://github.com/MSP-Greg/actions-ruby/blob/master/lib/main.js
const fs = require('fs')
const core = require('@actions/core')
const exec = require('@actions/exec')
const tc = require('@actions/tool-cache')
@@ -26,6 +27,10 @@ export async function downloadExtractAndSetPATH(ruby) {
const newPath = setupPath(msys2, rubyPrefix)
core.exportVariable('PATH', newPath)
if (!fs.existsSync(`${rubyPrefix}\\bin\\bundle.cmd`)) {
await exec.exec(`${rubyPrefix}\\bin\\gem install bundler --no-document`)
}
return rubyPrefix
}