Skip to content

Generate Ruby

Generate Ruby #50

Workflow file for this run

name: Generate Ruby
on:
workflow_call: null
workflow_run:
workflows: ["Build"]
types:
- completed
push:
branches:
- main
- release-*
paths:
- ".github/workflows/generate-ruby.yml"
pull_request:
permissions:
contents: write
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
generate:
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
ruby-version: [
2.6.0, 2.6.1, 2.6.2, 2.6.3, 2.6.4, 2.6.5, 2.6.6, 2.6.7, 2.6.8, 2.6.9, 2.6.10,
2.7.0, 2.7.1, 2.7.2, 2.7.3, 2.7.4, 2.7.5, 2.7.6, 2.7.7, 2.7.8,
3.0.0, 3.0.1, 3.0.2, 3.0.3, 3.0.4, 3.0.5, 3.0.6,
3.1.0, 3.1.1, 3.1.2, 3.1.3, 3.1.4,
3.2.0, 3.2.1, 3.2.2, 3.2.3, 3.3.0
]
steps:
- name: Check out the code
uses: actions/[email protected]
- name: Install devbox
uses: jetpack-io/[email protected]
with:
enable-cache: true
- name: Setup devbox
run: devbox run -- echo "done!"
- name: Load devbox shellenv
uses: HatsuneMiku3939/direnv-action@v1
with:
direnvVersion: 2.32.3
- name: Set up Go tool cache
uses: actions/[email protected]
with:
path: ~/.devbox/go
key: devbox-go-tools.cache-${{ runner.os }}-${{ runner.arch }}
- name: Build
run: make build
- name: Set up container image for generate
uses: ScribeMD/[email protected]
with:
key: docker-ruby-${{ runner.os }}-${{ runner.arch }}
- name: Set up Layout cache for generated files
uses: actions/[email protected]
with:
path: offsets-ruby
key: ruby-generated-${{ runner.os }}-${{ runner.arch }}
restore-keys: |
ruby-generated-${{ runner.os }}-${{ runner.arch }}-${{ matrix.ruby-version }}
ruby-generated-${{ runner.os }}-${{ runner.arch }}
- name: Generate Ruby Offsets for ${{ matrix.ruby-version }}
run: |
if ! ls "${PWD}"/ruby-binaries/${{ matrix.ruby-version }}/libruby.so.${{ matrix.ruby-version }} 1>/dev/null 2>&1; then
mkdir -p "${PWD}"/ruby-binaries/${{ matrix.ruby-version }}
docker run --rm -v "${PWD}"/ruby-binaries/${{ matrix.ruby-version }}:/tmp -w /tmp docker.io/library/ruby:${{ matrix.ruby-version }}-slim bash -c 'cp /usr/local/lib/libruby.so.${{ matrix.ruby-version }} /tmp'
fi
mkdir -p offsets-ruby
./structlayout -r ruby -v ${{ matrix.ruby-version }} -o offsets-ruby ruby-binaries/${{ matrix.ruby-version }}/libruby.so.${{ matrix.ruby-version }}
git add offsets-ruby
cp $(git diff --name-only --staged | xargs) offsets-ruby || echo "No new or modified files - offsets are up to date"
- name: Upload Offsets
uses: actions/upload-artifact@v4
with:
if-no-files-found: ignore
name: ruby-${{ matrix.ruby-version }}
path: offsets-ruby
retention-days: 1
create-branch:
runs-on: ubuntu-latest
needs: generate
if: github.event_name != 'pull_request'
steps:
- name: Check out the code
uses: actions/[email protected]
- name: Install devbox
uses: jetpack-io/[email protected]
with:
enable-cache: true
- name: Setup devbox
run: devbox run -- echo "done!"
- name: Load devbox shellenv
uses: HatsuneMiku3939/direnv-action@v1
with:
direnvVersion: 2.32.3
- name: Set up Go tool cache
uses: actions/[email protected]
with:
path: ~/.devbox/go
key: devbox-go-tools.cache-${{ runner.os }}-${{ runner.arch }}
- name: Build
run: make build
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: offsets-ruby
merge-multiple: true
- name: Merge offsets
run: |
ls -al offsets-ruby
./mergelayout -o pkg/ruby/versions offsets-ruby/ruby_*.yaml
# If there are no changes (i.e. no diff exists with the checked-out base branch),
# no pull request will be created and the action exits silently.
- name: Create a pull-request
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "chore: update ruby layouts"
title: "chore: Update Ruby layouts"
branch: update-ruby-offsets-${{ github.run_number }}
base: main
labels: chore
draft: false
delete-branch: true