Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 79 additions & 0 deletions .github/actions/make-snapshot/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: 'make-snapshot'
description: 'Make snapshot tarballs'
inputs:
archname:
description: 'archname passed to tool/make-snapshot (e.g. snapshot-master)'
required: true
version:
description: 'Target Version'
required: false
shallow-since:
description: 'git fetch --shallow-since'
required: true
default: '2018-12-25 00:00:00'
fetch-branch:
description: 'fetch branch'
required: false
generate-tar-bz2:
description: 'Generate .tar.bz2'
required: false
srcdir:
description: 'srcdir for tool/make-snapshot. Empty = clone ruby/ruby into ./ruby.'
required: false
default: ''

runs:
using: "composite"
steps:
- name: Install libraries
run: |
set -x
sudo apt-get update -q || :
sudo apt-get install --no-install-recommends -q -y build-essential git bison autoconf ruby p7zip-full curl
shell: bash
- name: Checkout ruby/ruby for tool/make-snapshot
if: inputs.srcdir == ''
run: git clone --single-branch --depth=1 https://github.com/ruby/ruby ruby
shell: bash
- name: Fetch branches and notes (clone mode)
if: inputs.srcdir == ''
env:
SHALLOW_SINCE: ${{ inputs.shallow-since }}
FETCH_BRANCH: ${{ inputs.fetch-branch }}
run: |
set -x
cd ruby
git fetch --shallow-since="$SHALLOW_SINCE"
[ -n "$FETCH_BRANCH" ] && git fetch origin "+$FETCH_BRANCH:$FETCH_BRANCH"
git fetch origin '+refs/notes/commits:refs/notes/commits'
git fetch origin '+refs/notes/log-fix:refs/notes/log-fix'
shell: bash
- name: Fetch notes (local srcdir mode)
if: inputs.srcdir != ''
working-directory: ${{ inputs.srcdir }}
run: |
git fetch origin '+refs/notes/commits:refs/notes/commits' || :
git fetch origin '+refs/notes/log-fix:refs/notes/log-fix' || :
shell: bash
- name: Make snapshot
env:
ARCHNAME: ${{ inputs.archname }}
SRCDIR: ${{ inputs.srcdir }}
GENERATE_TAR_BZ2: ${{ inputs.generate-tar-bz2 }}
VERSION: ${{ inputs.version }}
run: |
[ -z "$SRCDIR" ] && SRCDIR=ruby
if [ -n "$GENERATE_TAR_BZ2" ]; then
ruby "$SRCDIR/tool/make-snapshot" "-archname=$ARCHNAME" -srcdir="$SRCDIR" pkg $VERSION
else
ruby "$SRCDIR/tool/make-snapshot" "-archname=$ARCHNAME" -srcdir="$SRCDIR" -packages=gzip,xz,zip pkg $VERSION
fi
shell: bash
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: Packages
path: pkg
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: Info
path: pkg/info
109 changes: 109 additions & 0 deletions .github/workflows/tarball-macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
name: tarball-macos (reusable)

on:
workflow_call:
inputs:
archname:
description: 'archname (e.g. snapshot-master, snapshot-ruby_3_3)'
required: true
type: string
allow-failures:
description: 'TEST_BUNDLED_GEMS_ALLOW_FAILURES value'
required: false
type: string
default: ''
patch-url:
description: 'Patch URL forwarded from workflow_dispatch'
required: false
type: string
default: ''
rebuild-homebrew-ruby:
description: 'Uninstall and reinstall Homebrew Ruby on macos-15-intel'
required: false
type: boolean
default: false

