Skip to content

Instantly share code, notes, and snippets.

@weierophinney
Last active April 24, 2021 15:14
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save weierophinney/b003e50c3c2667d08076caf31ebd36a4 to your computer and use it in GitHub Desktop.
Save weierophinney/b003e50c3c2667d08076caf31ebd36a4 to your computer and use it in GitHub Desktop.
How to prepare a PR to add the GHA CI workflow to Laminas/Mezzio/Laminas API Tools repos

PRs should do the following:

  • Remove the CHANGELOG.md file (we will be doing changelogs in the milestone descriptions, and those get propagated to tags and release notes)

  • Add the workflow file:

    mkdir -p .github/workflows ; cd  .github/workflows ; wget https://gist.githubusercontent.com/weierophinney/9decd19f76b7d9745c6559074053fa65/raw/6ffb33e59796cfec569405139aa65da9396ea5cd/continuous-integration.yml
  • Check to see if there are any differences between what the Travis config and the GHA workflow do - don't worry about code coverage - but check for things like: extensions required, any pre-script tasks, etc. (Most of the time, there aren't any). If you see any, either: (1) add a .laminas-ci.json file with required configuration (e.g., adding extensions, adding php.ini settings; see https://github.com/laminas/laminas-ci-matrix-action#configuration for details), or (2) add information to the GHA workflow file (e.g., adding a service such as MySQL, Redis, etc.; see the laminas-db or laminas-cache adapter packages for examples).

  • Remove the .travis.yml file.

  • Remove the entry for composer.lock from the .gitignore file.

  • In the .gitattributes file:

    • Remove the entry for .travis.yml
    • Add an entry for .laminas-ci.json if you created one
    • Add an entry for .github if one does not exist
  • Using PHP 7.4, run composer update

  • Update the README.md file:

    • Remove any existing badges for Travis and/or Coveralls.

    • Add a badge with the following (substituting in the correct organization and repository name):

      [![Build Status](https://github.com/{organization}/{repository}/workflows/Continuous%20Integration/badge.svg)](https://github.com/{organization}/{repository}/actions?query=workflow%3A"Continuous+Integration")
  • Add and commit the GHA workflow, the .gitignore and .gitattribute files, the composer.lock file, and the README.md file.

  • Push to your fork and create the PR. If there are any QA job failures, fix and push the changes.


Additional notes

  • If the package supports PHP ^5.6 | ^7.0, you will need to exclude locked runs for PHP 5.6 - 7.2. The way to do that is to create the .laminas-ci.json file if you haven't already, and ensure it has the following contents:

    {
        "exclude": [
            {"name": "PHPUnit on PHP 5.6 with locked dependencies"},
            {"name": "PHPUnit on PHP 7.0 with locked dependencies"},
            {"name": "PHPUnit on PHP 7.1 with locked dependencies"},
            {"name": "PHPUnit on PHP 7.2 with locked dependencies"}
        ]
    }
@boesing
Copy link

boesing commented Apr 10, 2021

I'd prefer using the workflow filename so we dont have to use %20 or have to match the exact name of the workflow.

https://docs.github.com/en/actions/managing-workflow-runs/adding-a-workflow-status-badge#using-the-workflow-file-name
Can we update this GIST?

@internalsystemerror
Copy link

internalsystemerror commented Apr 11, 2021

I believe the new one should be:

[![Build Status](https://github.com/{organization}/{repository}/actions/workflows/continuous-integration.yml/badge.svg)](https://github.com/{organization}/{repository}/actions/workflows/continuous-integration.yml)

Edit: Added missing actions/ part of the image path

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment