Java CI with Maven #32
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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: | |
workflow_dispatch: | |
push: | |
branches: [ main-test ] | |
pull_request: | |
branches: [ main-test ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '11' | |
distribution: 'adopt' | |
cache: 'maven' | |
- name: Cache Maven dependencies | |
uses: actions/cache@v4 | |
id: maven-cache | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-maven-${{ hashFiles('java/pom.xml','**/pom.xml', 'services/*/pom.xml', 'java/*/pom.xml', 'java/*/*/pom.xml', 'java/*/*/*/pom.xml') }} | |
restore-keys: | | |
${{ runner.os }}-maven- | |
- name: Cache Go modules | |
id: go-cache | |
uses: actions/cache@v4 | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('services/**/go.mod', 'services/**/go.sum') }} | |
- name: Cache Docker layers | |
uses: actions/cache@v4 | |
id: docker-cache | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-docker-buildx | |
restore-keys: | | |
${{ runner.os }}-docker-buildx | |
- name: Set up properties | |
run: sh configure-dependencies.sh | |
- name: Check space before free up the 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 space before tests | |
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 | |
# 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 ie holashchand | |
# limit-access-to-actor: true | |
- name: Build and test | |
env: | |
MAVEN_CACHE: ${{ steps.maven-cache.outputs.cache-hit }} | |
DOCKER_CACHE: ${{ steps.docker-cache.outputs.cache-hit }} | |
run: make test | |
- name: Check space after tests | |
run: | | |
df -h | |
docker image ls | |
# test: | |
# runs-on: ubuntu-latest | |
# steps: | |
# - uses: actions/checkout@v2 | |
# - name: Run all the containers and test | |
# run : make test |