Skip to content

Commit

Permalink
build: v0.2.2 release [macata #48]
Browse files Browse the repository at this point in the history
build: v0.2.2 release [macata #48]
  • Loading branch information
DazedNConfused- authored Jul 5, 2024
2 parents fbe4cbc + ccbf5de commit e9d1732
Show file tree
Hide file tree
Showing 19 changed files with 241 additions and 35 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/attachbinarytorelease.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Attach binary to release

on:
release:
types: [created]

jobs:
tag_and_release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up JDK 18
uses: actions/setup-java@v3
with:
java-version: '18'
distribution: 'adopt'
cache: maven

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

- name: Extract Version from POM
id: extract_version
run: echo ::set-output name=version::$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)

- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./target/macatalauncher-${{ steps.extract_version.outputs.version }}.jar
asset_name: macatalauncher-${{ steps.extract_version.outputs.version }}.jar
asset_content_type: application/java-archive
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Java CI
name: Java build & test

on: [push]

Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
name: CodeQL analysis

on:
push:
branches: [ master, develop ]
Expand Down
23 changes: 23 additions & 0 deletions .github/workflows/commitlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Run Commitlint on PR's commits

on:
pull_request:

jobs:
run-commitlint-on-pr:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '16'

- name: Install Commitlint
run: npm install --save-dev @commitlint/{cli,config-conventional}

- name: Validate all commits from PR using Commitlint
run: npx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose
25 changes: 25 additions & 0 deletions .github/workflows/prtitlelint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Run Commitlint on PR's title

on:
pull_request:
types: [opened, edited, reopened, synchronize]


jobs:
run-commitlint-on-pr:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '16'

- name: Install Commitlint
run: npm install --save-dev @commitlint/{cli,config-conventional}

- name: Validate PR title using Commitlint
run: echo ${{ github.event.pull_request.title }} | npx commitlint
42 changes: 42 additions & 0 deletions .github/workflows/sonarcloud.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: SonarCloud

on:
push:
branches:
- master
- develop
pull_request:
types: [opened, synchronize, reopened]

jobs:
build:
name: Build and analyze
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Set up JDK 18
uses: actions/setup-java@v3
with:
java-version: '18'
distribution: 'adopt'
cache: maven
- name: Cache local Maven repository
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Cache SonarCloud packages
uses: actions/cache@v3
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Build and analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=dazednconfused_macata-launcher
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,10 @@ backups
.macatalauncher
trashed
userdir
mods
mods

### Husky / CommitLint ###
node_modules
package-lock.json
package.json
yarn.lock
1 change: 1 addition & 0 deletions .husky/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_
1 change: 1 addition & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx --no-install commitlint --edit "$1"
26 changes: 22 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,18 @@
![GitHub Workflow Status (with branch)](https://img.shields.io/github/actions/workflow/status/DazedNConfused-/macata-launcher/build.yml?branch=master&label=master)
![GitHub Workflow Status (with branch)](https://img.shields.io/github/actions/workflow/status/DazedNConfused-/macata-launcher/build.yml?branch=develop&label=develop)

[![Bugs](https://sonarcloud.io/api/project_badges/measure?project=dazednconfused_macata-launcher&metric=bugs)](https://sonarcloud.io/dashboard?id=dazednconfused_macata-launcher)
[![Code Smells](https://sonarcloud.io/api/project_badges/measure?project=dazednconfused_macata-launcher&metric=code_smells)](https://sonarcloud.io/dashboard?id=dazednconfused_macata-launcher)
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=dazednconfused_macata-launcher&metric=coverage)](https://sonarcloud.io/dashboard?id=dazednconfused_macata-launcher)
[![Duplicated Lines (%)](https://sonarcloud.io/api/project_badges/measure?project=dazednconfused_macata-launcher&metric=duplicated_lines_density)](https://sonarcloud.io/dashboard?id=dazednconfused_macata-launcher)
[![Lines of Code](https://sonarcloud.io/api/project_badges/measure?project=dazednconfused_macata-launcher&metric=ncloc)](https://sonarcloud.io/dashboard?id=dazednconfused_macata-launcher)
[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=dazednconfused_macata-launcher&metric=sqale_rating)](https://sonarcloud.io/dashboard?id=dazednconfused_macata-launcher)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=dazednconfused_macata-launcher&metric=alert_status)](https://sonarcloud.io/dashboard?id=dazednconfused_macata-launcher)
[![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=dazednconfused_macata-launcher&metric=reliability_rating)](https://sonarcloud.io/dashboard?id=dazednconfused_macata-launcher)
[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=dazednconfused_macata-launcher&metric=security_rating)](https://sonarcloud.io/dashboard?id=dazednconfused_macata-launcher)
[![Technical Debt](https://sonarcloud.io/api/project_badges/measure?project=dazednconfused_macata-launcher&metric=sqale_index)](https://sonarcloud.io/dashboard?id=dazednconfused_macata-launcher)
[![Vulnerabilities](https://sonarcloud.io/api/project_badges/measure?project=dazednconfused_macata-launcher&metric=vulnerabilities)](https://sonarcloud.io/dashboard?id=dazednconfused_macata-launcher)

## Requirements

MaCata requires Java 11 to run.
Expand All @@ -29,6 +41,16 @@ MaCata requires Java 11 to run.

Just put the `macatalauncher.jar` in some folder of your choice and double click!

## Build

Just run `mvn package` and a `macatalauncher-x.x.x.jar` binary will be built in the `target` directory.

## Development

Before making changes to the codebase, installing `husky` is encouraged: https://typicode.github.io/husky/get-started.html

While not mandatory, if commits are not properly formatted, they may get rejected by GitHub's `commitlint` action.

## Features

### Current
Expand All @@ -55,10 +77,6 @@ Just put the `macatalauncher.jar` in some folder of your choice and double click
- I want to focus mainly on macOS since there are already some excellent launchers for Windows and Linux already.
- Having said that, given the current launcher architecture, I would like to think it wouldn't be terribly hard to support Linux and/or Windows. Just a couple of changes to the [launcher class](src/main/java/com/dazednconfused/catalauncher/launcher/CDDALauncherManager.java) maybe? PRs welcome!

## Build

Just run `mvn package` and a `macatalauncher-x.x.x.jar` binary will be built in the `target` directory.

## FAQ

### Why Yet Another Launcher?
Expand Down
27 changes: 27 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
module.exports = {
extends: ['@commitlint/config-conventional'],
parserPreset: {
parserOpts: {
headerPattern: /^(\w+)(?:\((\w+)\))?: (.*) \[macata #(\d+)]( \(#\d+\))?$/,
headerCorrespondence: ['type', 'scope', 'subject', 'issue'],
},
},
rules: {
'type-enum': [2, 'always', [
'build',
'chore',
'ci',
'docs',
'feat',
'fix',
'perf',
'refactor',
'revert',
'style',
'test',
'wip'
] ],
'header-max-length': [2, 'always', 100],
'references-empty': [2, 'never']
},
};
5 changes: 4 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@

<groupId>com.dazednconfused</groupId>
<artifactId>macatalauncher</artifactId>
<version>0.2.0</version>
<version>0.2.2</version>

<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

<sonar.organization>dazednconfused</sonar.organization>
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
</properties>

<profiles>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ public static void compressAndCallback(File sourceDir, String outputFile, @Nulla
LOGGER.error("Compression task [{}] to zip [{}] cancelled", sourceDir, outputFile);
}

onPercentDoneCallback.accept(100); // whatever the result, set operation as "100% completed"
if (onPercentDoneCallback != null) {
onPercentDoneCallback.accept(100); // whatever the result, set operation as "100% completed"
}

} catch (InterruptedException | IOException e) {
LOGGER.error("There was an error while compressing folder [{}] into [{}]", sourceDir, outputFile, e);
Expand Down Expand Up @@ -108,7 +110,9 @@ public static void decompressAndCallback(File sourceFile, String destinationPath
LOGGER.error("Decompression task [{}] to [{}] cancelled", sourceFile, destinationPath);
}

onPercentDoneCallback.accept(100); // whatever the result, set operation as "100% completed"
if (onPercentDoneCallback != null) {
onPercentDoneCallback.accept(100); // whatever the result, set operation as "100% completed"
}

} catch (InterruptedException | IOException e) {
LOGGER.error("There was an error while decompressing zip [{}] into [{}]", sourceFile, destinationPath, e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,16 @@ public class ConfigurationManager {

private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();

private static final Object lock = new Object(); // thread-safety singleton lock
private static ConfigurationManager instance;

private final Configuration configuration;

/**
* Singleton.
* */
public static ConfigurationManager getInstance() {
public static synchronized ConfigurationManager getInstance() {
if (instance == null) {
synchronized (lock) {
if (instance == null) {
instance = new ConfigurationManager();
}
}
instance = new ConfigurationManager();
}
return instance;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,19 @@ public class ConfirmDialog extends JDialog {
private JLabel dialogMessage;
private JSVGCanvas iconSvg;

/**
* Same as {@link #ConfirmDialog(String, ConfirmDialogType, Consumer)}, with the following defaults:
* <ul>
* <li>{@code dialogType} is {@link ConfirmDialogType#NONE}.</li>
* <li>{@code doOnResult} is {@link #DO_NOTHING_ACTION}.</li>
* </ul>
*
* @param message The message to show in the dialog.
* */
public ConfirmDialog(String message) {
this(message, ConfirmDialogType.NONE, DO_NOTHING_ACTION);
}

/**
* Shows a confirmation dialog, which is basically a {@link JDialog} composed of a {@link String} {@code message}, a {@link ConfirmDialogType}
* which gives visual feedback of the severity of the message by means of different icons, and a {@link Consumer} action
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,7 @@ public static void checkForUpdates(JPanel parent, boolean showDialogIfNoUpdateAv
}

ConfirmDialog confirmDialog = new ConfirmDialog(
"There were no updates found",
ConfirmDialog.ConfirmDialogType.NONE,
ConfirmDialog.DO_NOTHING_ACTION
"There were no updates found"
);

confirmDialog.packCenterAndShow(parent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,16 @@ public class GitInfoManager {
private static final String GIT_PROPERTIES_BUILD_TIME_FILE = "git.properties";

private static GitInfoManager instance;
private static final Object lock = new Object(); //thread-safety singleton lock

@Nullable
private final Properties properties;

/**
* Singleton.
* */
public static GitInfoManager getInstance() {
public static synchronized GitInfoManager getInstance() {
if (instance == null) {
synchronized (lock) {
if (instance == null) {
instance = new GitInfoManager();
}
}
instance = new GitInfoManager();
}
return instance;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ public static void monitorCddaProcess(Process process, Runnable onExit) {
onExit.run();
} catch (InterruptedException e) {
LOGGER.error("Interrupted while waiting for CDDA process to exit", e);
// no further cleanup needed - just go ahead and proceed with the interruption
Thread.currentThread().interrupt();
}
}).start();
}
Expand Down
Loading

0 comments on commit e9d1732

Please sign in to comment.