Skip to content

Commit a963d8c

Browse files
authored
Merge pull request #722 from heroku/heroku-24
Heroku-24 support
2 parents 2a45259 + d6b78fa commit a963d8c

33 files changed

+213
-46
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
runs-on: ubuntu-22.04
3030
strategy:
3131
matrix:
32-
stack: ["heroku-20", "heroku-22"]
32+
stack: ["heroku-20", "heroku-22", "heroku-24"]
3333
env:
3434
STACK: ${{ matrix.stack }}
3535
BLACKFIRE_CLIENT_ID: ${{ secrets.BLACKFIRE_CLIENT_ID }}
@@ -61,6 +61,7 @@ jobs:
6161
- name: Export HEROKU_PHP_PLATFORM_REPOSITORIES to …-develop (since we are not building main or a tag)
6262
if: github.ref_type != 'tag' && github.ref_name != 'main'
6363
run: |
64+
if [[ $STACK != heroku-2[02] ]]; then STACK="${STACK}-amd64"; fi
6465
echo "HEROKU_PHP_PLATFORM_REPOSITORIES=- https://lang-php.s3.us-east-1.amazonaws.com/dist-${STACK}-develop/" >> "$GITHUB_ENV"
6566
- name: Calculate number of parallel_rspec processes (half of num of lines in runtime log)
6667
run: echo "PARALLEL_TEST_PROCESSORS=$(( ($(cat test/var/log/parallel_runtime_rspec.${STACK}.log | wc -l)+2-1)/2 ))" >> "$GITHUB_ENV"

.github/workflows/platform-build.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ on:
1414
options:
1515
- heroku-20
1616
- heroku-22
17+
- heroku-24-amd64
18+
- heroku-24-arm64
1719
required: true
1820
dry-run:
1921
description: 'Build packages without deploying to S3 (e.g. for testing a formula)'
@@ -62,7 +64,7 @@ jobs:
6264
ls -f ${{inputs.formulae}} | xargs -n 1 echo - >> "$GITHUB_STEP_SUMMARY"
6365
ls -f ${{inputs.formulae}} | jq -jcRn '[inputs|select(length>0)]' >> "$GITHUB_OUTPUT"
6466
docker-build:
65-
runs-on: ubuntu-22.04
67+
runs-on: ${{ endsWith(inputs.stack, '-arm64') && 'pub-hk-ubuntu-22.04-arm-small' || 'ubuntu-22.04' }}
6668
steps:
6769
- name: Checkout
6870
uses: actions/checkout@v4
@@ -74,14 +76,18 @@ jobs:
7476
path: /tmp/docker-cache.tar.gz
7577
- name: Build Docker image
7678
if: steps.cache-docker.outputs.cache-hit != 'true'
77-
run: docker build --tag heroku-php-build-${{inputs.stack}}:${{github.sha}} --file support/build/_docker/${{inputs.stack}}.Dockerfile .
79+
# our "input" stack might contain a "-amd64" or "-arm64" suffix, which we strip off for the Dockerfile name
80+
run: |
81+
shopt -s extglob
82+
stackname_with_architecture=${{inputs.stack}}
83+
docker build --tag heroku-php-build-${stackname_with_architecture}:${{github.sha}} --file support/build/_docker/${stackname_with_architecture%-?(amd|arm)64}.Dockerfile .
7884
- name: Save built Docker image
7985
if: steps.cache-docker.outputs.cache-hit != 'true'
8086
run: docker save heroku-php-build-${{inputs.stack}}:${{github.sha}} | gzip -1 > /tmp/docker-cache.tar.gz
8187
deploys:
8288
needs: [formulae-list, docker-build]
8389
if: ${{ needs.formulae-list.outputs.formulae != '[]' && needs.formulae-list.outputs.formulae != '' }}
84-
runs-on: pub-hk-ubuntu-22.04-medium
90+
runs-on: ${{ endsWith(inputs.stack, '-arm64') && 'pub-hk-ubuntu-22.04-arm-xlarge' || 'pub-hk-ubuntu-22.04-xlarge' }}
8591
strategy:
8692
max-parallel: ${{ fromJSON(inputs.concurrency) }}
8793
matrix:
@@ -111,7 +117,7 @@ jobs:
111117
mkrepo:
112118
needs: [deploys]
113119
if: ${{ inputs.dry-run == false && inputs.publish == true }}
114-
runs-on: ubuntu-22.04
120+
runs-on: ${{ endsWith(inputs.stack, '-arm64') && 'pub-hk-ubuntu-22.04-arm-small' || 'ubuntu-22.04' }}
115121
env:
116122
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
117123
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

