Skip to content

Workflow update

Workflow update #121

Workflow file for this run

name: Build Modules
on:
pull_request:
branches: main
jobs:
# Github Action to detect file changes between
# main branch and pull request branch
changes:
runs-on: ubuntu-latest
outputs:
core: ${{ steps.filter.outputs.core }}
client: ${{ steps.filter.outputs.client }}
transport: ${{ steps.filter.outputs.transport }}
server: ${{ steps.filter.outputs.server }}
commit-author: ${{ steps.check.outputs.author }}
steps:
- name: Get previous commit author
id: check
run: echo "author=$(git show -s | grep Author)" >> $GITHUB_OUTPUT
- name: Print previous commit author
run: echo "Previous ${{ steps.check.outputs.author }}"
- uses: dorny/paths-filter@v3
id: filter
with:
# Detect any changes to the following folders
filters: |
core:
- 'bundle-core/**'
client:
- 'BundleClient/**'
transport:
- 'BundleTransport/**'
server:
- 'bundleserver/**'
# Github Action to Compile bundle-core
build-bundle-core:
needs: changes
#Compile bundle-core only if files were changed here
if: ${{ needs.changes.outputs.core == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup JDK 17
uses: actions/setup-java@v3
with:
java-version: "17"
distribution: "temurin"
- name: Run maven package on bundle-core
working-directory: ./bundle-core
run: mvn package
# Github Action to Compile BundleClient
build-bundle-client:
needs: changes
# Compile BundleClient only if files were changed here
if: ${{ needs.changes.outputs.client == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup gradle
uses: gradle/gradle-build-action@v2
- name: Setup JDK 17
uses: actions/setup-java@v3
with:
java-version: "17"
distribution: "temurin"
- name: Run maven package on server dependency > bundle-core
working-directory: ./bundle-core
run: mvn install
- name: Run gradle build on BundleClient
working-directory: ./BundleClient
run: ./gradlew build
# Github Action to Compile BundleTransport
build-bundle-transport:
needs: changes
# Compile BundleTransport only if files were changed here
if: ${{ needs.changes.outputs.transport == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup gradle
uses: gradle/gradle-build-action@v2
- name: Setup JDK 17
uses: actions/setup-java@v3
with:
java-version: "17"
distribution: "temurin"
- name: Run gradle build on BundleTransport
working-directory: ./BundleTransport
run: ./gradlew build
# Github Action to Compile bundleserver
build-bundle-server:
needs: changes
# Compile bundleserver only if files were changed here
if: ${{ needs.changes.outputs.server == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup JDK 17
uses: actions/setup-java@v3
with:
java-version: "17"
distribution: "temurin"
- name: Run maven package on server dependency > bundle-core
working-directory: ./bundle-core
run: mvn install
- name: Run maven package on BundleServer
working-directory: ./bundleserver
run: mvn package
call-auto-formatter:
needs:
[
changes,
build-bundle-core,
build-bundle-client,
build-bundle-transport,
build-bundle-server,
]
if: ${{ always() && !contains(needs.changes.outputs.commit-author, 'github-actions[bot]')}}
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
token: secrets.DDDTOKEN
- name: Install IntelliJ IDEA
run: |
wget -q -O idea.tar.gz https://download.jetbrains.com/idea/ideaIC-2024.1.1.tar.gz
tar -xzf idea.tar.gz
- name: Format code
run: |
./*/bin/format.sh -m *.java -r .
- name: Commit changes
run: |
git config user.name 'github-actions[bot]'
git config user.email "github-actions[bot]@users.noreply.github.com"
if ! git diff --exit-code > /dev/null
then
git commit -a -m "Auto-format code"
git push
fi