summaryrefslogtreecommitdiff
path: root/.github/workflows/bundled_gems.yml
diff options
context:
space:
mode:
Diffstat (limited to '.github/workflows/bundled_gems.yml')
-rw-r--r--.github/workflows/bundled_gems.yml117
1 files changed, 57 insertions, 60 deletions
diff --git a/.github/workflows/bundled_gems.yml b/.github/workflows/bundled_gems.yml
index c871388f93..6f06451a99 100644
--- a/.github/workflows/bundled_gems.yml
+++ b/.github/workflows/bundled_gems.yml
@@ -2,54 +2,48 @@ name: bundled_gems
on:
push:
- branches: [ "master" ]
+ branches: ['master']
paths:
- '.github/workflows/bundled_gems.yml'
- 'gems/bundled_gems'
pull_request:
- branches: [ "master" ]
+ branches: ['master']
paths:
- '.github/workflows/bundled_gems.yml'
- 'gems/bundled_gems'
merge_group:
- branches: [ "master" ]
- paths:
- - '.github/workflows/bundled_gems.yml'
- - 'gems/bundled_gems'
schedule:
- cron: '45 6 * * *'
workflow_dispatch:
-permissions: # added using https://github.com/step-security/secure-workflows
+permissions: # added using https://github.com/step-security/secure-workflows
contents: read
jobs:
update:
permissions:
- contents: write # for Git to git push
+ contents: write # for Git to git push
+
if: ${{ github.event_name != 'schedule' || github.repository == 'ruby/ruby' }}
+
name: update ${{ github.workflow }}
+
runs-on: ubuntu-latest
+
steps:
- - name: git config
- run: |
- git config --global advice.detachedHead 0
- git config --global init.defaultBranch garbage
+ - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
+ with:
+ token: ${{ (github.repository == 'ruby/ruby' && !startsWith(github.event_name, 'pull')) && secrets.MATZBOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
+
+ - uses: ./.github/actions/setup/directories
+ with:
+ # Skip overwriting MATZBOT_GITHUB_TOKEN
+ checkout: '' # false (ref: https://github.com/actions/runner/issues/2238)
- name: Set ENV
run: |
- echo "GNUMAKEFLAGS=-j$((1 + $(nproc --all)))" >> $GITHUB_ENV
echo "TODAY=$(date +%F)" >> $GITHUB_ENV
- - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
-
- - uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
- with:
- path: .downloaded-cache
- key: downloaded-cache-${{ github.sha }}
- restore-keys: |
- downloaded-cache
-
- name: Download previous gems list
run: |
data=bundled_gems.json
@@ -58,8 +52,16 @@ jobs:
curl -O -R -z ./$data https://stdgems.org/$data
- name: Update bundled gems list
+ id: bundled_gems
+ run: |
+ ruby -i~ tool/update-bundled_gems.rb gems/bundled_gems >> $GITHUB_OUTPUT
+
+ - name: Update spec/bundler/support/builders.rb
run: |
- ruby -i~ tool/update-bundled_gems.rb gems/bundled_gems
+ #!ruby
+ rake_version = File.read("gems/bundled_gems")[/^rake\s+(\S+)/, 1]
+ print ARGF.read.sub(/^ *def rake_version\s*\K".*?"/) {rake_version.dump}
+ shell: ruby -i~ {0} spec/bundler/support/builders.rb
- name: Maintain updated gems list in NEWS
run: |
@@ -68,71 +70,66 @@ jobs:
- name: Check diffs
id: diff
run: |
- git add -- NEWS.md
- git diff --no-ext-diff --ignore-submodules --quiet -- gems/bundled_gems
- continue-on-error: true
+ news= gems=
+ git diff --color --no-ext-diff --ignore-submodules --exit-code -- NEWS.md ||
+ news=true
+ git diff --color --no-ext-diff --ignore-submodules --exit-code -- gems/bundled_gems ||
+ gems=true
+ git add -- NEWS.md gems/bundled_gems
+ git add -- spec/bundler/support/builders.rb
+ echo news=$news >> $GITHUB_OUTPUT
+ echo gems=$gems >> $GITHUB_OUTPUT
+ echo update=${news:-$gems} >> $GITHUB_OUTPUT
- name: Install libraries
- run: |
- set -x
- sudo apt-get update -q || :
- sudo apt-get install --no-install-recommends -q -y build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev autoconf ruby
- if: ${{ steps.diff.outcome == 'failure' }}
+ uses: ./.github/actions/setup/ubuntu
+ if: ${{ steps.diff.outputs.gems }}
- name: Build
run: |
./autogen.sh
./configure -C --disable-install-doc
make
- if: ${{ steps.diff.outcome == 'failure' }}
+ if: ${{ steps.diff.outputs.gems }}
- name: Prepare bundled gems
run: |
make -s prepare-gems
- if: ${{ steps.diff.outcome == 'failure' }}
+ if: ${{ steps.diff.outputs.gems }}
- name: Test bundled gems
run: |
make -s test-bundled-gems
- git add -- gems/bundled_gems
timeout-minutes: 30
env:
- RUBY_TESTOPTS: "-q --tty=no"
- TEST_BUNDLED_GEMS_ALLOW_FAILURES: ""
- if: ${{ steps.diff.outcome == 'failure' }}
-
- - name: Show diffs
- id: show
- run: |
- git diff --cached --color --no-ext-diff --ignore-submodules --exit-code --
- continue-on-error: true
+ RUBY_TESTOPTS: '-q --tty=no'
+ TEST_BUNDLED_GEMS_ALLOW_FAILURES: ''
+ if: ${{ steps.diff.outputs.gems }}
- name: Commit
run: |
git pull --ff-only origin ${GITHUB_REF#refs/heads/}
- message="Update bundled gems list at "
- if [ ${{ steps.diff.outcome }} = success ]; then
- git commit --message="${message}${GITHUB_SHA:0:30} [ci skip]"
+ message="Update bundled gems list"
+ if [ -z "${gems}" ]; then
+ git commit --message="${message} at ${GITHUB_SHA:0:30} [ci skip]"
else
- git commit --message="${message}${TODAY}"
+ git commit --message="${message} as of ${TODAY}"
fi
git push origin ${GITHUB_REF#refs/heads/}
env:
+ TODAY: ${{ steps.bundled_gems.outputs.latest_date || env.TODAY }}
EMAIL: svn-admin@ruby-lang.org
GIT_AUTHOR_NAME: git
GIT_COMMITTER_NAME: git
- if: ${{ github.repository == 'ruby/ruby' && !startsWith(github.event_name, 'pull') && steps.show.outcome == 'failure' }}
-
- - uses: ruby/action-slack@0bd85c72233cdbb6a0fe01d37aaeff1d21b5fce1 # v3.2.1
+ gems: ${{ steps.diff.outputs.gems }}
+ if: >-
+ ${{
+ github.repository == 'ruby/ruby' &&
+ !startsWith(github.event_name, 'pull') &&
+ steps.diff.outputs.update
+ }}
+
+ - uses: ./.github/actions/slack
with:
- payload: |
- {
- "ci": "GitHub Actions",
- "env": "${{ github.workflow }} / update",
- "url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}",
- "commit": "${{ github.sha }}",
- "branch": "${{ github.ref_name }}"
- }
- env:
SLACK_WEBHOOK_URL: ${{ secrets.SIMPLER_ALERTS_URL }} # ruby-lang slack: ruby/simpler-alerts-bot
- if: ${{ failure() && github.event_name == 'push' }}
+ if: ${{ failure() }}