Skip to content

Commit

Permalink
Output Github job summary
Browse files Browse the repository at this point in the history
From Colin: https://github.blog/2022-05-09-supercharging-github-actions-with-job-summaries/

Renamed `bin/print_gem_version` to `bin/print_summary`. It now also prints out the Ruby version and is formatted to be markdown.
  • Loading branch information
schneems committed Apr 2, 2024
1 parent 2e06fba commit 68005ab
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build_ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
- name: Build and package Ruby runtime
run: bin/build_ruby "$STACK" "${{inputs.ruby_version}}"
- name: Verify ruby executable and output rubygems version
run: bin/print_gem_version "$STACK" "${{inputs.ruby_version}}"
run: bin/print_summary "$STACK" "${{inputs.ruby_version}}" >> $GITHUB_STEP_SUMMARY
- name: Upload Ruby runtime archive to S3 dry run
if: (inputs.dry_run)
run: aws s3 sync ./builds "s3://${S3_BUCKET}" --dryrun
Expand All @@ -61,7 +61,7 @@ jobs:
- name: Build and package Ruby runtime
run: bin/build_ruby "$STACK" "${{inputs.ruby_version}}"
- name: Verify ruby executable and output rubygems version
run: bin/print_gem_version "$STACK" "${{inputs.ruby_version}}"
run: bin/print_summary "$STACK" "${{inputs.ruby_version}}" >> $GITHUB_STEP_SUMMARY
- name: Upload Ruby runtime archive to S3 dry run
if: (inputs.dry_run)
run: aws s3 sync ./builds "s3://${S3_BUCKET}" --dryrun
Expand All @@ -84,7 +84,7 @@ jobs:
- name: Build and package Ruby runtime
run: bin/build_ruby "$STACK" "${{inputs.ruby_version}}"
- name: Verify ruby executable and output rubygems version
run: bin/print_gem_version "$STACK" "${{inputs.ruby_version}}" amd64
run: bin/print_summary "$STACK" "${{inputs.ruby_version}}" amd64 >> $GITHUB_STEP_SUMMARY
- name: Upload Ruby runtime archive to S3 dry run
if: (inputs.dry_run)
run: aws s3 sync ./builds "s3://${S3_BUCKET}" --dryrun
Expand Down Expand Up @@ -116,7 +116,7 @@ jobs:
- name: Build and package Ruby runtime
run: bin/build_ruby "$STACK" "${{inputs.ruby_version}}"
- name: Verify ruby executable and output rubygems version
run: bin/print_gem_version "$STACK" "${{inputs.ruby_version}}" arm64
run: bin/print_summary "$STACK" "${{inputs.ruby_version}}" arm64 >> $GITHUB_STEP_SUMMARY
- name: Upload Ruby runtime archive to S3 dry run
if: (inputs.dry_run)
run: aws s3 sync ./builds "s3://${S3_BUCKET}" --dryrun
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
- name: Build and package Ruby runtime
run: bin/build_ruby "${{matrix.stack}}" "${{matrix.version}}"
- name: Verify ruby executable and output rubygems version
run: bin/print_gem_version "${{matrix.stack}}" "${{matrix.version}}"
run: bin/print_summary "${{matrix.stack}}" "${{matrix.version}}" >> $GITHUB_STEP_SUMMARY

integration_test-heroku-24-amd:
runs-on: pub-hk-ubuntu-22.04-xlarge
Expand All @@ -65,7 +65,7 @@ jobs:
- name: Build and package Ruby runtime
run: bin/build_ruby "${{matrix.stack}}" "${{matrix.version}}"
- name: Verify ruby executable and output rubygems version
run: bin/print_gem_version "${{matrix.stack}}" "${{matrix.version}}" amd64
run: bin/print_summary "${{matrix.stack}}" "${{matrix.version}}" amd64 >> $GITHUB_STEP_SUMMARY

integration_test-heroku-24-arm:
runs-on: pub-hk-ubuntu-22.04-arm-large
Expand All @@ -92,4 +92,4 @@ jobs:
- name: Build and package Ruby runtime
run: bin/build_ruby "${{matrix.stack}}" "${{matrix.version}}"
- name: Verify ruby executable and output rubygems version
run: bin/print_gem_version "${{matrix.stack}}" "${{matrix.version}}" arm64
run: bin/print_summary "${{matrix.stack}}" "${{matrix.version}}" arm64 >> $GITHUB_STEP_SUMMARY
12 changes: 8 additions & 4 deletions bin/print_gem_version → bin/print_summary
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,18 @@ then
exit 1
fi

echo "Printing gem version for Ruby $VERSION on $BASE_IMAGE"
echo "## Printing gem version for Ruby $VERSION on $BASE_IMAGE"
echo

if [ -z "$ARCH" ]; then
echo "ARCH is not set"
echo "- No ARCH requested"
ruby_tar_file="$BASE_IMAGE/ruby-$VERSION.tgz"
else
echo "Using arch '$ARCH'"
echo "- Requested ARCH '$ARCH'"
ruby_tar_file="$BASE_IMAGE/$ARCH/ruby-$VERSION.tgz"
fi

docker run -v $(pwd)/builds:/tmp/output hone/ruby-builder:$BASE_IMAGE bash -c "mkdir /tmp/unzipped && tar xzf /tmp/output/$ruby_tar_file -C /tmp/unzipped && echo 'Rubygems version is: ' && /tmp/unzipped/bin/gem -v"
docker run -v $(pwd)/builds:/tmp/output hone/ruby-builder:$BASE_IMAGE \
bash -c "mkdir /tmp/unzipped && tar xzf /tmp/output/$ruby_tar_file -C /tmp/unzipped && \
echo -n '- Rubygems version: ' && /tmp/unzipped/bin/gem -v && \
echo -n '- Ruby version: ' && /tmp/unzipped/bin/ruby -v"

0 comments on commit 68005ab

Please sign in to comment.