Merge pull request #761 from heroku/2024-10-updates #481
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
name: CI | |
on: | |
push: | |
branches: | |
- "main" | |
pull_request: | |
workflow_dispatch: | |
permissions: | |
contents: read | |
env: | |
src_path_suffix: "-develop/" | |
HEROKU_DISABLE_AUTOUPDATE: 1 | |
HATCHET_RETRIES: 3 | |
IS_RUNNING_ON_CI: true | |
HATCHET_APP_LIMIT: 300 | |
HATCHET_APP_PREFIX: ${{ format('htcht-{0}-', github.run_id) }} | |
HATCHET_EXPENSIVE_MODE: 1 | |
HATCHET_BUILDPACK_BASE: https://github.com/heroku/heroku-buildpack-php | |
HATCHET_BUILDPACK_BRANCH: ${{ github.head_ref || github.ref_name }} | |
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }} | |
HEROKU_API_USER: ${{ secrets.HEROKU_API_USER }} | |
S5CMD_VERSION: 2.2.2 | |
S5CMD_HASH: "392c385320cd5ffa435759a95af77c215553d967e4b1c0fffe52e4f14c29cf85 s5cmd_2.2.2_linux_amd64.deb" | |
jobs: | |
integration-test: | |
runs-on: ubuntu-24.04 | |
strategy: | |
matrix: | |
stack: ["heroku-20", "heroku-22", "heroku-24"] | |
env: | |
STACK: ${{ matrix.stack }} | |
BLACKFIRE_CLIENT_ID: ${{ secrets.BLACKFIRE_CLIENT_ID }} | |
BLACKFIRE_CLIENT_TOKEN: ${{ secrets.BLACKFIRE_CLIENT_TOKEN }} | |
BLACKFIRE_SERVER_ID: ${{ secrets.BLACKFIRE_SERVER_ID }} | |
BLACKFIRE_SERVER_TOKEN: ${{ secrets.BLACKFIRE_SERVER_TOKEN }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install Ruby and Bundler | |
uses: ruby/setup-ruby@v1 | |
with: | |
bundler-cache: true | |
ruby-version: "3.2" | |
- name: Install PHP and Composer | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: "8.2" | |
tools: "composer:2.8" | |
- name: Install packages from requirements.txt, plus s5cmd (for some tests) | |
run: | | |
export VIRTUAL_ENV=$HOME/.venv | |
python3 -m venv "$VIRTUAL_ENV" | |
export PATH=$VIRTUAL_ENV/bin:$PATH | |
pip install -r requirements.txt | |
curl -sSLO https://github.com/peak/s5cmd/releases/download/v${S5CMD_VERSION}/s5cmd_${S5CMD_VERSION}_linux_amd64.deb | |
echo "$S5CMD_HASH" | shasum -c - | |
dpkg -x "s5cmd_${S5CMD_VERSION}_linux_amd64.deb" . | |
echo "$HOME/usr/bin:$VIRTUAL_ENV/bin" >> "$GITHUB_PATH" | |
- name: Hatchet setup | |
run: bundle exec hatchet ci:setup | |
- name: Export HEROKU_PHP_PLATFORM_REPOSITORIES to …${{env.src_path_suffix}} (since we are not building main or a tag) | |
if: github.ref_type != 'tag' && github.ref_name != 'main' | |
run: | | |
if [[ $STACK != heroku-2[02] ]]; then STACK="${STACK}-amd64"; fi | |
echo "HEROKU_PHP_PLATFORM_REPOSITORIES=- https://lang-php.s3.us-east-1.amazonaws.com/dist-${STACK}${{env.src_path_suffix}}" >> "$GITHUB_ENV" | |
- name: Calculate number of parallel_rspec processes (half of num of lines in runtime log) | |
run: echo "PARALLEL_TEST_PROCESSORS=$(( ($(cat test/var/log/parallel_runtime_rspec.${STACK}.log | wc -l)+2-1)/2 ))" >> "$GITHUB_ENV" | |
- name: Execute tests | |
run: bundle exec parallel_rspec --group-by runtime --first-is-1 --unknown-runtime 1 --allowed-missing 100 --runtime-log "test/var/log/parallel_runtime_rspec.${STACK}.log" --verbose-command --combine-stderr --prefix-output-with-test-env-number test/spec/ | |
- name: Print list of executed examples | |
run: cat test/var/log/group.*.json | jq -r --slurp '[.[].examples[]] | sort_by(.id) | flatten[] | .full_description' | |
- name: Print parallel_runtime_rspec.log | |
run: cat test/var/log/parallel_runtime_rspec.log | grep -E '^test/spec/[a-z0-9_/\.-]+\.rb:[0-9]+\.[0-9]+$' | sort |