-
Notifications
You must be signed in to change notification settings - Fork 338
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cc3d9bd
commit ec971a4
Showing
12 changed files
with
1,714 additions
and
62 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: ["main"] | ||
pull_request: | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
functional-test: | ||
runs-on: ubuntu-22.04 | ||
container: | ||
image: heroku/heroku:${{ matrix.stack_number }}-build | ||
strategy: | ||
matrix: | ||
stack_number: ["20", "22"] | ||
env: | ||
STACK: heroku-${{ matrix.stack_number }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Functional tests on heroku:${{ matrix.stack_number }}-build | ||
run: test/run |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
test: heroku-22-build heroku-20-build | ||
|
||
heroku-22-build: | ||
@echo "Running tests in docker (heroku-22-build)..." | ||
@docker run -v $(shell pwd):/buildpack:ro --rm -it -e "STACK=heroku-22" heroku/heroku:22-build bash -c 'cp -r /buildpack /buildpack_test; cd /buildpack_test/; test/run;' | ||
@echo "" | ||
|
||
heroku-20-build: | ||
@echo "Running tests in docker (heroku-20-build)..." | ||
@docker run -v $(shell pwd):/buildpack:ro --rm -it -e "STACK=heroku-20" heroku/heroku:20-build bash -c 'cp -r /buildpack /buildpack_test; cd /buildpack_test/; test/run;' | ||
@echo "" |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.focal_amd64.deb |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-2/wkhtmltox_0.12.6.1-2.jammy_amd64.deb |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
:repo:deb http://us.archive.ubuntu.com/ubuntu/ focal multiverse | ||
fasttracker2 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
:repo:deb http://us.archive.ubuntu.com/ubuntu/ jammy multiverse | ||
fasttracker2 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# single package | ||
xmlsec1 | ||
|
||
# globbed package | ||
mysql-client-* |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
#!/usr/bin/env bash | ||
|
||
testCompilePackageNames() { | ||
compile "package-names" | ||
assertCaptured "Updating apt caches" | ||
assertCaptured "Fetching .debs for xmlsec1" | ||
assertCaptured "Fetching .debs for mysql-client-*" | ||
assertCaptured "Installing xmlsec1" | ||
assertCaptured "Installing mysql-client" | ||
assertCaptured "Installing mysql-client-core" | ||
assertCaptured "Writing profile script" | ||
assertCaptured "Rewrite package-config files" | ||
} | ||
|
||
testReportPackageNames() { | ||
report "package-names" | ||
assertCaptured "packages: \"mysql-client-*,xmlsec1\"" | ||
assertNotCaptured "custom_packages" | ||
assertNotCaptured "custom_repositories" | ||
assertCapturedSuccess | ||
} | ||
|
||
testCompileCustomPackageUrl() { | ||
declare -A download_urls=( | ||
[heroku-20]="https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.focal_amd64.deb" | ||
[heroku-22]="https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-2/wkhtmltox_0.12.6.1-2.jammy_amd64.deb" | ||
) | ||
compile "custom-package-url-$STACK" | ||
assertCaptured "Updating apt caches" | ||
assertCaptured "Fetching ${download_urls[$STACK]}" | ||
assertCaptured "Installing wkhtmltox" | ||
assertCaptured "Writing profile script" | ||
assertCaptured "Rewrite package-config files" | ||
} | ||
|
||
testReportCustomPackageUrl() { | ||
declare -A download_urls=( | ||
[heroku-20]="https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.focal_amd64.deb" | ||
[heroku-22]="https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-2/wkhtmltox_0.12.6.1-2.jammy_amd64.deb" | ||
) | ||
report "custom-package-url-$STACK" | ||
assertNotCaptured "^packages" | ||
assertCaptured "custom_packages: \"${download_urls[$STACK]}\"" | ||
assertNotCaptured "custom_repositories" | ||
} | ||
|
||
testCompileCustomRepository() { | ||
declare -A ubuntu_release_names=( | ||
[heroku-20]="focal" | ||
[heroku-22]="jammy" | ||
) | ||
compile "custom-repository-$STACK" | ||
assertCaptured "Adding custom repositories" | ||
assertCaptured "Updating apt caches" | ||
assertCaptured "http://us.archive.ubuntu.com/ubuntu ${ubuntu_release_names[$STACK]}/multiverse amd64 Packages" | ||
assertCaptured "Fetching .debs for fasttracker2" | ||
assertCaptured "Installing fasttracker2" | ||
assertCaptured "Writing profile script" | ||
assertCaptured "Rewrite package-config files" | ||
} | ||
|
||
testReportCustomRepository() { | ||
declare -A ubuntu_release_names=( | ||
[heroku-20]="focal" | ||
[heroku-22]="jammy" | ||
) | ||
report "custom-repository-$STACK" | ||
assertCaptured "packages: \"fasttracker2\"" | ||
assertNotCaptured "custom_packages" | ||
assertCaptured "custom_repositories: \"deb http://us.archive.ubuntu.com/ubuntu/ ${ubuntu_release_names[$STACK]} multiverse\"" | ||
} | ||
|
||
pushd "$(dirname 0)" >/dev/null || exit 1 | ||
popd >/dev/null || exit 1 | ||
|
||
source "$(pwd)"/test/utils | ||
|
||
compile() { | ||
default_process_types_cleanup | ||
bp_dir=$(mktmpdir) | ||
compile_dir=$(mktmpdir) | ||
cp -a "$(pwd)"/* "${bp_dir}" | ||
cp -a "${bp_dir}"/test/fixtures/"$1"/. "${compile_dir}" | ||
capture "${bp_dir}"/bin/compile "${compile_dir}" "${2:-$(mktmpdir)}" "$3" | ||
} | ||
|
||
report() { | ||
default_process_types_cleanup | ||
compile_dir=${1:-$(mktmpdir)} | ||
cache_dir=${2:-$(mktmpdir)} | ||
env_dir=${3:-$(mktmpdir)} | ||
bp_dir=$(mktmpdir) | ||
cp -a "$(pwd)"/* "${bp_dir}" | ||
cp -a "${bp_dir}"/test/fixtures/"$1"/. "${compile_dir}" | ||
capture "${bp_dir}"/bin/report "${compile_dir}" "${cache_dir}" "${env_dir}" | ||
} | ||
|
||
mktmpdir() { | ||
dir=$(mktemp -t testXXXXX) | ||
rm -rf "$dir" | ||
mkdir "$dir" | ||
echo "$dir" | ||
} | ||
|
||
default_process_types_cleanup() { | ||
file="/tmp/default_process_types" | ||
if [ -f "$file" ]; then | ||
rm "$file" | ||
fi | ||
} | ||
|
||
source "$(pwd)"/test/shunit2 |
Oops, something went wrong.