jobs:
macos:
strategy:
matrix:
test_task: [check, test-bundled-gems, test-bundler-parallel]
os: [macos-14, macos-15]
include:
- os: macos-15-intel
test_task: check
fail-fast: false
runs-on: ${{ matrix.os }}
env:
TEST_BUNDLED_GEMS_ALLOW_FAILURES: ${{ inputs.allow-failures }}
steps:
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: Packages
path: pkg
- name: Extract
run: tar xf pkg/*.tar.xz
- name: Apply patch
run: |
set -x
curl -sSL "${RUBY_PATCH_URL}" -o ruby.patch
cd snapshot-*/
git apply ../ruby.patch
shell: bash
env:
RUBY_PATCH_URL: ${{ inputs.patch-url }}
if: inputs.patch-url != ''
- name: Install libraries
run: |
with_retry () {
"$@" || { sleep 5 && "$@"; } || { sleep 60 && "$@"; }
}
set -x
with_retry brew install gmp libffi openssl@1.1 zlib autoconf automake libtool readline libyaml
- name: Uninstall Homebrew Ruby
run: |
for formula in $(brew list 2>/dev/null | grep '^ruby'); do
brew uninstall --force "$formula"
done
sudo rm -rf /usr/local/lib/ruby
if: inputs.rebuild-homebrew-ruby && matrix.os == 'macos-15-intel'
- name: Set ENV
run: |
echo "JOBS=-j$((1 + $(sysctl -n hw.activecpu)))" >> $GITHUB_ENV
- name: configure
run: cd snapshot-*/ && ./configure --with-openssl-dir=$(brew --prefix openssl@1.1) --with-readline-dir=$(brew --prefix readline) --with-libyaml-dir=$(brew --prefix libyaml)
- name: make
run: cd snapshot-*/ && make $JOBS
- name: Reinstall Homebrew Ruby
run: brew install ruby
if: inputs.rebuild-homebrew-ruby && matrix.os == 'macos-15-intel' && (matrix.test_task == 'test-bundled-gems' || matrix.test_task == 'test-bundler-parallel')
- name: Tests
run: cd snapshot-*/ && make $JOBS -s ${{ matrix.test_task }}
env:
RUBY_TESTOPTS: "-q --tty=no"
RUBY_DEBUG_TEST_NO_REMOTE: "1"
# leaked-globals since 2.7
- name: Leaked Globals
run: cd snapshot-*/ && make -s leaked-globals
if: matrix.test_task == 'check'
- name: make install without root privilege
run: cd snapshot-*/ && make $JOBS install DESTDIR="/tmp/destdir"
if: matrix.test_task == 'check'
- name: make install
run: cd snapshot-*/ && sudo make $JOBS install
if: matrix.test_task == 'check'
- name: ruby -v
run: /usr/local/bin/ruby -v
if: matrix.test_task == 'check'
- uses: ruby/action-slack@54175162371f1f7c8eb94d7c8644ee2479fcd375 # v3.2.2
with:
payload: |
{
"attachments": [{
"text": "${{ job.status }}: ${{ matrix.os }} / ${{ matrix.test_task }} <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}|${{ github.workflow }}>",
"color": "danger"
}]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SNAPSHOT_SLACK_WEBHOOK_URL }}
if: failure() && github.event_name == 'schedule'
70 changes: 70 additions & 0 deletions .github/workflows/tarball-non-development.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: tarball-non-development (reusable)

on:
workflow_call: {}