.github/workflows/platform-remove.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ on:
1414
options:
1515
- heroku-20
1616
- heroku-22
17+
- heroku-24-amd64
18+
- heroku-24-arm64
1719
required: true
1820
dry-run:
1921
description: 'Only list package removals, without executing'
@@ -26,7 +28,7 @@ permissions:
2628

2729
jobs:
2830
remove:
29-
runs-on: ubuntu-22.04
31+
runs-on: ${{ endsWith(inputs.stack, 'arm64') && 'pub-hk-ubuntu-22.04-arm-small' || 'ubuntu-22.04' }}
3032
env:
3133
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
3234
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
@@ -49,7 +51,11 @@ jobs:
4951
run: docker load -i /tmp/docker-cache.tar.gz
5052
- name: Build Docker image
5153
if: steps.restore-docker.outputs.cache-hit != 'true'
52-
run: docker build --tag heroku-php-build-${{inputs.stack}}:${{github.sha}} --file support/build/_docker/${{inputs.stack}}.Dockerfile .
54+
# our "input" stack might contain a "-amd64" or "-arm64" suffix, which we strip off for the Dockerfile name
55+
run: |
56+
shopt -s extglob
57+
stackname_with_architecture=${{inputs.stack}}
58+
docker build --tag heroku-php-build-${stackname_with_architecture}:${{github.sha}} --file support/build/_docker/${stackname_with_architecture%-?(amd|arm)64}.Dockerfile .
5359
- name: Save built Docker image
5460
if: steps.restore-docker.outputs.cache-hit != 'true'
5561
run: docker save heroku-php-build-${{inputs.stack}}:${{github.sha}} | gzip -1 > /tmp/docker-cache.tar.gz

.github/workflows/platform-sync.yml

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Platform packages sync from -develop/ to -stable/
22
run-name: Sync${{ inputs.dry-run == true && ' dry-run' || '' }} from dist-$STACK-develop/ to dist-$STACK-stable/
33

44
env:
5-
stacks_list_for_shell_expansion: "{heroku-20,heroku-22}"
5+
stacks_list_for_shell_expansion: "{heroku-20,heroku-22,heroku-24-amd64,heroku-24-arm64}"
66

