Skip to content

πŸ’Ž

πŸ’Ž #594

Workflow file for this run

name: πŸ’Ž
on:
push:
tags:
- 'v*.*.*'
branches:
- main
paths:
- '.github/workflows/ci-ruby.yml'
- '.ruby-version'
- '**.gemspec'
- '**Gemfile'
- 'Rakefile'
- '**.rb'
pull_request:
paths:
- '.github/workflows/ci-ruby.yml'
- '.ruby-version'
- '**.gemspec'
- '**Gemfile'
- 'Rakefile'
- '**.rb'
schedule:
# Every 10:42 JST
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#schedule
- cron: '42 1 * * *'
workflow_dispatch:
jobs:
test:
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04]
# Due to https://github.com/actions/runner/issues/849, we have to use quotes for '3.0'
ruby: ['head', '3.3', '3.2']
gemfile: ['Gemfile', 'gemfiles/oldest/Gemfile']
runs-on: ${{ matrix.os }}
env: # $BUNDLE_GEMFILE must be set at the job level, so it is set for all steps
BUNDLE_GEMFILE: '${{ github.workspace }}/${{ matrix.gemfile }}'
# https://github.com/kachick/irb-power_assert/blob/104834846baf5caa1e8536a11c43acdd56fc849c/CONTRIBUTING.md#adding-dependencies-for-this-gem
BUNDLE_WITHOUT: development
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
# Enabling is the recommended way, but it cannot detect runner changes in early stage.
# So disable it is better for test job, do not mind in other jobs
bundler-cache: false # runs 'bundle install' and caches installed gems automatically
- run: bundle install
- run: bundle exec rake test
rubocop:
runs-on: 'ubuntu-24.04'
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- run: bundle exec rake rubocop
build_and_release:
runs-on: 'ubuntu-24.04'
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- run: mkdir -p pkg
- run: bundle exec gem build --strict --norc --output=pkg/irb-power_assert.gem irb-power_assert.gemspec
- name: Make sure we can use the gem
run: |
gem install pkg/irb-power_assert.gem
echo 'pa (2 * 3 * 7).abs == 1010102.to_s.to_i(2)' | irb -r irb-power_assert --script -
- name: Upload artifact
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: '${{ github.sha }}-irb-power_assert.gem'
path: pkg/irb-power_assert.gem
- uses: kachick/wait-other-jobs@v3
if: startsWith(github.ref, 'refs/tags/')
with:
skip-list: |
[
{
"workflowFile": "merge-bot-pr.yml"
}
]
# Only tagged and push to GitHub, you should publish to rubygems.org with OTP
- name: Release
uses: softprops/action-gh-release@e7a8f85e1c67a31e6ed99a94b41bd0b71bbee6b8 # v2.0.9
if: startsWith(github.ref, 'refs/tags/')
with:
files: pkg/irb-power_assert.gem
- name: Inspect the gem
run: |
cd pkg
sha256sum ./irb-power_assert.gem
gem unpack ./irb-power_assert.gem
tree -I *.gem