Skip to content

Commit

Permalink
Use pack build --force-color in CI instead of script TTY workarou…
Browse files Browse the repository at this point in the history
…nd (#255)

As of Pack 0.33.0 (which this repo is using thanks to #462), there is a
new `--force-color` argument that makes `pack build` output logs
in colour even if a TTY wasn't detected (as is the case on GHA):
https://github.com/buildpacks/pack/releases/tag/v0.33.0

This makes the `script -e -c` TTY workarounds in CI unnecessary.

I've also:
 - removed a redundant `cargo build` step (run does a build, and
   the Cargo compilation output can be suppressed using `--quiet`)
- replaced a manual git clone with `actions/checkout`, since it
  handles things like retries, faster shallow clones etc.

GUS-W-14968745.
  • Loading branch information
edmorley authored Feb 7, 2024
1 parent f50325d commit dda4ede
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,22 +74,23 @@ jobs:
uses: Swatinem/[email protected]
- name: Install Pack CLI
uses: buildpacks/github-actions/[email protected]
- name: Pull builder image
- name: Pull builder and run images
run: |
docker pull "heroku/builder:22"
docker pull "heroku/heroku:22-cnb"
- name: Clone ruby getting started guide
run: mkdir tmp; git clone https://github.com/heroku/ruby-getting-started tmp/ruby-getting-started
uses: actions/checkout@v4
with:
repository: heroku/ruby-getting-started
path: tmp/ruby-getting-started
- name: Install libcnb-cargo for `cargo libcnb package` command
run: cargo install libcnb-cargo
- name: Compile ruby buildpack
run: cargo libcnb package
- name: "PRINT: Getting started guide output"
run: | # Use `script -e -c` to pretend to be a TTY for pack terminal color support
script -e -c "pack build my-image --builder heroku/builder:22 --buildpack heroku/nodejs-engine --buildpack packaged/x86_64-unknown-linux-musl/debug/heroku_ruby --path tmp/ruby-getting-started --pull-policy never"
run: pack build my-image --force-color --builder heroku/builder:22 --buildpack heroku/nodejs-engine --buildpack packaged/x86_64-unknown-linux-musl/debug/heroku_ruby --path tmp/ruby-getting-started --pull-policy never
- name: "PRINT: Cached getting started guide output"
run: | # Use `script -e -c` to pretend to be a TTY for pack terminal color support
script -e -c "pack build my-image --builder heroku/builder:22 --buildpack heroku/nodejs-engine --buildpack packaged/x86_64-unknown-linux-musl/debug/heroku_ruby --path tmp/ruby-getting-started --pull-policy never"
run: pack build my-image --force-color --builder heroku/builder:22 --buildpack heroku/nodejs-engine --buildpack packaged/x86_64-unknown-linux-musl/debug/heroku_ruby --path tmp/ruby-getting-started --pull-policy never

print-style-guide:
runs-on: ubuntu-22.04
Expand All @@ -104,8 +105,5 @@ jobs:
run: rustup target add x86_64-unknown-linux-musl
- name: Rust Cache
uses: Swatinem/[email protected]
- name: Build binary
run: cargo build --bin print_style_guide
- name: "PRINT: Style guide"
run: | # Use `script -e -c` to pretend to be a TTY for pack terminal color support
script -e -c "cargo run --bin print_style_guide"
run: cargo run --quiet --bin print_style_guide

0 comments on commit dda4ede

Please sign in to comment.