Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jameica und Hibiscus Abhängigkeit im build definieren und bauen #677

Merged
merged 27 commits into from
Feb 23, 2025
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 22 additions & 14 deletions .github/workflows/buildcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,37 @@ on:
- 'lib.src/**'
- 'src/**'
- '.github/workflows/**/*.yml'
push:
jobs:
call-reusable-workflow:
uses: ./.github/workflows/reusable-build.yml

build-check:
needs: call-reusable-workflow
runs-on: ubuntu-latest
steps:
- name: Restore cached tags and jars
id: cache-tags-jars
uses: actions/cache@v4
- name: Setup
uses: ./.github/workflows/reusable-build.yml
- name: Set up JDK for x64
uses: actions/setup-java@v4
with:
path: |
./cached-tags
jameica
hibiscus
key: ${{ runner.os }}-${{ github.repository_id }}

java-version: '17'
distribution: 'temurin'
architecture: x64
- name: Checkout openjverein
uses: actions/checkout@v4
with:
path: jverein

- name: Restore build dependencies
id: restore-cache
uses: actions/cache/restore@v4
with:
path: |
jameica/bin/
jameica/lib/
jameica/releases/jameica-lib.jar
hibiscus/bin/
hibiscus/lib/
hibiscus/releases/hibiscus-lib.jar
fail-on-cache-miss: true
key: ${{ hashFiles('jverein/build/build.properties', 'jverein/build/build.xml') }}

- name: Build openjverein plugin
working-directory: ./
run: ant -noinput -buildfile jverein/build/build.xml compile
30 changes: 13 additions & 17 deletions .github/workflows/nightly-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,31 +11,27 @@ on:
- '**'

jobs:
call-reusable-workflow:
uses: ./.github/workflows/reusable-build.yml

nightly-build:
needs: call-reusable-workflow
runs-on: ubuntu-latest
steps:
- name: Restore cached tags and jars
id: cache-tags-jars
uses: actions/cache@v4
- name: Setup
uses: ./.github/workflows/reusable-build.yml
- name: Restore build dependencies
id: restore-cache
uses: actions/cache/restore@v4
with:
path: |
./cached-tags
jameica
hibiscus
key: ${{ runner.os }}-${{ github.repository_id }}

- name: Checkout openjverein
uses: actions/checkout@v4
with:
path: jverein
jameica/bin/
jameica/lib/
jameica/releases/jameica-lib.jar
hibiscus/bin/
hibiscus/lib/
hibiscus/releases/hibiscus-lib.jar
fail-on-cache-miss: true
key: ${{ hashFiles('jverein/build/build.properties', 'jverein/build/build.xml') }}

- name: Build openjverein plugin
id: openjverein
working-directory: ./
run: |
ant_output=$(ant -e -q -noinput -buildfile jverein/build/build.xml nightly)
echo ${ant_output}
Expand Down
22 changes: 2 additions & 20 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,13 @@ name: OpenJVerein official release
on: workflow_dispatch

jobs:
call-reusable-workflow:
uses: ./.github/workflows/reusable-build.yml

release:
needs: call-reusable-workflow
runs-on: ubuntu-latest
steps:
- name: Restore cached tags and jars
id: cache-tags-jars
uses: actions/cache@v4
with:
path: |
./cached-tags
jameica
hibiscus
key: ${{ runner.os }}-${{ github.repository_id }}

- name: Checkout openjverein
uses: actions/checkout@v4
with:
path: jverein

- name: Setup
uses: ./.github/workflows/reusable-build.yml
- name: Build openjverein plugin
id: openjverein
working-directory: ./
run: |
ant_output=$(ant -e -q -noinput -buildfile jverein/build/build.xml)
echo ${ant_output}
Expand Down
128 changes: 32 additions & 96 deletions .github/workflows/reusable-build.yml
Original file line number Diff line number Diff line change
@@ -1,97 +1,33 @@
name: Reusable build steps

on:
workflow_call:

jobs:
setup-java-and-cache:
runs-on: ubuntu-latest
steps:
- name: Set up JDK for x64
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
architecture: x64

