Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

Commit 9117851

Browse files
committed
Add 3.4-asan builds, try 2
**What does this PR do?** This PR is a second attempt at adding 3.4-asan builds (first attempt was ruby#13); this version is now atop ruby#14 . It introduces a new "3.4-asan" build, based on the existing asan builds, but just pointed at the `ruby_3_4` branch. In ruby#13, we were building the latest tagged 3.4 release, which I expect would be more stable than just using `ruby_3_4` (and thus better for my downstream purposes of "having a build that doesn't fail for non-asan-related reasons"). Switching between both options is as simple as: ```diff diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7eb72a8..d7608d9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -29,6 +29,8 @@ jobs: with: repository: ruby/ruby path: ruby + fetch-tags: true fetch-depth: 0 - name: Set latest_commit id: latest_commit working-directory: ruby @@ -37,7 +39,8 @@ jobs: id: latest_commit_3_4_asan working-directory: ruby run: | - git checkout ruby_3_4 + LATEST_TAG=$(git tag --list | grep -E "v3_4_[0-9]+$" | sort -V | tail -n1) + git checkout "$LATEST_TAG" echo "commit=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT - name: Check if latest commit already built uses: actions/github-script@v7 ``` I personally prefer building from the tag, but happy to use the branch option if that's preferrable. **Motivation:** The intention of "3.4-stable" is to provide the latest up-to-date stable Ruby, so that we can reliably use it as a breaking CI step. As discussed in ruby/setup-ruby#682, the current ruby-asan builds are a bit of a "sharp edge" when used in CI because they may break due to changes that are completely unrelated to asan. Building asan rubies is a bit awkward still, as e.g. ruby-build and other version managers don't have support for it, and it requires very modern versions of specific system tools (e.g. clang). **Additional Notes:** In particular, I decided to not touch the logic that determines weather there's a more recent commit to build or not. This does mean that if ruby master sees no commits, but there's changes in the 3.4 branch, this won't be picked up immediately; and it also means that if there's a new master commit and no change to the 3.4 branch we still rebuild 3.4-asan. My thinking is that given that ruby#14 added caching already, this approach keeps things simple. Let me know if you're not convinced, and I can change that. **How to test the change?** I've built this in the downstream fork, and manually downloaded the resulting Ruby and it seems to be in good shape and with asan working fine. * Successful run: FIXME * Resulting builds: FIXME
1 parent 809d82a commit 9117851

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

.github/workflows/build.yml

+19-3
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ jobs:
1919
outputs:
2020
should_build: ${{ steps.check_commit.outputs.should_build }}
2121
commit: ${{ steps.latest_commit.outputs.commit }}
22+
commit_3_4_asan: ${{ steps.latest_commit_3_4_asan.outputs.commit }}
2223
previous_release: ${{ steps.check_commit.outputs.previous_release }}
2324
build_matrix: ${{ steps.matrix.outputs.build_matrix }}
2425
reuse_matrix: ${{ steps.matrix.outputs.reuse_matrix }}
@@ -28,23 +29,31 @@ jobs:
2829
with:
2930
repository: ruby/ruby
3031
path: ruby
32+
fetch-depth: 0
3133
- name: Set latest_commit
3234
id: latest_commit
3335
working-directory: ruby
3436
run: echo "commit=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
35-
37+
- name: Set latest commit (3.4-asan)
38+
id: latest_commit_3_4_asan
39+
working-directory: ruby
40+
run: |
41+
git checkout ruby_3_4
42+
echo "commit=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
3643
- name: Check if latest commit already built
3744
uses: actions/github-script@v7
3845
id: check_commit
3946
with:
4047
script: |
4148
const latestDevCommit = "${{ steps.latest_commit.outputs.commit }}"
49+
const latest34Asan = "${{ steps.latest_commit_3_4_asan.outputs.commit }}"
4250
const { owner, repo } = context.repo
4351
let { data: release } = await github.rest.repos.getLatestRelease({ owner, repo })
4452
const firstLine = release.body.split('\n')[0]
4553
const latestReleaseCommit = firstLine.split('@')[1]
4654
console.log(`Latest release commit: ${latestReleaseCommit}`)
4755
console.log(`Latest ruby commit: ${latestDevCommit}`)
56+
console.log(`Latest 3.4-asan: ${latest34Asan}`)
4857
core.setOutput('should_build', latestReleaseCommit !== latestDevCommit)
4958
core.setOutput('previous_release', release.tag_name)
5059
- name: Compute build and reuse matrix
@@ -56,7 +65,7 @@ jobs:
5665
const skipSlow = "${{ github.event_name == 'workflow_dispatch' && github.event.inputs.skip_slow == 'true' }}"
5766
const buildMatrix = JSON.stringify(
5867
skipSlow === 'false' ?
59-
{ os: osList, name: ['head', 'debug'], include: [{ os: 'ubuntu-24.04', name: 'asan' }] } :
68+
{ os: osList, name: ['head', 'debug'], include: [{ os: 'ubuntu-24.04', name: 'asan' }, { os: 'ubuntu-24.04', name: '3.4-asan' }] } :
6069
{ os: osList, name: ['head'] }
6170
)
6271
core.setOutput('build_matrix', buildMatrix)
@@ -116,6 +125,13 @@ jobs:
116125
with:
117126
repository: ruby/ruby
118127
ref: ${{ needs.prepare.outputs.commit }}
128+
if: matrix.name != '3.4-asan'
129+
- name: Clone ruby (3.4-asan)
130+
uses: actions/checkout@v4
131+
with:
132+
repository: ruby/ruby
133+
ref: ${{ needs.prepare.outputs.commit_3_4_asan }}
134+
if: matrix.name == '3.4-asan'
119135
- name: Clone ruby-dev-builder
120136
uses: actions/checkout@v4
121137
with:
@@ -191,7 +207,7 @@ jobs:
191207
# Make the test timeouts more generous too (ASAN is slower)
192208
echo "RUBY_TEST_TIMEOUT_SCALE=5" >> $GITHUB_ENV
193209
echo "SYNTAX_SUGGEST_TIMEOUT=600" >> $GITHUB_ENV
194-
if: matrix.name == 'asan'
210+
if: matrix.name == 'asan' || matrix.name == '3.4-asan'
195211

196212
# Build
197213
- run: mkdir -p ~/.rubies

0 commit comments

Comments
 (0)