77
on:
88
workflow_dispatch:
@@ -17,6 +17,16 @@ on:
1717
type: boolean
1818
default: true
1919
required: false
20+
stack-heroku-24-amd64:
21+
description: 'Sync heroku-24 (amd64) packages'
22+
type: boolean
23+
default: true
24+
required: false
25+
stack-heroku-24-arm64:
26+
description: 'Sync heroku-24 (arm64) packages'
27+
type: boolean
28+
default: true
29+
required: false
2030
dry-run:
2131
description: 'Only list package changes, without syncing'
2232
type: boolean
@@ -37,14 +47,14 @@ jobs:
3747
run: |
3848
echo '## Stacks to sync' >> "$GITHUB_STEP_SUMMARY"
3949
set -o pipefail
40-
stacks=(${{ inputs.stack-heroku-20 == true && 'heroku-20' || ''}} ${{ inputs.stack-heroku-22 == true && 'heroku-22' || ''}})
50+
stacks=(${{ inputs.stack-heroku-20 == true && 'heroku-20' || ''}} ${{ inputs.stack-heroku-22 == true && 'heroku-22' || ''}} ${{ inputs.stack-heroku-24-amd64 == true && 'heroku-24-amd64' || ''}} ${{ inputs.stack-heroku-24-arm64 == true && 'heroku-24-arm64' || ''}})
4151
printf -- "- %s\n" "${stacks[@]}" >> "$GITHUB_STEP_SUMMARY"
4252
echo -n "matrix=" >> "$GITHUB_OUTPUT"
4353
printf "%s\n" "${stacks[@]}" | jq -jcRn '[inputs|select(length>0)]' >> "$GITHUB_OUTPUT"
4454
docker-build:
4555
needs: stack-list
4656
if: ${{ needs.stack-list.outputs.stacks != '[]' && needs.stack-list.outputs.stacks != '' }}
47-
runs-on: ubuntu-22.04
57+
runs-on: ${{ endsWith(matrix.stack, '-arm64') && 'pub-hk-ubuntu-22.04-arm-small' || 'ubuntu-22.04' }}
4858
strategy:
4959
matrix:
5060
stack: ${{ fromJSON(needs.stack-list.outputs.stacks) }}
@@ -62,7 +72,11 @@ jobs:
6272
run: docker load -i /tmp/docker-cache.tar.gz
6373
- name: Build Docker image
6474
if: steps.restore-docker.outputs.cache-hit != 'true'
65-
run: docker build --tag heroku-php-build-${{matrix.stack}}:${{github.sha}} --file support/build/_docker/${{matrix.stack}}.Dockerfile .
75+
# our "input" stack might contain a "-amd64" or "-arm64" suffix, which we strip off for the Dockerfile name
76+
run: |
77+
shopt -s extglob
78+
stackname_with_architecture=${{matrix.stack}}
79+
docker build --tag heroku-php-build-${stackname_with_architecture}:${{github.sha}} --file support/build/_docker/${stackname_with_architecture%-?(amd|arm)64}.Dockerfile .
6680
- name: Save built Docker image
6781
if: steps.restore-docker.outputs.cache-hit != 'true'
6882
run: docker save heroku-php-build-${{matrix.stack}}:${{github.sha}} | gzip -1 > /tmp/docker-cache.tar.gz
@@ -74,10 +88,10 @@ jobs:
7488
path: /tmp/docker-cache.tar.gz
7589
sync:
7690
needs: [stack-list, docker-build]
77-
runs-on: ubuntu-22.04
7891
strategy:
7992
matrix:
8093
stack: ${{ fromJSON(needs.stack-list.outputs.stacks) }}
94+
runs-on: ${{ endsWith(matrix.stack, '-arm64') && 'pub-hk-ubuntu-22.04-arm-small' || 'ubuntu-22.04' }}
8195
env:
8296
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
8397
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22

33
## [Unreleased]
44

5+
### ADD
6+
7+
- Support heroku-24 [David Zuelke]
8+
- Build arm64 binaries for heroku-24+ [David Zuelke]
9+
10+
### CHG
11+
12+
- Use PHP 8.3 for bootstrapping [David Zuelke]
13+
- librdkafka/2.4.0 (for heroku-24+ only) [David Zuelke]
514

615
## [v251] - 2024-05-30
716

bin/compile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,12 @@ mkdir -p $COMPOSER_HOME
226226

227227
status "Bootstrapping..."
228228

229-
s3_url="https://lang-php.s3.us-east-1.amazonaws.com/dist-${STACK}-stable/"
229+
if [[ $STACK == heroku-2[02] ]]; then
230+
stack_locator=$STACK
231+
else
232+
stack_locator="${STACK}-$(dpkg --print-architecture)"
233+
fi
234+
s3_url="https://lang-php.s3.us-east-1.amazonaws.com/dist-${stack_locator}-stable/"
230235
# prepend the default repo to the list configured by the user
231236
# list of repositories to use is in ascening order of precedence
232237
export_env_dir "$env_dir" '^HEROKU_PHP_PLATFORM_REPOSITORIES$'
@@ -245,7 +250,7 @@ fi
245250
mkdir -p $build_dir/.heroku/php-min
246251
ln -s $build_dir/.heroku/php-min /app/.heroku/php-min
247252

