-
Notifications
You must be signed in to change notification settings - Fork 0
115 lines (98 loc) · 3.79 KB
/
check_misc.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
name: Miscellaneous checks
on: [push, pull_request, merge_group]
concurrency:
group: ${{ github.workflow }} / ${{ startsWith(github.event_name, 'pull') && github.ref_name || github.sha }}
cancel-in-progress: ${{ startsWith(github.event_name, 'pull') }}
permissions:
contents: read
jobs:
checks:
permissions:
contents: write # for Git to git push
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
token: ${{ (github.repository == 'ruby/ruby' && !startsWith(github.event_name, 'pull')) && secrets.MATZBOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
- uses: ./.github/actions/setup/directories
with:
makeup: true
# Skip overwriting MATZBOT_GITHUB_TOKEN
checkout: '' # false (ref: https://github.com/actions/runner/issues/2238)
- name: Check if C-sources are US-ASCII
run: |
grep -r -n --include='*.[chyS]' --include='*.asm' $'[^\t-~]' -- . && exit 1 || :
- name: Check for trailing spaces
run: |
git grep -I -n $'[\t ]$' -- '*.rb' '*.[chy]' '*.rs' '*.yml' && exit 1 || :
git grep -n $'^[\t ][\t ]*$' -- '*.md' && exit 1 || :
- name: Check for bash specific substitution in configure.ac
run: |
git grep -n '\${[A-Za-z_0-9]*/' -- configure.ac && exit 1 || :
- name: Check for header macros
run: |
fail=
for header in ruby/*.h; do
git grep -l -F -e $header -e HAVE_`echo $header | tr a-z./ A-Z__` -- . > /dev/null && continue
fail=1
echo $header
done
exit $fail
working-directory: include
- id: gems
run: true
if: ${{ github.ref == 'refs/heads/master' }}
- name: Download previous gems list
run: |
data=default_gems.json
mkdir -p .downloaded-cache
ln -s .downloaded-cache/$data .
curl -O -R -z ./$data https://stdgems.org/$data
if: ${{ steps.gems.outcome == 'success' }}
- name: Make default gems list
run: |
#!ruby
require 'rubygems'
$:.unshift "lib"
rgver = File.foreach("lib/rubygems.rb") do |line|
break $1 if /^\s*VERSION\s*=\s*"([^"]+)"/ =~ line
end
gems = Dir.glob("{ext,lib}/**/*.gemspec").map do |f|
spec = Gem::Specification.load(f)
"#{spec.name} #{spec.version}"
end.sort
File.open("gems/default_gems", "w") do |f|
f.puts "RubyGems #{rgver}"
f.puts gems
end
shell: ruby --disable=gems {0}
if: ${{ steps.gems.outcome == 'success' }}
- name: Maintain updated gems list in NEWS
run: |
ruby tool/update-NEWS-gemlist.rb default
if: ${{ steps.gems.outcome == 'success' }}
- name: Check diffs
id: diff
run: |
git diff --color --no-ext-diff --ignore-submodules --exit-code NEWS.md ||
echo update=true >> $GITHUB_OUTPUT
if: ${{ steps.gems.outcome == 'success' }}
- name: Commit
run: |
git pull --ff-only origin ${GITHUB_REF#refs/heads/}
git commit --message="Update default gems list at ${GITHUB_SHA:0:30} [ci skip]" NEWS.md
git push origin ${GITHUB_REF#refs/heads/}
env:
EMAIL: [email protected]
GIT_AUTHOR_NAME: git
GIT_COMMITTER_NAME: git
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() }}