Skip to content

Merge pull request #18 from parca-dev/remove_docker_image_cache #71

Merge pull request #18 from parca-dev/remove_docker_image_cache

Merge pull request #18 from parca-dev/remove_docker_image_cache #71

Workflow file for this run

name: Generate Ruby
on:
workflow_call:
push:
branches:
- main
- release-*
paths:
- ".github/workflows/generate-ruby.yml"
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
]
arch: [amd64, arm64]
steps:
- name: Check out the code
uses: actions/checkout@v4
- 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/cache@v4
with:
path: ~/.devbox/go
key: devbox-go-tools.cache-${{ runner.os }}-${{ runner.arch }}
- name: Build
run: make build
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: linux/amd64,linux/arm64
- name: Set up cache for downloaded files
uses: actions/cache@v4
with:
path: ruby-binaries
key: ruby-downloaded-${{ runner.os }}-${{ matrix.arch }}
restore-keys: |
ruby-downloaded-${{ runner.os }}-${{ matrix.arch }}-${{ matrix.ruby-version }}
ruby-downloaded-${{ runner.os }}-${{ matrix.arch }}
- name: Generate Ruby Offsets for ${{ matrix.ruby-version }} on ${{ matrix.arch }}
run: |
if ! ls "${PWD}"/ruby-binaries/${{ matrix.arch }}/${{ matrix.ruby-version }}/libruby.so.${{ matrix.ruby-version }} 1>/dev/null 2>&1; then
mkdir -p "${PWD}"/ruby-binaries/${{ matrix.arch }}/${{ matrix.ruby-version }}
docker run --rm --platform "linux/${{ matrix.arch }}" -v "${PWD}"/ruby-binaries/${{ matrix.arch }}/${{ 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/${{ matrix.arch }}/
./structlayout -r ruby -v ${{ matrix.ruby-version }} -o offsets-ruby/${{ matrix.arch }} ruby-binaries/${{ matrix.arch }}/${{ 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.arch }}-${{ matrix.ruby-version }}
path: offsets-ruby
retention-days: 1
merge-and-create-branch:
runs-on: ubuntu-latest
needs: generate
permissions:
contents: write
pull-requests: write
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/cache@v4
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: Print the layout files
run: tree offsets-ruby
- name: Merge the layout files
run: |
target_archs=(
amd64
arm64
)
rm -rf pkg/ruby/layout
for arch in "${target_archs[@]}"; do
mkdir -p pkg/ruby/layout/"${arch}"
./mergelayout -o pkg/ruby/layout/"${arch}" offsets-ruby/"${arch}"/layout/ruby_*.yaml
done
# 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
if: github.event_name != 'pull_request'
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "chore: update ruby layouts"
title: "chore: Update Ruby layouts"
branch: update-ruby-offsets-${{ github.run_number }}
add-paths: pkg/ruby/layout
base: main
labels: chore
draft: false
delete-branch: true