-
Notifications
You must be signed in to change notification settings - Fork 62
136 lines (116 loc) · 4.2 KB
/
bundled_gems.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
name: bundled_gems
on:
push:
branches: ['master']
paths:
- '.github/workflows/bundled_gems.yml'
- 'gems/bundled_gems'
pull_request:
branches: ['master']
paths:
- '.github/workflows/bundled_gems.yml'
- 'gems/bundled_gems'
merge_group:
schedule:
- cron: '45 6 * * *'
workflow_dispatch:
permissions: # added using https://github.com/step-security/secure-workflows
contents: read
jobs:
update:
permissions:
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:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
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 "TODAY=$(date +%F)" >> $GITHUB_ENV
- name: Download previous gems list
run: |
mkdir -p .downloaded-cache
for data in bundled_gems.json default_gems.json; do
ln -s .downloaded-cache/$data .
curl -O -R -z ./$data https://stdgems.org/$data
done
- 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
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: |
ruby tool/update-NEWS-gemlist.rb bundled
- name: Check diffs
id: diff
run: |
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
uses: ./.github/actions/setup/ubuntu
if: ${{ steps.diff.outputs.gems }}
- name: Build
run: |
./autogen.sh
./configure -C --disable-install-doc
make
if: ${{ steps.diff.outputs.gems }}
- name: Prepare bundled gems
run: |
make -s prepare-gems
if: ${{ steps.diff.outputs.gems }}
- name: Test bundled gems
run: |
make -s test-bundled-gems
timeout-minutes: 30
env:
RUBY_TESTOPTS: '-q --tty=no'
TEST_BUNDLED_GEMS_ALLOW_FAILURES: 'typeprof'
if: ${{ steps.diff.outputs.gems }}
- name: Commit
run: |
git pull --ff-only origin ${GITHUB_REF#refs/heads/}
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} as of ${TODAY}"
fi
git push origin ${GITHUB_REF#refs/heads/}
env:
TODAY: ${{ steps.bundled_gems.outputs.latest_date || env.TODAY }}
EMAIL: [email protected]
GIT_AUTHOR_NAME: git
GIT_COMMITTER_NAME: git
gems: ${{ steps.diff.outputs.gems }}
if: >-
${{
github.repository == 'ruby/ruby' &&
!startsWith(github.event_name, 'pull') &&
steps.diff.outputs.update
}}
- uses: ./.github/actions/slack
with:
SLACK_WEBHOOK_URL: ${{ secrets.SIMPLER_ALERTS_URL }} # ruby-lang slack: ruby/simpler-alerts-bot
if: ${{ failure() }}