-
Notifications
You must be signed in to change notification settings - Fork 1
156 lines (130 loc) · 4.73 KB
/
generate-ruby.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
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
merge-and-create-branch:
runs-on: ubuntu-latest
needs: generate
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: Print the layout files
run: tree offsets-ruby
- name: Merge the layout files
run: |
./mergelayout -o pkg/ruby/layout offsets-ruby/layout/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
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