[Chore][Build] Simplify maven project. #126
Workflow file for this run
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, and cache/restore any dependencies to improve the workflow execution time | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven | |
# This workflow uses actions that are not certified by GitHub. | |
# They are provided by a third-party and are governed by | |
# separate terms of service, privacy policy, and support | |
# documentation. | |
name: Build | |
on: | |
push: | |
branches: [ "master" ] | |
pull_request: | |
branches: [ "master" ] | |
jobs: | |
build: | |
if: github.repository == 'IcarusDB/metal' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set Swap Space | |
uses: pierotofy/set-swap-space@master | |
with: | |
swap-size-gb: 8 | |
- uses: actions/checkout@v3 | |
- name: Filter Changes | |
uses: dorny/paths-filter@v2 | |
id: changes | |
with: | |
filters: | | |
ui: | |
- 'metal-ui/**' | |
mod: | |
- 'metal-backend/**' | |
- 'metal-backend-api/**' | |
- 'metal-core/**' | |
- 'metal-dist/**' | |
- 'metal-maven-plugin/**' | |
- 'metal-on-spark/**' | |
- 'metal-on-spark-extensions/**' | |
- 'metal-parent/**' | |
- 'metal-server/**' | |
ci: | |
- '.github/workflows/**.yml' | |
chore: | |
- '**.md' | |
- 'doc/**' | |
- 'LICENSE' | |
- 'licenses/**' | |
- name: Filters | |
run: | | |
echo 'ci:'${{ steps.changes.outputs.ci }} | |
echo 'ui:'${{ steps.changes.outputs.ui }} | |
echo 'mod:'${{ steps.changes.outputs.mod }} | |
echo 'chore:'${{ steps.changes.outputs.chore }} | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '11' | |
distribution: 'temurin' | |
cache: maven | |
- if: ${{ steps.changes.outputs.ci == 'true' }} | |
name: Build on CI changed | |
id: ci | |
run: | | |
echo 'CI has been changed, the whole build will execute.' | |
mvn clean package -B -pl metal-dist -am -Dmaven.test.skip=true | |
- if: ${{ steps.changes.outputs.ci == 'false' && steps.changes.outputs.ui == 'true' }} | |
name: Build on metal-ui changed | |
id: ui | |
run: | | |
echo 'metal-ui has been updated, the whole build will execute.' | |
mvn clean package -B -pl metal-dist -am -Dmaven.test.skip=true | |
- if: ${{ steps.changes.outputs.ci == 'false' && steps.changes.outputs.ui == 'false' && steps.changes.outputs.mod == 'true' }} | |
name: Build on modules changed | |
id: mod | |
run: | | |
echo 'Some modules has been changed, except metal-ui, the build will skip metal-ui.' | |
mvn clean package -B -pl metal-dist -am -Dmaven.test.skip=true -Dskip.npm | |
- if: ${{ steps.changes.outputs.ci == 'false' && steps.changes.outputs.ui == 'false' && steps.changes.outputs.mod == 'false' && steps.changes.outputs.chore == 'true' }} | |
name: Skip build on chores changed | |
id: chore | |
run: | | |
echo 'Just some chore files have been updated, it will skip build.' | |
- name: Finish | |
run: echo 'Build is finished.' |