- name: Set env
id: setenvs
run: |
jameica_tag=$(git ls-remote --refs --tags --sort="-v:refname" https://github.com/willuhn/jameica.git V_\* | head -1 | cut -f 2 | cut -d / -f 3)
echo "jameica_tag=${jameica_tag}" >> $GITHUB_ENV
hibiscus_tag=$(git ls-remote --refs --tags --sort="-v:refname" https://github.com/willuhn/hibiscus.git V_\* | head -1 | cut -f 2 | cut -d / -f 3)
echo "hibiscus_tag=${hibiscus_tag}" >> $GITHUB_ENV
echo "### jameica_tag: ${jameica_tag} | hibiscus_tag: ${hibiscus_tag}"

- name: Restore cached tags and folders
id: cache-tags-jars
uses: actions/cache@v4
with:
path: |
./cached-tags
jameica
hibiscus
key: ${{ runner.os }}-${{ github.repository_id }}

- name: Load cached tags
id: load-cache
run: |
if [ -f ./cached-tags/jameica_tag ]; then
cached_jameica_tag=$(cat ./cached-tags/jameica_tag)
echo "cached_jameica_tag=${cached_jameica_tag}" >> $GITHUB_ENV
else
echo "cached_jameica_tag=" >> $GITHUB_ENV
fi
if [ -f ./cached-tags/hibiscus_tag ]; then
cached_hibiscus_tag=$(cat ./cached-tags/hibiscus_tag)
echo "cached_hibiscus_tag=${cached_hibiscus_tag}" >> $GITHUB_ENV
else
echo "cached_hibiscus_tag=" >> $GITHUB_ENV
fi
echo "### cached_jameica_tag: ${cached_jameica_tag} | cached_hibiscus_tag: ${cached_hibiscus_tag}"

- name: Checkout jameica
if: ${{ env.cached_jameica_tag != env.jameica_tag }}
uses: actions/checkout@v4
with:
repository: willuhn/jameica
path: jameica
ref: ${{ env.jameica_tag }}

- name: Build jameica jar
if: ${{ env.cached_jameica_tag != env.jameica_tag }}
working-directory: ./
run: |
ant -noinput -buildfile jameica/build/build.xml jar
find jameica/releases/ -type f -name jameica.jar -exec cp {} jameica/releases/jameica-lib.jar \;

- name: Checkout hibiscus
if: ${{ env.cached_hibiscus_tag != env.hibiscus_tag }}
uses: actions/checkout@v4
with:
repository: willuhn/hibiscus
path: hibiscus
ref: ${{ env.hibiscus_tag }}

- name: Build hibiscus jar
if: ${{ env.cached_hibiscus_tag != env.hibiscus_tag }}
working-directory: ./
run: |
ant -noinput -buildfile hibiscus/build/build.xml jar
find hibiscus/releases/ -type f -name hibiscus.jar -exec cp {} hibiscus/releases/hibiscus-lib.jar \;

- name: Create cache files and needed folders
run: |
mkdir -p ./cached-tags
echo "${{ env.jameica_tag }}" > ./cached-tags/jameica_tag
echo "${{ env.hibiscus_tag }}" > ./cached-tags/hibiscus_tag

- name: Cache tags and folders
uses: actions/cache@v4
if: always()
with:
path: |
./cached-tags
jameica
hibiscus
key: ${{ runner.os }}-${{ github.repository_id }}
description: Setups the build environment and builds Jameica and Hibiscus
runs:
using: "composite"
steps:
- name: Set up JDK for x64
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
architecture: x64

- name: Checkout openjverein
uses: actions/checkout@v4
with:
path: jverein

- name: Restore build dependencies
id: restore-cache
uses: actions/cache@v4
with:
path: |
jameica/bin/
jameica/lib/
jameica/releases/jameica-lib.jar
hibiscus/bin/
hibiscus/lib/
hibiscus/releases/hibiscus-lib.jar
key: ${{ hashFiles('jverein/build/build.properties', 'jverein/build/build.xml') }}

- name: Build Jameica and Hibiscus
if: steps.restore-cache.outputs.cache-hit != 'true'
run: ant -noinput -buildfile jverein/build/build.xml build-dependencies
5 changes: 5 additions & 0 deletions build/build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,8 @@ project.javadoc = ${project.release}/javadoc
project.zipdir = ${project.release}/${plugin.name}
project.zipfilename = ${plugin.name}.${plugin.version}.zip
project.zipfilename.nightly = ${plugin.name}.${plugin.version}-nightly.zip

jameica.url = https://github.com/willuhn/jameica/archive/refs/tags
jameica.version = V_2_10_4_BUILD_487
hibiscus.url = https://github.com/willuhn/hibiscus/archive/refs/tags
hibiscus.version = V_2_10_24_BUILD_388
35 changes: 35 additions & 0 deletions build/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -173,4 +173,39 @@
<echo message="SELECTED_FILENAME=${project.zipfilename.nightly}" />
</target>

<target name="build-dependencies" description="Downloads and builds Jameica and Hibiscus"
depends="init">
<antcall target="build-package">
<param name="name" value="jameica"/>
<param name="url" value="${jameica.url}"/>
<param name="version" value="${jameica.version}"/>
<param name="lib.target" value="lib"/>
</antcall>
<antcall target="build-package">
<param name="name" value="hibiscus"/>
<param name="url" value="${hibiscus.url}"/>
<param name="version" value="${hibiscus.version}"/>
<param name="lib.target" value="nightly"/>
</antcall>
</target>

<target name="build-package">
<!-- Download package -->
<get src="${url}/${version}.zip"
dest="${name}-${version}.zip"
skipexisting="true"/>

<!-- Unpack into folder $name -->
<unzip src="${name}-${version}.zip"
dest="../"/>
<move file="../${name}-${version}"
tofile="../${name}"/>

<!-- Run build -->
<ant dir="../${name}" antfile="build/build.xml" inheritall="false">
<target name="jar"/>
<target name="${lib.target}"/>
</ant>
</target>

</project>
Loading