jobs:
non_development:
runs-on: ubuntu-24.04
env:
ruby_prefix: /tmp/ruby-snapshot
steps:
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: Packages
path: pkg
- name: Extract
run: tar xf pkg/*.tar.xz
- name: Substitute patchlevel
run: |
set -x
cd snapshot-*/
sed -i.orig 's/^\( *# *define *RUBY_PATCHLEVEL\) *-.*/\1 0/' version.h
diff -u version.h.orig version.h || :
rm -f version.h.orig
- name: Install libraries
run: |
set -x
sudo apt-get update -q || :
sudo apt-get install --no-install-recommends -q -y build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev bison- autoconf-
- name: Set ENV
run: |
echo "JOBS=-j$((1 + $(nproc --all)))" >> $GITHUB_ENV
- name: configure
run: cd snapshot-*/ && ./configure --prefix="${ruby_prefix}"
- name: make
run: cd snapshot-*/ && make $JOBS
- name: Leaked Globals
run: cd snapshot-*/ && make -s leaked-globals
- name: make install
run: cd snapshot-*/ && make $JOBS install
- name: Set PATH
run: echo "PATH=${ruby_prefix}/bin:$PATH" >> $GITHUB_ENV
- name: Check patchlevel
id: check-patchlevel
run: |
exec "${ruby_prefix}/bin/ruby" -vx "$0"
#!ruby
puts "RUBY_PATCHLEVEL=#{RUBY_PATCHLEVEL.inspect}"
abort unless RUBY_PATCHLEVEL >= 0
working-directory: ${{ env.ruby_prefix }}
continue-on-error: true
- name: Check LOADPATH
id: check-loadpath
run: |
exec ${ruby_prefix}/bin/ruby -vx "$0"
#!ruby
paths = $:.grep(/\+/)
pp paths
abort unless paths.empty?
working-directory: ${{ env.ruby_prefix }}
continue-on-error: true
- name: Check pathnames
id: check-pathnames
run: |
! find -name '*+*' | grep +
working-directory: ${{ env.ruby_prefix }}
continue-on-error: true
- name: result
run: false
if: ${{ contains(steps.*.outcome, 'failure') }}
82 changes: 82 additions & 0 deletions .github/workflows/tarball-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: tarball-test
on:
push:
paths-ignore:
- 'doc/**'
- '**/man/*'
- '**.md'
- '**.rdoc'
- '**/.document'
- '.*.yml'
pull_request:
# Do not use paths-ignore for required status checks
# https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/collaborating-on-repositories-with-code-quality-features/troubleshooting-required-status-checks#handling-skipped-but-required-checks
merge_group:
schedule:
- cron: '30 18 * * *' # Daily at 18:30 UTC

concurrency:
group: ${{ github.workflow }} / ${{ startsWith(github.event_name, 'pull') && github.ref_name || github.sha }}
cancel-in-progress: ${{ startsWith(github.event_name, 'pull') }}

permissions:
contents: read

jobs:
tarball:
runs-on: ubuntu-latest
# Cherry-pick to maintenance branches by changing only env.BRANCH below;
# archname / branch-label / Materialize all derive from it.
env:
BRANCH: master
outputs:
branch: ${{ env.BRANCH }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
# tool/make-snapshot derives the branch name from HEAD and looks up
# the upstream during ChangeLog generation. Detached checkouts
# (pull_request, merge_group) lack a local branch with tracking, so
# pin one to HEAD and connect it to the matching origin ref.
- name: Materialize local branch
run: |
git fetch --no-tags --depth=1 origin "+refs/heads/$BRANCH:refs/remotes/origin/$BRANCH"
git checkout -B "$BRANCH" HEAD
git branch --set-upstream-to="origin/$BRANCH" "$BRANCH"
- uses: ./.github/actions/make-snapshot
with:
archname: snapshot-${{ env.BRANCH }}
srcdir: '.'

ubuntu:
needs: tarball
uses: ./.github/workflows/tarball-ubuntu.yml
with:
archname: snapshot-${{ needs.tarball.outputs.branch }}
allow-failures: power_assert
remove-gnupg: true
notify-ruby-sha: true
branch-label: ${{ needs.tarball.outputs.branch }}
secrets: inherit

macos:
needs: tarball
uses: ./.github/workflows/tarball-macos.yml
with:
archname: snapshot-${{ needs.tarball.outputs.branch }}
allow-failures: power_assert
secrets: inherit

windows:
needs: tarball
uses: ./.github/workflows/tarball-windows.yml
with:
archname: snapshot-${{ needs.tarball.outputs.branch }}
mode: modern
secrets: inherit

non_development:
needs: tarball
uses: ./.github/workflows/tarball-non-development.yml
secrets: inherit
Loading