Skip to content

Refactor Build Pipeline to Support Multiple Java Versions #1067

Refactor Build Pipeline to Support Multiple Java Versions

Refactor Build Pipeline to Support Multiple Java Versions #1067

Workflow file for this run

# This workflow will build a Java project with Maven
# 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 ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
java-version: [ '21', '11' ]
steps:
- uses: actions/checkout@v4
- name: Set up JDK ${{ matrix.java-version }}
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java-version }}
distribution: ${{ matrix.java-version == '21' && 'temurin' || 'adopt' }}
cache: 'maven'
- name: Set up properties
run: sh configure-dependencies.sh
- name: Check disk space before freeing up space
run: df -h
- name: Free up space
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /usr/local/lib/android
sudo rm -rf /usr/local/.ghcup/ghc/9.6.4
- name: Check disk space before build
run: df -h
- name: Install Docker Compose
run: |
curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
docker-compose --version
- name: Build
run: |
if [ "${{ matrix.java-version }}" = "11" ]; then
make build-legacy-services
else
make build-main
fi
env:
JAVA_HOME: ${{ steps.setup-java.outputs.java-home }}
- name: Check disk space after build
run: df -h
test:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Docker Compose
run: |
curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
docker-compose --version
# debug step
# - name: Setup upterm session
# uses: lhotari/action-upterm@v1
# with:
# ## limits ssh access and adds the ssh public key for the user which triggered the workflow
# limit-access-to-actor: true
- name: Run tests
run: make test