Using GitHub Actions to build and release plugins

From Koha Wiki
Jump to navigation Jump to search

Using GitHub actions too automate your plugins is easy!

Enable GitHub Actions for your plugin

  1. Browse to your GitHub plugin repo on GitHub
  2. Click "Settings" ( in the upper right area, it has a gear icon )
  3. Click "Actions" ( in the left sidebar )
  4. Select the option "Enable local and third party Actions for this repository"

Add unit tests

  1. Copy the basic unit test file to t/00-load.t in the root directory of your plugin's git repository
  2. Add more unit tests as needed
  3. Add the file to your report using "git add"
  4. Commit the addition with "git commit"

Add the workflow file

  1. Copy the GitHub Actions workflow file to .github/workflows/main.yml in the root directory of your plugin's git repository.
  2. Add the file to your report using "git add"
  3. Commit the addition with "git commit"
  4. Push the change to your main branch with "git push"

Check your CI run

  1. Browse to your plugin on GitHub
  2. Click the "Actions" tab at the top
  3. Notice a CI run for the new push, click on it


Each workflow will test your plugin against main, stable and oldstable version of Koha. If they all pass, the workflow will build and release your plugin!

NOTE: This basic unit test only tests if your plugin's Perl module can be loaded. It will fail if, for example, you use a module that no longer exists. It will not catch the use of subroutines that no longer exist without more unit tests.