Java and Gradle Continuous Integration Builds Using Github Actions

There are a million CI solutions available to engineers these days, but one of simplest to integrate with a simple Github project is the one built right into Github. Actions. Here's a quick process for setting up a Java project with Gradle to run your tests on every commit for every branch automatically.

Just drop into your project a file named .github/workflows/continuous-integration-workflow.yml with the following contents:
name: Build
on: [push]

    name: "David's Build"
    # This job runs on Linux
    runs-on: ubuntu-latest
      - uses: actions/checkout@v1
      - name: 'Set up JDK 1.8'
        uses: actions/setup-java@v1
          java-version: 1.8
      - name: 'gradlew build'
        run: cd ${GITHUB_WORKSPACE} && ./gradlew build
If you want to skip the standard gradle configuration and figuring out which gradle files need to be committed for this to work, have a gander at or fork my mit-licensed repo here. You can see the passing build here.

No comments

Post a Comment