Skip to content
Open
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
38 changes: 33 additions & 5 deletions .github/workflows/ci-develop-snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,37 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Install dependencies
run: |
sudo apt-get remove --purge man-db
sudo apt-get install --yes build-essential linux-headers-$(uname -r) sudo libi2c-dev linux-modules-extra-$(uname -r)

- name: Set up Zulu JDK 25
uses: actions/setup-java@v4
with:
java-version: '25'
distribution: 'zulu'

- name: Create and add current user to suitable groups
run: |
sudo addgroup spi
sudo adduser $USER spi
sudo adduser $USER i2c
sudo adduser $USER dialout

- name: Add proper udev rules and trigger udevadm
run: |
sudo cp udev.rules /etc/udev/rules.d/99-pi4j-io.rules
sudo udevadm control --reload-rules && sudo udevadm trigger

- name: Cache local Maven repository
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-

- name: Validate secrets are available
run: |
if [ -z "${{ secrets.OSSRH_USERNAME }}" ]; then
Expand All @@ -37,14 +68,11 @@ jobs:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}

- name: Get latest Docker image
run: docker pull pi4j/pi4j-builder:2.0

- name: Build entire Pi4J Project in Docker
- name: Build entire Pi4J Project
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
run: docker run --env MAVEN_USERNAME=$MAVEN_USERNAME --env MAVEN_PASSWORD=$MAVEN_PASSWORD --user "$(id -u):$(id -g)" --rm --volume $(pwd):/build pi4j/pi4j-builder:2.0 clean deploy -Pnative,cross-compile --batch-mode
run: mvn deploy

- name: Make staging directory
run: mkdir staging
Expand Down
50 changes: 32 additions & 18 deletions .github/workflows/ci-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,32 +12,46 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Get latest Docker image
run: docker pull pi4j/pi4j-builder:2.0
- name: Install dependencies
run: |
sudo apt-get remove --purge man-db
sudo apt-get install --yes build-essential linux-headers-$(uname -r) sudo libi2c-dev linux-modules-extra-$(uname -r)

- name: Set up Zulu JDK 25
uses: actions/setup-java@v4
with:
java-version: '25'
distribution: 'zulu'

- name: Create and add current user to suitable groups
run: |
sudo addgroup spi
sudo adduser $USER spi
sudo adduser $USER i2c
sudo adduser $USER dialout

- name: Add proper udev rules and trigger udevadm
run: |
sudo cp udev.rules /etc/udev/rules.d/99-pi4j-io.rules
sudo udevadm control --reload-rules && sudo udevadm trigger

- name: Cache local Maven repository
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-

- name: Build entire Pi4J Project in Docker
- name: Build entire Pi4J Project
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
run: |
# Create target directory with proper permissions before running Docker
docker run \
--env MAVEN_USERNAME=$MAVEN_USERNAME \
--env MAVEN_PASSWORD=$MAVEN_PASSWORD \
--user "$(id -u):$(id -g)" \
--rm \
--volume $(pwd):/build \
pi4j/pi4j-builder:2.0 \
clean install -Pnative,cross-compile --batch-mode
run: mvn clean package

- name: Make staging directory
run: mkdir staging

