Skip to content

Add GitHub Actions CI workflow for Maven build and test #317

Description

@ntung

Summary

JSBML currently has no automated CI pipeline. This issue proposes adding a GitHub Actions workflow to build and test the project on every push and pull request, generate test coverage reports via JaCoCo (see #316), and publish them to GitHub Pages.

Proposed workflow

Create .github/workflows/ci.yml:

name: CI

on:
  push:
    branches: [ main, master ]
  pull_request:
    branches: [ main, master ]

jobs:
  build:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        java-version: [ '8', '11', '17', '21' ]

    steps:
      - uses: actions/checkout@v4

      - name: Set up JDK ${{ matrix.java-version }}
        uses: actions/setup-java@v4
        with:
          java-version: ${{ matrix.java-version }}
          distribution: temurin
          cache: maven

      - name: Build and test
        run: mvn --batch-mode clean verify

  coverage:
    runs-on: ubuntu-latest
    needs: build
    if: github.event_name == 'push' && github.ref == 'refs/heads/master'
    permissions:
      pages: write
      id-token: write
    environment:
      name: github-pages
      url: ${{ steps.deploy.outputs.page_url }}

    steps:
      - uses: actions/checkout@v4

      - name: Set up JDK 11
        uses: actions/setup-java@v4
        with:
          java-version: '11'
          distribution: temurin
          cache: maven

      - name: Run all tests and generate aggregate coverage report
        run: mvn --batch-mode clean verify jacoco:report-aggregate

      - name: Upload Pages artifact
        uses: actions/upload-pages-artifact@v3
        with:
          path: target/site/jacoco-aggregate

      - name: Deploy to GitHub Pages
        id: deploy
        uses: actions/deploy-pages@v4

Rationale

build job

  • Matrix across Java 8, 11, 17, and 21 LTS — the source/target are set to 1.7 so it compiles under all of them; this catches regressions across LTS versions.
  • clean verify covers the full Maven lifecycle including integration tests.
  • cache: maven caches ~/.m2 to keep run times short.

coverage job

  • Runs only on pushes to master (not on every PR) to avoid unnecessary Page deployments.
  • Uses JaCoCo's report-aggregate goal to produce a unified HTML report across all submodules (core, extensions, modules). This requires the JaCoCo changes proposed in Enable test coverage reporting via JaCoCo #316.
  • Publishes the report to GitHub Pages using the native actions/upload-pages-artifact + actions/deploy-pages approach (no third-party action needed).
  • The live coverage report URL is surfaced as the job's environment URL in the Actions UI.

One-time repository setup

Enable GitHub Pages in Settings → Pages → Source: GitHub Actions before the first workflow run.

Next steps

A PR adding this file can be submitted once maintainers agree on the approach. The JaCoCo pom.xml changes (issue #316) should land first or in the same PR so the coverage job has something to report.

Metadata

Metadata

Assignees

No one assigned

    Fields

    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions