From 18ed7b83b34cf9e10f395298ea7cd026c8e683da Mon Sep 17 00:00:00 2001 From: Andrew Janke Date: Sat, 31 Dec 2022 13:19:55 -0500 Subject: [PATCH] Migrate to GitHub Actions from Travis CI Travis CI no longer has an "all you can eat" FLOSS offer, and all my credits are used up. Let's try GitHub Actions; it worked for the RubyGems folks with their nronn fork. * https://github.com/apjanke/ronn-ng/issues/88 * https://github.com/n-ronn/nronn/pull/8 Co-authored-by: Takuya Noguchi --- .github/workflows/build.yml | 62 +++++++++++++++++++++++++++++++++++++ .github/workflows/jruby.yml | 34 ++++++++++++++++++++ .github/workflows/pages.yml | 52 +++++++++++++++++++++++++++++++ .travis.yml | 23 -------------- man/index.html | 6 ++-- 5 files changed, 151 insertions(+), 26 deletions(-) create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/jruby.yml create mode 100644 .github/workflows/pages.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..d8ec3a3 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,62 @@ +name: Ruby + +on: + push: + branches: [ "main", "dev/gh-actions" ] + pull_request: + branches: [ "main" ] + +permissions: + contents: read + +jobs: + test: + runs-on: ubuntu-20.04 + continue-on-error: ${{ matrix.unsupported }} + strategy: + fail-fast: false + matrix: + ruby-version: ['2.7', '3.0'] + unsupported: [false] + include: + - ruby-version: '2.4' + unsupported: true + - ruby-version: '2.5' + unsupported: true + - ruby-version: '2.6' + unsupported: true + - ruby-version: '3.1' + unsupported: true + - ruby-version: head + unsupported: true + + steps: + - uses: actions/checkout@v3 + - name: Remove Gemfile.lock + run: rm -f Gemfile.lock + - name: Set up Ruby + uses: ruby/setup-ruby@v1.131.0 + with: + ruby-version: ${{ matrix.ruby-version }} + bundler-cache: true # runs 'bundle install' and caches installed gems automatically + continue-on-error: ${{ matrix.unsupported }} # Only for Ruby 2.4 + - name: Run tests + run: bundle exec rake test + continue-on-error: ${{ matrix.unsupported }} + - name: Run man tests + run: bundle exec rake man + continue-on-error: ${{ matrix.unsupported }} # Only for Ruby 2.4 + + rubocop: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v3 + - name: Remove Gemfile.lock + run: rm -f Gemfile.lock + - name: Set up Ruby + uses: ruby/setup-ruby@v1.131.0 + with: + ruby-version: 2.7.6 + bundler-cache: true # runs 'bundle install' and caches installed gems automatically + - name: Run RuboCop + run: bundle exec rubocop diff --git a/.github/workflows/jruby.yml b/.github/workflows/jruby.yml new file mode 100644 index 0000000..bb75a2f --- /dev/null +++ b/.github/workflows/jruby.yml @@ -0,0 +1,34 @@ +# We do not have plan to support +name: JRuby + +on: + push: + branches: [ "main" ] + +permissions: + contents: read + +jobs: + test: + runs-on: ubuntu-20.04 + strategy: + fail-fast: false + matrix: + ruby-version: [jruby-9.2.9.0, jruby-head] + continue-on-error: true + + steps: + - uses: actions/checkout@v3 + - name: Remove Gemfile.lock + run: rm -f Gemfile.lock + - name: Set up Ruby + uses: ruby/setup-ruby@v1.131.0 + with: + ruby-version: ${{ matrix.ruby-version }} + bundler-cache: true # runs 'bundle install' and caches installed gems automatically + - name: Run tests + run: bundle exec rake test + continue-on-error: true + - name: Run man tests + run: bundle exec rake man + continue-on-error: true diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml new file mode 100644 index 0000000..5b6576d --- /dev/null +++ b/.github/workflows/pages.yml @@ -0,0 +1,52 @@ +name: Deploy to GitHub Pages +on: + push: + branches: [main] + +permissions: + contents: read + pages: write + id-token: write + +# Allow one concurrent deployment +concurrency: + group: "pages" + cancel-in-progress: true + +jobs: + # Build job + build: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: '3.1.2' + bundler-cache: true # 'bundle install' and cache + + # cf. https://github.com/actions/starter-workflows/blob/4a8f18e34dd13d2b6ee4d8da2ba72629eafe1609/pages/jekyll.yml + - name: Setup Pages + id: pages + uses: actions/configure-pages@v1 + + - name: Build the pages + run: bundle exec rake man + + - name: Upload artifact + uses: actions/upload-pages-artifact@v1 + with: + path: "man/" # The action will automatically upload an artifact from this directory + + # Deployment job + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-22.04 + needs: build + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v1 diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 7abb913..0000000 --- a/.travis.yml +++ /dev/null @@ -1,23 +0,0 @@ -language: ruby - -matrix: - allow_failures: - - rvm: jruby-9.2.7.0 - -rvm: - - 2.4 - - 2.5 - - 2.6 - - 2.7 - - jruby-9.2.7.0 - -before_install: - - gem install bundler:2.1.4 - -install: - - bundle install --with development - -script: - - bundle exec rubocop - - bundle exec rake test - - bundle exec rake man diff --git a/man/index.html b/man/index.html index 31c16b8..7caedbc 100644 --- a/man/index.html +++ b/man/index.html @@ -1,7 +1,7 @@ - Ronn + nRonn: n.Ronn