From d27d50c1973bc944aacae50ab30931b7a997f2c5 Mon Sep 17 00:00:00 2001 From: sebthom Date: Fri, 10 Mar 2023 23:45:57 +0100 Subject: [PATCH] build: support local building with nektos/act --- .actrc | 2 ++ .github/workflows/build.yml | 26 ++++++++++++++++--------- CONTRIBUTING.md | 39 ++++++++++++++++++++++++++++--------- 3 files changed, 49 insertions(+), 18 deletions(-) create mode 100644 .actrc diff --git a/.actrc b/.actrc new file mode 100644 index 000000000..d3849dce4 --- /dev/null +++ b/.actrc @@ -0,0 +1,2 @@ +# config file for https://github.com/nektos/act +-W .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2afb5940b..41f82faaf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,9 +3,9 @@ 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' @@ -39,8 +39,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 @@ -79,9 +93,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 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 61866638c..a7b81596f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -4,6 +4,7 @@ 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). @@ -11,8 +12,8 @@ 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) @@ -20,6 +21,7 @@ must electronically sign the Eclipse Contributor Agreement (ECA). 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 @@ -27,28 +29,47 @@ 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 Clone to Eclipse IDE 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 Clone to Eclipse IDE. +* _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 /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)