Skip to content
Closed
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
50 changes: 34 additions & 16 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Workflow by Photon Vision: https://github.com/PhotonVision/photonvision/blob/main/.github/workflows/build.yml
# Licensed under the GNU General Public License: https://www.gnu.org/licenses/

# Copyright (C) Photon Vision.
# Copyright (C) Photon Vision.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand All @@ -20,11 +20,11 @@ name: Build

on:
# Run on pushes to main and pushed tags, and on pull requests against main, but ignore the docs folder
push:
push:
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
concurrency:
group: ${{ github. workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true

env:
Expand All @@ -38,23 +38,32 @@ jobs:
# Checkout code.
- name: Checkout code
uses: actions/checkout@v4
with:
with:
fetch-depth: 0
- name: Fetch tags
run: git fetch --tags --force
- name: Install Java 17
uses: actions/setup-java@v4
with:
java-version: 17
java-version: 17
distribution: temurin
- name: Cache Gradle
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Gradle Build
run: ./gradlew compileJava

build-package:
needs: [build-gradle]

strategy:
fail-fast: false
fail-fast: false
matrix:
include:
- os: windows-latest
Expand All @@ -67,12 +76,12 @@ jobs:
arch-override: macx64
- os: macos-latest
artifact-name: macOSArm
architecture: x64
arch-override: macarm64
- os: ubuntu-22.04
architecture: x64
arch-override: macarm64
- os: ubuntu-22.04
artifact-name: Linux
architecture: x64
arch-override: linuxx64
architecture: x64
arch-override: linuxx64
- os: ubuntu-22.04
artifact-name: LinuxArm64
architecture: x64
Expand All @@ -81,17 +90,26 @@ jobs:
runs-on: ${{ matrix.os }}
name: "Build JAR - ${{ matrix.artifact-name }}"
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-depth: 0
- name: Install Java 17
uses: actions/setup-java@v4
with:
java-version: 17
distribution: temurin
architecture: ${{ matrix.architecture }}
- name: Cache Gradle
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*. gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- run: ./gradlew build -PArchOverride=${{ matrix.arch-override }}
- uses: actions/upload-artifact@v4
- uses: actions/upload-artifact@v4
with:
name: jar-${{ matrix.artifact-name }}
name: jar-${{ matrix.artifact-name }}
path: build/libs/BatteryTracking-${{ matrix.arch-override }}.jar
2 changes: 1 addition & 1 deletion batteryTracking.service
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Description=Service that runs Battery Tracking

[Service]
WorkingDirectory=/opt/batteryTracking
ExecStart=/usr/bin/java /opt/batteryTracking/BatteryTracking.jar
ExecStart=/usr/bin/java -jar /opt/batteryTracking/BatteryTracking.jar
ExecStop=/bin/systemctl kill BatteryTracking
Type=simple
Restart=on-failure
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,7 @@ private static ByteBuffer dumpCard() throws CardException, NoSuchAlgorithmExcept
}
System.out.printf("Took %d ns \n", System.nanoTime() - startTime);
bytes.position(0);
if (!(bytes.get() == (byte) 0x03))
if (bytes.get() != (byte) 0x03)
return bytes; // If it doesn't have these proprietary bytes were done
byte length = bytes.get();
if (length == (byte) 0xFF) {
Expand Down Expand Up @@ -938,7 +938,6 @@ private static String parseData(ByteBuffer data) throws NDEFException {
ByteBuffer payload = data.slice(); // get only the payload data, after the header
payload.limit((int) length); // discard the rest of the card
// actually decode
;
CharBuffer chars = CHARSET.decode(payload);
return chars.toString();
}
Expand Down Expand Up @@ -1112,7 +1111,6 @@ public void consumeError(String message, Exception e) {
public void consumeError(String message) {
System.out.printf("Battery Tracking Error: %s \n", message);
(new RuntimeException(message)).printStackTrace();
;
}

/**
Expand Down
Loading