248-
curl_retry_on_18 --retry-connrefused --retry 3 --connect-timeout 10 --fail --silent --location -o $build_dir/.heroku/php-min.tar.gz "${s3_url}php-min-8.1.28.tar.gz" || {
253+
curl_retry_on_18 --retry-connrefused --retry 3 --connect-timeout 10 --fail --silent --location -o $build_dir/.heroku/php-min.tar.gz "${s3_url}php-min-8.3.7.tar.gz" || {
249254
mcount "failures.bootstrap.download.php-min"
250255
error <<-EOF
251256
Failed to download minimal PHP for bootstrapping!

support/build/_docker/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
**After every change to your formulae, perform the following** from the root of the Git repository (not from `support/build/_docker/`) to rebuild the images for each stack:
66

7+
$ docker build --pull --tag heroku-php-build-heroku-24-amd64 --platform linux/amd64 --file $(pwd)/support/build/_docker/heroku-24.Dockerfile .
8+
$ docker build --pull --tag heroku-php-build-heroku-24-arm64 --platform linux/arm64 --file $(pwd)/support/build/_docker/heroku-24.Dockerfile .
79
$ docker build --pull --tag heroku-php-build-heroku-22 --file $(pwd)/support/build/_docker/heroku-22.Dockerfile .
810
$ docker build --pull --tag heroku-php-build-heroku-20 --file $(pwd)/support/build/_docker/heroku-20.Dockerfile .
911

@@ -17,6 +19,8 @@ Out of the box, each `Dockerfile` has the correct values predefined for `S3_BUCK
1719

1820
From the root of the Git repository (not from `support/build/_docker/`), you can e.g. `bash` into each of the images you built using their tag:
1921

22+
docker run --rm -ti heroku-php-build-heroku-24-amd64 bash
23+
docker run --rm -ti heroku-php-build-heroku-24-arm64 bash
2024
docker run --rm -ti heroku-php-build-heroku-22 bash
2125
docker run --rm -ti heroku-php-build-heroku-20 bash
2226

support/build/_docker/heroku-20.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM heroku/heroku:20-build.v84
1+
FROM heroku/heroku:20-build.v127
22

33
ARG TARGETARCH
44

support/build/_docker/heroku-22.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM heroku/heroku:22-build.v84
1+
FROM heroku/heroku:22-build.v127
22

33
ARG TARGETARCH
44

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
FROM heroku/heroku:24-build.v127
2+
3+
ARG TARGETARCH
4+
5+
USER root
6+
7+
WORKDIR /app
8+
ENV WORKSPACE_DIR=/app/support/build
9+
ENV S3_BUCKET=lang-php
10+
ENV S3_PREFIX=dist-heroku-24-${TARGETARCH}-develop/
11+
ENV S3_REGION=us-east-1
12+
ENV STACK=heroku-24
13+
ENV DEBIAN_FRONTEND=noninteractive
14+
15+
RUN apt-get update && apt-get install -y python3-pip python3-venv
16+
17+
ENV VIRTUAL_ENV=/app/.venv
18+
RUN python3 -m venv "$VIRTUAL_ENV"
19+
20+
ENV PATH="/app/support/build/_util:$VIRTUAL_ENV/bin:$PATH"
21+
22+
COPY requirements.txt /app/requirements.txt
23+
24+
RUN pip install wheel
25+
RUN pip install -r /app/requirements.txt
26+
27+
ARG S5CMD_VERSION=2.2.2
28+
RUN curl -sSLO https://github.com/peak/s5cmd/releases/download/v${S5CMD_VERSION}/s5cmd_${S5CMD_VERSION}_linux_${TARGETARCH}.deb
29+
# copy/paste relevant shasums from s5cmd_checksums.txt in the release, remember to preserve the "\\n\" at the end of each line
30+
RUN printf "\
31+
392c385320cd5ffa435759a95af77c215553d967e4b1c0fffe52e4f14c29cf85 s5cmd_${S5CMD_VERSION}_linux_amd64.deb\\n\
32+
939bee3cf4b5604ddb00e67f8c157b91d7c7a5b553d1fbb6890fad32894b7b46 s5cmd_${S5CMD_VERSION}_linux_arm64.deb\\n\
33+
" | shasum -c - --ignore-missing
34+
35+
RUN dpkg -i s5cmd_${S5CMD_VERSION}_linux_${TARGETARCH}.deb
36+
37+
COPY . /app

0 commit comments

Comments
 (0)