bundled_gems #78
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: | |
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 | |
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@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 | |
- uses: ./.github/actions/setup/directories | |
- name: Set ENV | |
run: | | |
echo "TODAY=$(date +%F)" >> $GITHUB_ENV | |
- name: Download previous gems list | |
run: | | |
data=bundled_gems.json | |
mkdir -p .downloaded-cache | |
ln -s .downloaded-cache/$data . | |
curl -O -R -z ./$data https://stdgems.org/$data | |
- name: Update bundled gems list | |
run: | | |
ruby -i~ tool/update-bundled_gems.rb gems/bundled_gems | |
- name: Maintain updated gems list in NEWS | |
run: | | |
ruby tool/update-NEWS-gemlist.rb bundled | |
- 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 | |
- name: Install libraries | |
uses: ./.github/actions/setup/ubuntu | |
if: ${{ steps.diff.outcome == 'failure' }} | |
- name: Build | |
run: | | |
./autogen.sh | |
./configure -C --disable-install-doc | |
make | |
if: ${{ steps.diff.outcome == 'failure' }} | |
- name: Prepare bundled gems | |
run: | | |
make -s prepare-gems | |
if: ${{ steps.diff.outcome == 'failure' }} | |
- 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 | |
- 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]" | |
else | |
git commit --message="${message}${TODAY}" | |
fi | |
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.show.outcome == 'failure' }} | |
- uses: ./.github/actions/slack | |
with: | |
SLACK_WEBHOOK_URL: ${{ secrets.SIMPLER_ALERTS_URL }} # ruby-lang slack: ruby/simpler-alerts-bot | |
if: ${{ failure() && github.event_name == 'push' }} |