Skip to content

Commit

Permalink
ci: use Maven Wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
sebthom committed Nov 7, 2024
1 parent d54cc61 commit f245348
Show file tree
Hide file tree
Showing 7 changed files with 469 additions and 28 deletions.
10 changes: 9 additions & 1 deletion .ci/maven-settings.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.2.0 https://maven.apache.org/xsd/settings-1.2.0.xsd">

Expand All @@ -8,6 +8,14 @@
<username>${env.GITHUB_USER}</username>
<password>${env.GITHUB_API_KEY}</password>
</server>
<server>
<id>central</id>
<configuration>
<!-- https://maven.apache.org/guides/mini/guide-resolver-transport.html#timeouts -->
<connectTimeout>10000</connectTimeout>
<requestTimeout>30000</requestTimeout>
</configuration>
</server>
</servers>

</settings>
2 changes: 1 addition & 1 deletion .ci/maven-toolchains.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml version="1.0" encoding="UTF-8"?>
<toolchains xmlns="http://maven.apache.org/TOOLCHAINS/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/TOOLCHAINS/1.1.0 https://maven.apache.org/xsd/toolchains-1.1.0.xsd">
<toolchain>
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,6 @@ jobs:
key: ${{ runner.os }}-repo-tycho-${{ hashFiles('build.target') }}


- name: "Install: Maven"
uses: stCarolas/setup-maven@v5 # https://github.com/stCarolas/setup-maven
with:
maven-version: 3.9.9


- name: "Build with Maven 🔨"
id: maven-build
env:
Expand All @@ -110,6 +104,11 @@ jobs:
run: |
set -eu
#
# ensure mnvw is executable
#
chmod u+x ./mvnw
# https://github.community/t/github-actions-bot-email-address/17204
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
Expand All @@ -121,7 +120,7 @@ jobs:
export MAVEN_OPTS
echo "MAVEN_OPTS: $MAVEN_OPTS"
mvn \
./mvnw \
--errors \
--update-snapshots \
--batch-mode \
Expand Down Expand Up @@ -175,13 +174,14 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_NAME: ${{ steps.release.outputs.name }}
COMMIT_MSG: ${{ github.event.head_commit.message }} # https://stackoverflow.com/a/78420438/5116073
# https://cli.github.com/manual/gh_release_create
run: |
GH_DEBUG=1 gh release create "$RELEASE_NAME" \
--title "$RELEASE_NAME" \
${{ steps.release.outputs.name == 'stable' && '--latest' || '' }} \
${{ steps.release.outputs.name == 'preview' && '--prerelease' || '' }} \
--notes "${{ github.event.head_commit.message }}" \
--notes "$COMMIT_MSG" \
--target "${{ github.sha }}" \
product/target/products/org.haxe4e.studio-linux.gtk.x86_64.tar.gz \
product/target/products/org.haxe4e.studio-macosx.cocoa.x86_64.tar.gz \
Expand Down
19 changes: 19 additions & 0 deletions .mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
wrapperVersion=3.3.2
distributionType=only-script
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip
42 changes: 24 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,27 +67,30 @@ Please check the [Wiki](https://github.com/haxe4e/haxe-studio/wiki)

## <a id="building"></a>Building from Sources

To ensure reproducible builds this Maven project inherits from the [vegardit-maven-parent](https://github.com/vegardit/vegardit-maven-parent)
project which declares fixed versions and sensible default settings for all official Maven plug-ins.
To ensure reproducible builds, this [Maven](https://books.sonatype.com/mvnref-book/reference/index.html) project inherits from the
[vegardit-maven-parent](https://github.com/vegardit/vegardit-maven-parent) project, which declares fixed versions and sensible
default settings for all official Maven plugins.

The project also uses the [maven-toolchains-plugin](http://maven.apache.org/plugins/maven-toolchains-plugin/) which decouples the JDK that is
used to execute Maven and it's plug-ins from the target JDK that is used for compilation and/or unit testing. This ensures full binary
compatibility of the compiled artifacts with the runtime library of the required target JDK.
The project also uses the [maven-toolchains-plugin](http://maven.apache.org/plugins/maven-toolchains-plugin/), which decouples the
JDK used to execute Maven and its plugins from the target JDK used for compilation and unit testing.
This ensures full binary compatibility of the compiled artifacts with the runtime library of the required target JDK.

To build the project follow these steps:
To build the project, follow these steps:

1. Download and install a Java 17 SDK, e.g. from:
- https://github.com/ojdkbuild/ojdkbuild
1. **Install a Java 17 JDK**

Download and install a Java 17 SDK, e.g. from:
- https://adoptium.net/releases.html?variant=openjdk17
- https://www.azul.com/downloads/?version=java-17-lts&architecture=x86-64-bit&package=jdk#download-openjdk
- https://www.azul.com/downloads/?version=java-17-lts&package=jdk#zulu

1. Download and install the latest [Maven distribution](https://maven.apache.org/download.cgi).
2. **Configure Maven Toolchains**

1. In your user home directory create the file `.m2/toolchains.xml` with the following content:
In your user home directory, create the file `.m2/toolchains.xml` with the following content:

```xml
<?xml version="1.0" encoding="UTF8"?>
<toolchains>
<toolchains xmlns="http://maven.apache.org/TOOLCHAINS/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/TOOLCHAINS/1.1.0 https://maven.apache.org/xsd/toolchains-1.1.0.xsd">
<toolchain>
<type>jdk</type>
<provides>
Expand All @@ -101,15 +104,18 @@ To build the project follow these steps:
</toolchains>
```

Set the `[PATH_TO_YOUR_JDK_17]` parameter accordingly.
Replace `[PATH_TO_YOUR_JDK_17]` with the path to your JDK installation.

3. **Clone the Repository**

1. Checkout the code using one of the following methods:
```bash
git clone https://github.com/haxe4e/haxe-studio.git
```

- `git clone https://github.com/haxe4e/haxe-studio`
- `svn co https://github.com/haxe4e/haxe-studio haxe-studio`
4. **Build the Project**

1. Run `mvn clean verify` in the project root directory. This will execute compilation, unit-testing, integration-testing and
packaging of all artifacts.
Run `mvnw clean verify` in the project root directory.
This will execute compilation, unit testing, integration testing, and packaging of all artifacts.


## <a name="acknowledgement"></a>Acknowledgement
Expand Down
Loading

0 comments on commit f245348

Please sign in to comment.