Skip to content

Java CI with Maven #441

Java CI with Maven

Java CI with Maven #441

Workflow file for this run

# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
name: Java CI with Maven
on:
push:
branches: [ "main", "develop" ]
pull_request:
branches:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v31
- name: List pre-installed store paths
run: find /nix/store -mindepth 1 -maxdepth 1 | sort > pre-installed
- uses: actions/cache/restore@v4
id: cache
with:
path: cache-closure.nar
key: nix-${{ hashFiles('.github/workflows/maven.yml', 'default.nix', 'nix/**', 'pom.xml', 'local-maven-repo') }}
# restore-keys:
- name: Import cache
if: steps.cache.outputs.cache-hit == 'true'
run: |
nix-store --import < cache-closure.nar
- name: Build cache
if: steps.cache.outputs.cache-hit != 'true'
run: |
nix-build --out-link dependencies nix/github-workflow-dependencies.nix
- name: Export cache
if: steps.cache.outputs.cache-hit != 'true'
run: |
find /nix/store -mindepth 1 -maxdepth 1 | sort > store-paths
nix-store --export $(comm -13 pre-installed store-paths) > cache-closure.nar
- uses: actions/cache/save@v4
if: steps.cache.outputs.cache-hit != 'true'
with:
path: cache-closure.nar
key: nix-${{ hashFiles('.github/workflows/maven.yml', 'default.nix', 'nix/**', 'pom.xml', 'local-maven-repo') }}
# restore-keys:
- name: Build
run: nix-build
- name: Upload Javadoc artifact
if: ${{ github.event_name == 'push' && github.event.ref == 'refs/heads/main' }}
uses: actions/upload-pages-artifact@v3
with:
path: result/share/github-pages/DiffDetective
# An additional job is recommened in the documentation of `actions/deploy-pages`
deploy-javadoc:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' && github.event.ref == 'refs/heads/main' }}
needs: build
# Deploy to the github-pages environment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
steps:
- name: Publish Javadoc to Github Pages
id: deployment
uses: actions/deploy-pages@v4
# Kill in progress deployments because only the newest version is relevant
# and concurrent deployments cause CI failures.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true