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

refact: reformat source code and update build config #504

Merged
merged 9 commits into from
Mar 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions .actrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# config file for https://github.com/nektos/act
-W .github/workflows/build.yml
11 changes: 11 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# see https://github.com/srvaroa/labeler
version: 1
labels:
- label: "bug"
title: "^fix(\\(.*\\))?:.*"
- label: "dependencies"
title: "^deps(\\(.*\\))?:.*"
- label: "documentation"
title: "^docs(\\(.*\\))?:.*"
- label: "enhancement"
title: "^feat(\\(.*\\))?:.*"
46 changes: 35 additions & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,31 @@ name: Build

on:
push:
branches: # build all branches
branches: # build all branches
- '**'
tags-ignore: # but don't build tags
tags-ignore: # but don't build tags
- '**'
paths-ignore:
- '**/*.md'
- '.github/*.yml'
- '.github/workflows/licensecheck.yml'
- '.github/workflows/validate_pr.yml'
- '**/.project'
- '**/.settings/*.prefs'
- '.gitignore'
- '.actrc'
- 'Jenkinsfile'
pull_request:
paths-ignore:
- '**/*.md'
- '.github/*.yml'
- '.github/workflows/licensecheck.yml'
- '.github/workflows/validate_pr.yml'
- '**/.project'
- '**/.settings/*.prefs'
- '.gitignore'
- '.actrc'
- 'Jenkinsfile'
workflow_dispatch:
# https://github.blog/changelog/2020-07-06-github-actions-manual-triggers-with-workflow_dispatch/
inputs:
Expand Down Expand Up @@ -39,8 +56,22 @@ jobs:
distribution: 'temurin'
java-version: 17

- name: Configure Fast APT Mirror
uses: vegardit/fast-apt-mirror.sh@v1

- name: Install xvfb
run: sudo apt-get install -o Acquire::Retries=3 --no-install-recommends -y xvfb
run: |
sudo apt-get install --no-install-recommends -y xvfb

sudo apt-get install --no-install-recommends -y dbus-x11
# prevents: "Failed to execute child process “dbus-launch” (No such file or directory)"

sudo apt-get install --no-install-recommends -y libswt-gtk-*-java
# prevents:
# java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons:
# no swt-pi4-gtk-4956r13 in java.library.path: /usr/java/packages/lib:/usr/lib64:/lib64:/lib:/usr/lib
# no swt-pi4-gtk in java.library.path: /usr/java/packages/lib:/usr/lib64:/lib64:/lib:/usr/lib
# no swt-pi4 in java.library.path: /usr/java/packages/lib:/usr/lib64:/lib64:/lib:/usr/lib

- name: "Cache: Local Maven Repository"
uses: actions/cache@v3
Expand All @@ -55,8 +86,7 @@ jobs:
- name: Set up Maven
uses: stCarolas/setup-maven@v4.5
with:
maven-version: 3.8.6

maven-version: 3.9.0

- name: Build with Maven
id: maven-build
Expand All @@ -80,9 +110,3 @@ jobs:
--no-transfer-progress \
${{ github.event.inputs.additional_maven_args }} \
clean verify

- name: "Delete intermediate build artifacts"
uses: geekyeggo/delete-artifact@v2 # https://github.com/GeekyEggo/delete-artifact/
with:
name: "*"
failOnError: false
50 changes: 37 additions & 13 deletions .github/workflows/licensecheck.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# 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

# https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions
name: License check

on:
Expand All @@ -10,26 +8,52 @@ on:
pull_request:
branches:
- '*'
workflow_dispatch:
# https://github.blog/changelog/2020-07-06-github-actions-manual-triggers-with-workflow_dispatch/

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up JDK 18
uses: actions/setup-java@v3
- name: Git Checkout
uses: actions/checkout@v3 #https://github.com/actions/checkout

- name: Set up JDK 17
uses: actions/setup-java@v3 # https://github.com/actions/setup-java
with:
java-version: '18'
distribution: 'adopt'
- name: Cache local Maven repository
distribution: 'temurin'
java-version: 17

- name: "Cache: Local Maven Repository"
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
path: |
~/.m2/repository
!~/.m2/**/*SNAPSHOT*
key: ${{ runner.os }}-mvnrepo-${{ hashFiles('**/pom.xml') }}-${{ hashFiles('**/target-platform/tm4e-target.target') }}
restore-keys: |
${{ runner.os }}-maven-
${{ runner.os }}-mvnrepo-

- name: License check
run: |
mvn -U -V -e -B -ntp org.eclipse.dash:license-tool-plugin:license-check --file pom.xml -Ddash.fail=true
set -eu

MAVEN_OPTS="${MAVEN_OPTS:-}"
MAVEN_OPTS="$MAVEN_OPTS -XX:+TieredCompilation -XX:TieredStopAtLevel=1" # https://zeroturnaround.com/rebellabs/your-maven-build-is-slow-speed-it-up/
MAVEN_OPTS="$MAVEN_OPTS -Djava.security.egd=file:/dev/./urandom" # https://stackoverflow.com/questions/58991966/what-java-security-egd-option-is-for/59097932#59097932
MAVEN_OPTS="$MAVEN_OPTS -Dorg.slf4j.simpleLogger.showDateTime=true -Dorg.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss,SSS" # https://stackoverflow.com/questions/5120470/how-to-time-the-different-stages-of-maven-execution/49494561#49494561
MAVEN_OPTS="$MAVEN_OPTS -Xmx1024m -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true -Dhttps.protocols=TLSv1.2"
echo " -> MAVEN_OPTS: $MAVEN_OPTS"
export MAVEN_OPTS

