|
| 1 | +--- |
| 2 | +title: Github Actions |
| 3 | +section: Extend:Development:Tools |
| 4 | +--- |
| 5 | + |
| 6 | +[GitHub](/develop/github) supports workflow automation in the cloud through [Github Actions](https://github.com/features/actions). This feature is very useful for automating builds, deployment and other aspects of [continuous integration](/develop/project-management#continuous-integration). |
| 7 | + |
| 8 | +# Services |
| 9 | + |
| 10 | +[SciJava](/libs/scijava) projects use Github Actions in a variety of ways: |
| 11 | + |
| 12 | +- Perform builds of SciJava projects. Github Actions deploy `SNAPSHOT` builds to the [SciJava Maven repository](https://maven.scijava.org/) in response to pushes to each code repository's `master` branch. So any downstream projects depending on a version of `LATEST` for a given component will match the last successful Github build—i.e., the latest code on `master`. |
| 13 | +- Run each project's associated {% include wikipedia title='Unit testing' text='unit tests'%}. Github Actions is instrumental in early detection of new bugs introduced to the codebase. |
| 14 | +- Perform [releases](/develop/releasing) of [SciJava](/libs/scijava) projects. Github Actions deploys release builds to the appropriate Maven repository—typically either the SciJava Maven repository or [OSS Sonatype](https://oss.sonatype.org/). |
| 15 | +- Keep the [javadoc](/develop/source#javadocs) site updated. |
| 16 | +- Keep other web resources updated. |
| 17 | + |
| 18 | +# Automatic Deployment of Maven Artifacts |
| 19 | + |
| 20 | +Deploying your library to a [Maven](/develop/maven) repository makes it available for other developers. It is also a [contribution requirement for the Fiji project](/contribute/fiji). |
| 21 | + |
| 22 | +## Requirements |
| 23 | + |
| 24 | +- Host your [open-source](/licensing/open-source) project on [GitHub](/develop/github). |
| 25 | +- Contact an ImageJ admin in [Gitter](/discuss/chat#gitter) or [the Image.sc Forum](http://forum.image.sc/) and request that they add the authentication secrets for deployment to your organization. |
| 26 | + |
| 27 | +## Instructions |
| 28 | + |
| 29 | +- In order to add Github CI support to a repository, the secrets are needed: A) for deploying to Maven repositories; and B) in the case of deploying to OSS Sonatype, for GPG signing of artifacts. |
| 30 | +- If the secrets have been added to your organization, and you have push access to the relevant repository on GitHub, you can use the [github-actionify.sh script](https://github.com/scijava/scijava-scripts/blob/master/github-actionify.sh) with the -f flag to perform the needed operations. |
| 31 | +- The github-actionify script will return '[ERROR] Dirty working copy' if you have uncommited changes. If you get this error, check the status of the repository with `git status` and then run `github-actionify -f` again. |
| 32 | +- If you need help, please ask [on the Image.sc Forum](https://forum.image.sc/) in the Development category, or in the [scijava-common channel](https://gitter.im/scijava/scijava-common) on Gitter. |
| 33 | + |
| 34 | +## Configuration of JavaFX builds |
| 35 | + |
| 36 | +- The workflows setup by the [github-actionify.sh script](https://github.com/scijava/scijava-scripts/blob/master/github-actionify.sh) do not include JavaFX. |
| 37 | +- To add support for JavaFX edit the files contained in the folder `.github/workflows/` to match those found in other SciJava projects that depend on JavaFX, e.g. [FilamentDetector](https://github.com/fiji/FilamentDetector). |
| 38 | + |
| 39 | +## Testing things which cannot run headless |
| 40 | + |
| 41 | +If your tests require a display (i.e.: they do not pass when run [headless](/learn/headless)), you can use [Xvfb](/learn/headless#xvfb) as follows: |
| 42 | + |
| 43 | + before_script: |
| 44 | + - "export DISPLAY=:99.0" |
| 45 | + - "sh -e /etc/init.d/xvfb start" |
| 46 | + - sleep 3 # give xvfb some time to start |
| 47 | + |
| 48 | +Of course, you should do this only as a last resort, since the best unit tests should not require a display in the first place. |
| 49 | + |
0 commit comments