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

Commit 7783056

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 # Workaround for actions/checkout#1781 - 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 7783056

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

.github/workflows/build.yml

+18-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 }}
@@ -32,19 +33,26 @@ jobs:
3233
id: latest_commit
3334
working-directory: ruby
3435
run: echo "commit=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
35-
36+
- name: Set latest commit (3.4-asan)
37+
id: latest_commit_3_4_asan
38+
working-directory: ruby
39+
run: |
40+
git checkout ruby_3_4
41+
echo "commit=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
3642
- name: Check if latest commit already built
3743
uses: actions/github-script@v7
3844
id: check_commit
3945
with:
4046
script: |
4147
const latestDevCommit = "${{ steps.latest_commit.outputs.commit }}"
48+
const latest34Asan = "${{ steps.latest_commit_3_4_asan.outputs.commit }}"
4249
const { owner, repo } = context.repo
4350
let { data: release } = await github.rest.repos.getLatestRelease({ owner, repo })
4451
const firstLine = release.body.split('\n')[0]
4552
const latestReleaseCommit = firstLine.split('@')[1]
4653
console.log(`Latest release commit: ${latestReleaseCommit}`)
4754
console.log(`Latest ruby commit: ${latestDevCommit}`)
55+
console.log(`Latest 3.4-asan: ${latest34Asan}`)
4856
core.setOutput('should_build', latestReleaseCommit !== latestDevCommit)
4957
core.setOutput('previous_release', release.tag_name)
5058
- name: Compute build and reuse matrix
@@ -56,7 +64,7 @@ jobs:
5664
const skipSlow = "${{ github.event_name == 'workflow_dispatch' && github.event.inputs.skip_slow == 'true' }}"
5765
const buildMatrix = JSON.stringify(
5866
skipSlow === 'false' ?
59-
{ os: osList, name: ['head', 'debug'], include: [{ os: 'ubuntu-24.04', name: 'asan' }] } :
67+
{ os: osList, name: ['head', 'debug'], include: [{ os: 'ubuntu-24.04', name: 'asan' }, { os: 'ubuntu-24.04', name: '3.4-asan' }]] } :
6068
{ os: osList, name: ['head'] }
6169
)
6270
core.setOutput('build_matrix', buildMatrix)
@@ -116,6 +124,13 @@ jobs:
116124
with:
117125
repository: ruby/ruby
118126
ref: ${{ needs.prepare.outputs.commit }}
127+
if: matrix.name != '3.4-asan'
128+
- name: Clone ruby (3.4-asan)
129+
uses: actions/checkout@v4
130+
with:
131+
repository: ruby/ruby
132+
ref: ${{ needs.prepare.outputs.commit_3_4_asan }}
133+
if: matrix.name == '3.4-asan'
119134
- name: Clone ruby-dev-builder
120135
uses: actions/checkout@v4
121136
with:
@@ -191,7 +206,7 @@ jobs:
191206
# Make the test timeouts more generous too (ASAN is slower)
192207
echo "RUBY_TEST_TIMEOUT_SCALE=5" >> $GITHUB_ENV
193208
echo "SYNTAX_SUGGEST_TIMEOUT=600" >> $GITHUB_ENV
194-
if: matrix.name == 'asan'
209+
if: matrix.name == 'asan' || matrix.name == '3.4-asan'
195210

196211
# Build
197212
- run: mkdir -p ~/.rubies

0 commit comments

Comments
 (0)