mvn \
--errors \
--update-snapshots \
--batch-mode \
--show-version \
--no-transfer-progress \
org.eclipse.dash:license-tool-plugin:license-check \
--file pom.xml \
-Ddash.fail=true
45 changes: 45 additions & 0 deletions .github/workflows/validate_pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions
name: "Validate PR"

on:
pull_request_target:
types:
- opened
- edited
- synchronize

jobs:
build:
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: "Validate semantic PR title"
uses: amannn/action-semantic-pull-request@v5 # https://github.com/amannn/action-semantic-pull-request
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
# https://mazer.dev/en/git/best-practices/git-semantic-commits/
# https://github.com/commitizen/conventional-commit-types/blob/master/index.json
types: |
build
ci
chore
docs
fix
feat
refact
revert
pref
style
scopes: |
core
deps
ui
requireScope: false

- name: "Label PR"
uses: srvaroa/labeler@v1.4.0 # https://github.com/srvaroa/labeler
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
39 changes: 30 additions & 9 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,51 +4,72 @@ Welcome to the Eclipse TM4E contributor land, and thanks in advance for your hel

🏠 Official Eclipse TM4E Git repo is [https://github.com/eclipse/tm4e](https://github.com/eclipse/tm4e) .


## ⚖️ Legal and Eclipse Foundation terms

The project license is available at [LICENSE](LICENSE).

This Eclipse Foundation open project is governed by the Eclipse Foundation
Development Process and operates under the terms of the Eclipse IP Policy.

Before your contribution can be accepted by the project team,
contributors must have an Eclipse Foundation account and
Before your contribution can be accepted by the project team,
contributors must have an Eclipse Foundation account and
must electronically sign the Eclipse Contributor Agreement (ECA).

* [http://www.eclipse.org/legal/ECA.php](http://www.eclipse.org/legal/ECA.php)

For more information, please see the Eclipse Committer Handbook:
[https://www.eclipse.org/projects/handbook/#resources-commit](https://www.eclipse.org/projects/handbook/#resources-commit).


## 💬 Get in touch with the community

Eclipse TM4E use mainly 2 channels for strategical and technical discussions

* 🐞 View and report issues through uses GitHub Issues at https://github.com/eclipse/m2e-tm4e/issues.
* 📧 Join the tm4e-dev@eclipse.org mailing-list to get in touch with other contributors about project organization and planning, and browse archive at 📜 [https://accounts.eclipse.org/mailing-list/tm4e-dev](https://accounts.eclipse.org/mailing-list/tm4e-dev)


## 🆕 Trying latest builds

Latest builds, for testing, can usually be found at `https://download.eclipse.org/tm4e/snapshots/` .


## 🧑‍💻 Developer resources

### ⌨️ Setting up the Development Environment manually


* Use Eclipse IDE with Plugin Development Environment installed.
* Clone this repository <a href="https://mickaelistria.github.io/redirctToEclipseIDECloneCommand/redirect.html"><img src="https://mickaelistria.github.io/redirctToEclipseIDECloneCommand/cloneToEclipseBadge.png" alt="Clone to Eclipse IDE"/></a> for m2e-core.
* _File > Open Projects from Filesystem..._ , select the path to tm4e Git repo and the relevant children projects you want to import
* Download and install the **Eclipse IDE for Eclipse Committers** from https://www.eclipse.org/downloads/packages/ or another Eclipse installation with the [Plug-in Development Environment (PDE)](https://www.eclipse.org/pde/) installed.
* Clone this repository <a href="https://mickaelistria.github.io/redirctToEclipseIDECloneCommand/redirect.html"><img src="https://mickaelistria.github.io/redirctToEclipseIDECloneCommand/cloneToEclipseBadge.png" alt="Clone to Eclipse IDE"/></a>.
* _File > Open Projects from Filesystem..._ , select the path to the tm4e Git repo and the relevant children projects you want to import

### 🏗️ Build

Prerequisite: Latest Maven release or Eclipse m2e.
Prerequisite: Latest Maven release or Eclipse [m2e](https://www.eclipse.org/m2e/).

1. From the command line: run `mvn clean verify`
1. From within Eclipse : right-click on the tm4e root folder > Run As > Maven build

#### Running the CI job locally:

The GitHub actions wokflow is compatible with [nektos/act](https://github.com/nektos/act) a command-line tool that allows you to run GitHub action workflows locally.

1. Install docker
1. Install [nektos/act](https://github.com/nektos/act)
1. From the commandline navigate into the tm4e rpoject root
1. Run the command `act`
1. On subsequent re-runs you can use `act -r` to reuse previous container which avoids reinstallation system packages and reduces build time.

then `mvn clean verify` from CLI or Right-click on the tm4e root folder > Run As > Maven build
In case of build failures the docker container will still be running and you can ssh into it for analysis using `docker exec -u root -it <CONTAINER_ID> /bin/bash`, e.g.:
```bash
container_id=$(docker container ps --filter status=running --filter name=act-Build-build --format {{.ID}})
docker exec -u root -it $container_id /bin/bash
```

### ⬆️ Version bump

tm4e tries to use OSGi Semantic Version (to properly expose its API contracts and breakage) and Reproducible Version Qualifiers (to minimize the avoid producing multiple equivalent artifacts for identical source). This requires the developer to manually bump version from time to time. Somes rules are that:
tm4e tries to use OSGi Semantic Version (to properly expose its API contracts and breakage) and Reproducible Version Qualifiers (to minimize the avoid producing multiple equivalent artifacts for identical source).
This requires the developer to manually bump version from time to time. Somes rules are that:

* Versions are bumped on a __per module grain__ (bump version of individual bundles/features one by one when necessary), __DON'T bump version of parent pom, nor of other modules you don't change__
* __Versions are bumped maximum once per release__ (don't bump versions that were already bumped since last release)
Expand Down
Loading