From 7569685d9375a0a6cf10d927df061fc33d77a6b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20F=C3=A9lizard?= Date: Fri, 8 Sep 2023 23:54:32 +0000 Subject: [PATCH] Set up GitHub Actions for CI --- .github/workflows/ci.yml | 29 +++++++++++++++++++++++ .kitchen.yml | 2 +- .travis.yml | 31 ------------------------ README.md | 3 ++- bootstrap_ruby_2.7.sh | 51 ---------------------------------------- bootstrap_ruby_3.0.sh | 4 ++-- 6 files changed, 34 insertions(+), 86 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .travis.yml delete mode 100755 bootstrap_ruby_2.7.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..4bc6ebf --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,29 @@ +name: CI + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + kitchen: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + script: [ "3.0", "3.1", "3.2", "stable" ] + platform: [ "debian", "ubuntu" ] + steps: + - uses: actions/checkout@v3 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: ruby # latest stable release + - name: Install test dependencies + run: gem install --no-doc test-kitchen kitchen-docker bashcov + - name: Run Test Kitchen + run: env KITCHEN_PLATFORM=${{ matrix.platform }} KITCHEN_SCRIPT=${{ matrix.script }} kitchen test diff --git a/.kitchen.yml b/.kitchen.yml index bd55578..0ad043f 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -4,7 +4,7 @@ driver: provisioner: name: shell - script: ./bootstrap_ruby_<%= ENV["KITCHEN_SCRIPT"] %>.sh + script: bashcov ./bootstrap_ruby_<%= ENV["KITCHEN_SCRIPT"] %>.sh platforms: - name: <%= ENV["KITCHEN_PLATFORM"] %> diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 3304585..0000000 --- a/.travis.yml +++ /dev/null @@ -1,31 +0,0 @@ -language: ruby -sudo: required -dist: trusty -group: edge # https://github.com/travis-ci/travis-ci/issues/5448 -services: - - docker -before_install: - - gem update --system --no-doc # https://github.com/sickill/rainbow/issues/49 -install: - - gem install --no-doc test-kitchen kitchen-docker -script: - - kitchen test -matrix: - include: - - env: KITCHEN_PLATFORM=debian KITCHEN_SCRIPT=2.3 - - env: KITCHEN_PLATFORM=debian KITCHEN_SCRIPT=2.4 - - env: KITCHEN_PLATFORM=debian KITCHEN_SCRIPT=2.5 - - env: KITCHEN_PLATFORM=debian KITCHEN_SCRIPT=2.6 - - env: KITCHEN_PLATFORM=debian KITCHEN_SCRIPT=2.7 - - env: KITCHEN_PLATFORM=debian KITCHEN_SCRIPT=3.0 - - env: KITCHEN_PLATFORM=debian KITCHEN_SCRIPT=stable - - env: KITCHEN_PLATFORM=centos KITCHEN_SCRIPT=2.3 - - env: KITCHEN_PLATFORM=centos KITCHEN_SCRIPT=2.4 - - env: KITCHEN_PLATFORM=centos KITCHEN_SCRIPT=2.5 - - env: KITCHEN_PLATFORM=centos KITCHEN_SCRIPT=2.6 - - env: KITCHEN_PLATFORM=centos KITCHEN_SCRIPT=2.7 - - env: KITCHEN_PLATFORM=centos KITCHEN_SCRIPT=3.0 - - env: KITCHEN_PLATFORM=centos KITCHEN_SCRIPT=stable - allow_failures: - - env: KITCHEN_PLATFORM=debian KITCHEN_SCRIPT=2.3 - - env: KITCHEN_PLATFORM=centos KITCHEN_SCRIPT=2.3 diff --git a/README.md b/README.md index 12d155b..b0b532b 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # ruby-bootstrap -[![Build Status](https://travis-ci.org/infertux/ruby-bootstrap.svg?branch=master)](https://travis-ci.org/infertux/ruby-bootstrap) +[![Funding](https://img.shields.io/liberapay/patrons/infertux.svg?logo=liberapay)](https://liberapay.com/infertux/donate) +[![Build Status](https://github.com/infertux/ruby-bootstrap/actions/workflows/ci.yml/badge.svg)](https://github.com/infertux/ruby-bootstrap/actions) These are very simple self-contained Bash scripts to download, configure and install Ruby from source along with Bundler on Debian-family or Redhat-family systems. diff --git a/bootstrap_ruby_2.7.sh b/bootstrap_ruby_2.7.sh deleted file mode 100755 index 655ea27..0000000 --- a/bootstrap_ruby_2.7.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash -e - -# Download, configure and install Ruby and Bundler -# https://github.com/infertux/ruby-bootstrap - -VERSION="2.7.8" -SHA256="c2dab63cbc8f2a05526108ad419efa63a67ed4074dbbcf9fc2b1ca664cb45ba0" - -[ "$1" = "--force" ] && FORCE=1 || FORCE="" - -set -u - -[ $UID -eq 0 ] || { echo "Root required"; exit 1; } - -# Install Ruby and Bundler if they are missing or the force flag is set -if [ -n "$FORCE" ] || ! command -v ruby >/dev/null; then - # wget: to fetch Ruby and pretty useful anyway - # gcc & make: to compile Ruby - # various libs: libraries for Ruby - - if [ -f /etc/debian_version ]; then - apt-get update - apt-get install -y wget gcc make zlib1g-dev libssl-dev libreadline-dev libffi-dev - elif [ -f /etc/redhat-release ]; then - yum install -y wget gcc make zlib-devel openssl-devel readline-devel - fi - - cd /tmp - wget https://cache.ruby-lang.org/pub/ruby/${VERSION%.*}/ruby-${VERSION}.tar.gz - echo "${SHA256} ruby-${VERSION}.tar.gz" | sha256sum -c - - tar --no-same-owner -xf ruby-${VERSION}.tar.gz - - pushd ruby-${VERSION} - ./configure --disable-install-doc - cpus=$(grep -c processor /proc/cpuinfo) - make -j "$cpus" - make install - popd - - rm -rf ruby-${VERSION}.tar.gz ruby-${VERSION} - - ln -sfv /usr/local/bin/ruby /bin/ruby - ln -sfv /usr/local/bin/gem /bin/gem - ln -sfv /usr/local/bin/bundle /bin/bundle - - ruby -v - gem -v - bundle -v -fi - -echo "All good to go, happy Rubying!" diff --git a/bootstrap_ruby_3.0.sh b/bootstrap_ruby_3.0.sh index eaa1375..16bd010 100755 --- a/bootstrap_ruby_3.0.sh +++ b/bootstrap_ruby_3.0.sh @@ -20,9 +20,9 @@ if [ -n "$FORCE" ] || ! command -v ruby >/dev/null; then if [ -f /etc/debian_version ]; then apt-get update - apt-get install -y wget gcc make zlib1g-dev libssl-dev libreadline-dev libffi-dev + apt-get install -y wget gcc g++ make zlib1g-dev libssl-dev libreadline-dev libffi-dev elif [ -f /etc/redhat-release ]; then - yum install -y wget gcc make zlib-devel openssl-devel readline-devel + yum install -y wget gcc g++ make zlib-devel openssl-devel readline-devel fi cd /tmp