- name: Copy distribution files to staging
run: |
cp -r pi4j-distribution/target/*.deb staging
cp -r pi4j-distribution/target/*.zip staging

- name: Upload distribution files to staging
uses: actions/upload-artifact@v4
with:
Expand Down
47 changes: 32 additions & 15 deletions .github/workflows/ci-release-tags.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,46 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Get latest Docker image
run: docker pull pi4j/pi4j-builder:2.0
- name: Install dependencies
run: |
sudo apt-get remove --purge man-db
sudo apt-get install --yes build-essential linux-headers-$(uname -r) sudo libi2c-dev linux-modules-extra-$(uname -r)

- name: Set up Zulu JDK 25
uses: actions/setup-java@v4
with:
java-version: '25'
distribution: 'zulu'

- name: Create and add current user to suitable groups
run: |
sudo addgroup spi
sudo adduser $USER spi
sudo adduser $USER i2c
sudo adduser $USER dialout

- name: Add proper udev rules and trigger udevadm
run: |
sudo cp udev.rules /etc/udev/rules.d/99-pi4j-io.rules
sudo udevadm control --reload-rules && sudo udevadm trigger

- name: Build entire Pi4J Project in Docker
- name: Cache local Maven repository
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-

- name: Build entire Pi4J Project
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
run: docker run --env MAVEN_USERNAME=$MAVEN_USERNAME --env MAVEN_PASSWORD=$MAVEN_PASSWORD --user "$(id -u):$(id -g)" --rm --volume $(pwd):/build pi4j/pi4j-builder:2.0 clean install -Pnative,cross-compile --batch-mode
run: mvn clean package

- name: Make staging directory
run: mkdir staging

- name: Copy distribution files to staging
run: |
cp -r pi4j-distribution/target/*.deb staging
cp -r pi4j-distribution/target/*.zip staging

- name: Upload distribution files to staging
uses: actions/upload-artifact@v4
with:
name: pi4j-dist
path: staging

DeployPackages:
name: Deploy to APT/Download Repo
needs: [ Build ]
Expand Down
16 changes: 2 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,20 +90,8 @@ The following command can be used to build the Pi4J JARs:
mvn package
```

Pi4J V2+ also includes native libraries that will need to be compiled if you are modifying any native code.
Most users will never need to compile the native libraries as these artifacts are automatically downloaded
when building the Pi4J JARs from Maven repositories. One of the following commands can be used to build
the Pi4J V2+ JARs and Native Libraries:

```
mvn package -Pnative
mvn package -Pnative,docker

# When you want to speed up...
mvn package -Pnative -DskipTests
```

With `package` all modules in the Pi4J project will be built and it shows you if the project can be successfully built. If you want to use the libraries locally on your Raspberry Pi, for example, for testing, replace `package` with `install`.
With `package` all modules in the Pi4J project will be built, and it shows you if the project can be successfully built.
If you want to use the libraries locally on your Raspberry Pi, for example, for testing, replace `package` with `install`.

> **NOTE:** A comprehensive set of build instructions can be found in
> the [Pi4J Documentation](https://pi4j.com/architecture/about-the-code/build-instructions/).
Expand Down
30 changes: 19 additions & 11 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,39 @@
# Releasing pi4j
# Releasing Pi4J

## Create a new release

To release pi4j use the following:

MVN_PROFILES=-P\!default,native,docker ./autoReleaseBranch minor develop release/<version>
```shell
MVN_PROFILES=-P\!default ./autoReleaseBranch minor develop release/<version>
```

this merges the ``develop`` branch into ``release/<version>``, increments the current tag on the ``release/<version>``
branch and then builds it locally. It uses ``mvn versions:set``
to set the version, and after the version is set, does a test build to make sure all dependencies are really there.
this merges the `develop` branch into `release/<version>`, increments the current tag on the `release/<version>`
branch and then builds it locally. It uses `mvn versions:set` to set the version, and after the version is set,
does a test build to make sure all dependencies are really there.

The tag is signed by the configured git signing key. The key used can be checked with:

git config --get user.signingkey
```shell
git config --get user.signingkey
```

## Deploy to Maven central

To deploy to maven, use the following commands:

MVN_PROFILES=-P\!default,native,docker ./deployToMavenCentral.sh <version>
```shell
MVN_PROFILES=-P\!default ./deployToMavenCentral.sh <version>
```

This checks out the given tag and used the ``deploy`` profile to build and push the artifacts to maven central.
This checks out the given tag and used the `deploy` profile to build and push the artifacts to maven central.

## Update snapshot version
To create a new snapshot version on ``develop`` branch, use the following two commands:
To create a new snapshot version on `develop` branch, use the following two commands:

mvn versions:set -DgenerateBackupPoms=false -DnewVersion="${newVersion}"
mvn clean install -Pnative,docker
```shell
mvn versions:set -DgenerateBackupPoms=false -DnewVersion="${newVersion}"
mvn clean install
```

Then commit and push the changed ``pom.xml`` files.
9 changes: 0 additions & 9 deletions TODO

This file was deleted.

48 changes: 0 additions & 48 deletions build-docker.sh

This file was deleted.

2 changes: 0 additions & 2 deletions libraries/pi4j-library-gpiod/generate-headers.sh

This file was deleted.

Loading
Loading