feat(tests): organize workflows, add system tests #2
Workflow file for this 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
on: | |
pull_request: | |
types: [opened, synchronize, reopened, edited] | |
branches: ['main'] | |
jobs: | |
# More info at https://github.com/Roave/BackwardCompatibilityCheck. | |
backwards-compatibility-check: | |
name: Backwards Compatibility Check | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: "Install PHP" | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: "8.1" | |
- name: "Install dependencies" | |
run: composer global require "roave/backward-compatibility-check:^8.2" | |
- name: "Check for BC breaks" | |
if: github.event.pull_request.user.login != 'release-please[bot]' | |
# Ensure the build still passes by adding BREAKING_CHANGE_REASON=[reason] to the PR description. | |
continue-on-error: ${{ contains(github.event.pull_request.body, 'BREAKING_CHANGE_REASON=') }} | |
run: | | |
~/.composer/vendor/bin/roave-backward-compatibility-check --from=origin/main --format=github-actions | |
- name: "Check for BC label" | |
# Ensure the build still passes by adding BREAKING_CHANGE_REASON=[reason] to the PR description. | |
continue-on-error: ${{ contains(github.event.pull_request.body, 'BREAKING_CHANGE_REASON=') }} | |
run: | | |
if [[ "true" == "${{ contains(github.event.pull_request.title, '!:') }}" ]]; then | |
echo "Breaking change label found in PR title" | |
exit 1 | |
fi | |
- name: Get Latest Release | |
if: github.event.pull_request.user.login == 'release-please[bot]' | |
id: latest-release | |
uses: pozetroninc/github-action-get-latest-release@master | |
with: | |
repository: ${{ github.repository }} | |
- name: "Check for BC breaks (Next Release)" | |
if: github.event.pull_request.user.login == 'release-please[bot]' | |
# We've already approved and justified the breaking changes. Run the check but continue on error | |
continue-on-error: true | |
run: | | |
~/.composer/vendor/bin/roave-backward-compatibility-check \ | |
--from=${{ steps.latest-release.outputs.release }} \ | |
--to=origin/main --format=github-actions | |
# Ensure that PRs labeled "feat" actually contain a new feature | |
conventional-commit-check: | |
name: Conventional Commit Check | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: "Install PHP" | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: "8.1" | |
- name: "Install dependencies" | |
run: composer global require "roave/backward-compatibility-check:^8.2" | |
- name: "Check for an incorrect feat label in the PR" | |
id: compatibility-checker | |
if: ${{ github.event.pull_request.user.login == 'gcf-owl-bot[bot]' }} | |
continue-on-error: true | |
# OwlBot PRs which are not labelled feat should not add new files or methods | |
run: | | |
~/.composer/vendor/bin/roave-backward-compatibility-check --to=origin/main --format=github-actions | |
- name: "Print the action item" | |
run: | | |
if [[ "${{ steps.compatibility-checker.outcome }}" == 'failure' ]]; then | |
if [[ "${{ !startsWith(github.event.pull_request.title, 'feat') }}" ]]; then | |
echo "Action item: Change the conventional commit to use 'feat'" | |
exit 1 | |
fi | |
elif [[ "${{ !startsWith(github.event.pull_request.title, 'feat') }}" ]]; then | |
echo "Action item: No features found, do not use 'feat' for the conventional commit" | |
exit 1 | |
fi |