Skip to content

Commit f023f73

Browse files
committed
Merge branch 'sync-with-remote-repo' into 6465-add-multi-arch-support
2 parents dd25e88 + edfb800 commit f023f73

28 files changed

Lines changed: 1398 additions & 3112 deletions

.github/workflows/approve-bot-pr.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
download:
1111
name: Download PR Artifact
1212
if: ${{ github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success' }}
13-
runs-on: ubuntu-22.04
13+
runs-on: ubuntu-24.04
1414
outputs:
1515
pr-author: ${{ steps.pr-data.outputs.author }}
1616
pr-number: ${{ steps.pr-data.outputs.number }}
@@ -32,7 +32,7 @@ jobs:
3232
name: Approve Bot PRs
3333
needs: download
3434
if: ${{ needs.download.outputs.pr-author == 'paketo-bot' || needs.download.outputs.pr-author == 'dependabot[bot]' }}
35-
runs-on: ubuntu-22.04
35+
runs-on: ubuntu-24.04
3636
steps:
3737
- name: Check Commit Verification
3838
id: unverified-commits
@@ -52,7 +52,7 @@ jobs:
5252

5353
- name: Checkout
5454
if: steps.human-commits.outputs.human_commits == 'false' && steps.unverified-commits.outputs.unverified_commits == 'false'
55-
uses: actions/checkout@v3
55+
uses: actions/checkout@v5
5656

5757
- name: Approve
5858
if: steps.human-commits.outputs.human_commits == 'false' && steps.unverified-commits.outputs.unverified_commits == 'false'
Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
name: "CodeQL"
22

33
on:
4-
push:
5-
branches: [ main ]
64
pull_request:
75
branches: [ main ]
86
schedule:
9-
- cron: '34 5 * * *' # daily at 5:34am UTC
7+
- cron: '34 5 * * *' # daily at 5:34am UTC
108

119
jobs:
1210
analyze:
1311
name: Analyze
14-
runs-on: ubuntu-22.04
12+
runs-on: ubuntu-24.04
1513

1614
strategy:
1715
fail-fast: false
@@ -21,15 +19,15 @@ jobs:
2119

2220
steps:
2321
- name: Checkout repository
24-
uses: actions/checkout@v3
22+
uses: actions/checkout@v5
2523

2624
- name: Initialize CodeQL
27-
uses: github/codeql-action/init@v2
25+
uses: github/codeql-action/init@v4
2826
with:
2927
languages: ${{ matrix.language }}
3028

3129
- name: Autobuild
32-
uses: github/codeql-action/autobuild@v2
30+
uses: github/codeql-action/autobuild@v4
3331

3432
- name: Perform CodeQL Analysis
35-
uses: github/codeql-action/analyze@v2
33+
uses: github/codeql-action/analyze@v4
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
name: 'Compile Dependency on Target - Reusable Workflow'
2+
3+
description: |
4+
Compiles Dependency on given target, os, and arch
5+
6+
on:
7+
workflow_call:
8+
inputs:
9+
version:
10+
description: 'dependency version'
11+
required: true
12+
type: string
13+
target:
14+
description: 'dependency OS target variant'
15+
required: true
16+
type: string
17+
os:
18+
description: 'platform OS (e.g., linux)'
19+
required: true
20+
type: string
21+
arch:
22+
description: 'platform architecture (e.g., amd64)'
23+
required: true
24+
type: string
25+
shouldCompile:
26+
description: 'whether to compile the dependency'
27+
required: true
28+
type: boolean
29+
shouldTest:
30+
description: 'whether to test the dependency after compilation'
31+
required: true
32+
type: boolean
33+
uploadArtifactName:
34+
description: 'name of the artifact to upload'
35+
required: true
36+
type: string
37+
38+
jobs:
39+
compile:
40+
# Speed up compilation by using runners that match os and arch when they are set, otherwise fall back to emulation.
41+
runs-on: ${{ (inputs.os == 'linux' && inputs.arch == 'arm64') && 'ubuntu-24.04-arm' || 'ubuntu-24.04' }}
42+
43+
steps:
44+
- name: Check out code
45+
uses: actions/checkout@v5
46+
47+
- name: Enable experimental features for Docker daemon and CLI
48+
run: |
49+
echo '{"experimental": true}' | sudo tee /etc/docker/daemon.json
50+
sudo systemctl restart docker
51+
mkdir -p ~/.docker
52+
echo '{"experimental": "enabled"}' | sudo tee ~/.docker/config.json
53+
54+
- name: Set up QEMU
55+
uses: docker/setup-qemu-action@v3
56+
57+
- name: Set up Docker Buildx
58+
uses: docker/setup-buildx-action@v3
59+
60+
- name: Setup before compilation
61+
id: compile-setup
62+
run: |
63+
echo "outputdir=$(mktemp -d)" >> "$GITHUB_OUTPUT"
64+
65+
- name: docker build
66+
id: docker-build
67+
env:
68+
SKIP_LOGIN: true
69+
if: ${{ inputs.shouldCompile == true || inputs.shouldCompile == 'true' }}
70+
uses: actions-hub/docker/cli@master
71+
with:
72+
args: "build ${{ (inputs.os != '' && inputs.arch != '') && format('--platform {0}/{1}', inputs.os, inputs.arch) || '' }} -t compilation -f dependency/actions/compile/${{ inputs.target }}.Dockerfile dependency/actions/compile"
73+
74+
- name: docker run
75+
id: docker-run
76+
uses: actions-hub/docker/cli@master
77+
env:
78+
SKIP_LOGIN: true
79+
if: ${{ inputs.shouldCompile == true || inputs.shouldCompile == 'true' }}
80+
with:
81+
args: "run ${{ (inputs.os != '' && inputs.arch != '') && format('--platform {0}/{1}', inputs.os, inputs.arch) || '' }} -v ${{ steps.compile-setup.outputs.outputdir }}:/home compilation --outputDir /home --target ${{ inputs.target }} --version ${{ inputs.version }} ${{ inputs.os != '' && format('--os {0}', inputs.os) || '' }} ${{ inputs.arch != '' && format('--arch {0}', inputs.arch) || '' }}"
82+
83+
- name: Print contents of output dir
84+
shell: bash
85+
run: ls -lah ${{ steps.compile-setup.outputs.outputdir }}
86+
87+
- name: Test Dependency
88+
working-directory: dependency
89+
if: ${{ (inputs.shouldCompile == true || inputs.shouldCompile == 'true') && (inputs.shouldTest == true || inputs.shouldTest == 'true') }}
90+
run: |
91+
#!/usr/bin/env bash
92+
set -euo pipefail
93+
shopt -s inherit_errexit
94+
95+
make test \
96+
version="${{ inputs.version }}" \
97+
tarballPath="${{ steps.compile-setup.outputs.outputdir }}/*.tgz" \
98+
os="${{ inputs.os }}" \
99+
arch="${{ inputs.arch }}"
100+
101+
- name: Upload compiled artifact
102+
uses: actions/upload-artifact@v4
103+
if: ${{ inputs.shouldCompile == true || inputs.shouldCompile == 'true' }}
104+
with:
105+
name: '${{ inputs.uploadArtifactName }}'
106+
path: '${{ steps.compile-setup.outputs.outputdir }}/*'

.github/workflows/create-draft-release.yml

Lines changed: 99 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,16 @@ concurrency: release
1717
jobs:
1818
unit:
1919
name: Unit Tests
20-
runs-on: ubuntu-22.04
20+
runs-on: ubuntu-24.04
2121
outputs:
2222
builders: ${{ steps.builders.outputs.builders }}
2323
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v5
2426
- name: Setup Go
25-
uses: actions/setup-go@v3
27+
uses: actions/setup-go@v6
2628
with:
27-
go-version: 'stable'
28-
- name: Checkout
29-
uses: actions/checkout@v3
29+
go-version-file: go.mod
3030
- name: Run Unit Tests
3131
run: ./scripts/unit.sh
3232
- name: Get builders from integration.json
@@ -39,39 +39,45 @@ jobs:
3939
4040
integration:
4141
name: Integration Tests
42-
runs-on: ubuntu-22.04
42+
runs-on: ubuntu-24.04
4343
needs: unit
4444
strategy:
4545
matrix:
4646
builder: ${{ fromJSON(needs.unit.outputs.builders) }}
4747
fail-fast: false # don't cancel all test jobs when one fails
4848
steps:
49+
- name: Checkout
50+
uses: actions/checkout@v5
4951
- name: Setup Go
50-
uses: actions/setup-go@v3
52+
uses: actions/setup-go@v6
5153
with:
52-
go-version: 'stable'
53-
- name: Checkout
54-
uses: actions/checkout@v3
54+
go-version-file: go.mod
5555
- name: Run Integration Tests
5656
run: ./scripts/integration.sh --builder ${{ matrix.builder }} --token ${{ github.token }}
5757
env:
5858
TMPDIR: "${{ runner.temp }}"
5959

6060
release:
6161
name: Release
62-
runs-on: ubuntu-22.04
62+
runs-on: ubuntu-24.04
6363
needs: integration
64-
steps:
65-
- name: Setup Go
66-
uses: actions/setup-go@v3
67-
with:
68-
go-version: 'stable'
64+
services:
65+
registry:
66+
image: registry:3
67+
ports:
68+
- 5000:5000
6969

70+
steps:
7071
- name: Checkout
71-
uses: actions/checkout@v3
72+
uses: actions/checkout@v5
7273
with:
7374
fetch-tags: true
7475

76+
- name: Setup Go
77+
uses: actions/setup-go@v6
78+
with:
79+
go-version-file: go.mod
80+
7581
- name: Reset Draft Release
7682
id: reset
7783
uses: paketo-buildpacks/github-config/actions/release/reset-draft@main
@@ -110,13 +116,86 @@ jobs:
110116
echo "buildpack_type=buildpack" >> "$GITHUB_OUTPUT"
111117
fi
112118
119+
- name: Get buildpack path
120+
id: get_buildpack_path
121+
run: |
122+
123+
if [ -f "build/buildpackage.cnb" ]; then
124+
echo "path=build/buildpackage.cnb" >> "$GITHUB_OUTPUT"
125+
else
126+
echo "path=build/buildpackage-linux-amd64.cnb" >> "$GITHUB_OUTPUT"
127+
fi
128+
113129
- name: Create Release Notes
114130
id: create-release-notes
115131
uses: paketo-buildpacks/github-config/actions/release/notes@main
116132
with:
117133
repo: ${{ github.repository }}
118134
token: ${{ secrets.PAKETO_BOT_GITHUB_TOKEN }}
119135
buildpack_type: ${{ steps.get_buildpack_type.outputs.buildpack_type }}
136+
buildpackage_path: ${{ steps.get_buildpack_path.outputs.path }}
137+
138+
- name: Get Image Digest
139+
id: image_digest
140+
run: |
141+
image_name="localhost:5000/npm-install:latest"
142+
143+
./scripts/publish.sh \
144+
--buildpack-type ${{ steps.get_buildpack_type.outputs.buildpack_type }} \
145+
--image-ref $image_name
146+
147+
echo "digest=$(sudo skopeo inspect "docker://${image_name}" --tls-verify=false | jq -r .Digest)" >> "$GITHUB_OUTPUT"
148+
149+
- name: Set Correct Image Digest on the Release notes
150+
run: |
151+
printf '${{ steps.create-release-notes.outputs.release_body }}' \
152+
| sed -E \
153+
"s/\*\*Digest:\*\* \`sha256:[a-f0-9]{64}\`/\*\*Digest:\*\* \`${{ steps.image_digest.outputs.digest }}\`/" \
154+
> ./release_notes
155+
156+
printf '${{ steps.image_digest.outputs.digest }}' > ./index-digest.sha256
157+
158+
- name: Create release assets
159+
id: create_release_assets
160+
run: |
161+
release_assets=$(jq -n --arg repo_name "${{ github.event.repository.name }}" --arg tag "${{ steps.tag.outputs.tag }}" '
162+
[
163+
{
164+
"path": "build/buildpack.tgz",
165+
"name": ($repo_name + "-" + $tag + ".tgz"),
166+
"content_type": "application/gzip"
167+
},
168+
{
169+
"path": "./index-digest.sha256",
170+
"name": ($repo_name + "-" + $tag + "-" + "index-digest.sha256"),
171+
"content_type": "text/plain"
172+
}
173+
]')
174+
175+
for filepath in build/*.cnb; do
176+
filename=$(basename "$filepath")
177+
asset_name=""
178+
if [[ "$filename" == "buildpackage-linux-amd64.cnb" ]]; then
179+
asset_name="${{ github.event.repository.name }}-${{ steps.tag.outputs.tag }}.cnb"
180+
elif [[ "$filename" == "buildpackage.cnb" ]]; then
181+
asset_name="${{ github.event.repository.name }}-${{ steps.tag.outputs.tag }}.cnb"
182+
else
183+
formatted_filename="${filename#buildpackage-}"
184+
asset_name="${{ github.event.repository.name }}-${{ steps.tag.outputs.tag }}-${formatted_filename}"
185+
fi
186+
187+
release_assets=$(echo "$release_assets" | jq --arg asset_name "${asset_name}" --arg filepath "$filepath" '
188+
. + [
189+
{
190+
"path": $filepath,
191+
"name": $asset_name,
192+
"content_type": "application/gzip"
193+
}
194+
]')
195+
done
196+
197+
release_assets=$(jq -c <<< "$release_assets" )
198+
printf "release_assets=%s\n" "${release_assets}" >> "$GITHUB_OUTPUT"
120199
121200
- name: Create Release
122201
uses: paketo-buildpacks/github-config/actions/release/create@main
@@ -126,25 +205,13 @@ jobs:
126205
tag_name: v${{ steps.tag.outputs.tag }}
127206
target_commitish: ${{ github.sha }}
128207
name: v${{ steps.tag.outputs.tag }}
129-
body: ${{ steps.create-release-notes.outputs.release_body }}
208+
body_filepath: "./release_notes"
130209
draft: true
131-
assets: |
132-
[
133-
{
134-
"path": "build/buildpack.tgz",
135-
"name": "${{ github.event.repository.name }}-${{ steps.tag.outputs.tag }}.tgz",
136-
"content_type": "application/gzip"
137-
},
138-
{
139-
"path": "build/buildpackage.cnb",
140-
"name": "${{ github.event.repository.name }}-${{ steps.tag.outputs.tag }}.cnb",
141-
"content_type": "application/gzip"
142-
}
143-
]
210+
assets: ${{ steps.create_release_assets.outputs.release_assets }}
144211

145212
failure:
146213
name: Alert on Failure
147-
runs-on: ubuntu-22.04
214+
runs-on: ubuntu-24.04
148215
needs: [ unit, integration, release ]
149216
if: ${{ always() && needs.unit.result == 'failure' || needs.integration.result == 'failure' || needs.release.result == 'failure' }}
150217
steps:

.github/workflows/label-pr.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ concurrency: pr_labels_${{ github.event.number }}
1515
jobs:
1616
autolabel:
1717
name: Ensure Minimal Semver Labels
18-
runs-on: ubuntu-22.04
18+
runs-on: ubuntu-24.04
1919
steps:
2020
- name: Check Minimal Semver Labels
21-
uses: mheap/github-action-required-labels@v3
21+
uses: mheap/github-action-required-labels@v5
2222
with:
2323
count: 1
2424
labels: semver:major, semver:minor, semver:patch

0 commit comments

Comments
 (0)