Skip to content

Commit 8b84ddf

Browse files
committed
chore: Upgrade to new Java and added tests
1 parent 4462646 commit 8b84ddf

29 files changed

+2193
-255
lines changed

.circleci/config.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
version: 2.1
2+
3+
jobs:
4+
build:
5+
docker:
6+
- image: cimg/openjdk:21.0
7+
steps:
8+
- checkout
9+
- run:
10+
name: Build
11+
command: mvn -B clean compile
12+
- run:
13+
name: Test with Coverage
14+
command: mvn -B test
15+
- run:
16+
name: Upload Coverage Report to Codecov
17+
command: |
18+
curl -Os https://uploader.codecov.io/latest/linux/codecov
19+
chmod +x codecov
20+
./codecov -t ${CODECOV_TOKEN} -f target/site/jacoco/jacoco.xml
21+
22+
workflows:
23+
build:
24+
jobs:
25+
- build

.gitignore

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,24 @@
1-
# these 3 are required if this is not a gradle project
2-
3-
# this is for telling about dependency without this you dont get any jre system .jar files
4-
**/*.classpath
5-
6-
# without this eclipse cant detect this as a project
1+
# These 3 are required if this is not a gradle project (but you want to import the project into eclipse)
2+
# These are created by eclipse so that it can understand some configurations for this project(for example which is source directory )
3+
.classpath
74
.project
8-
9-
# this is required for eclipse I think
5+
#This one is needed by eclipse only when you have special configurations setup in eclipse for this project
106
.settings/
117

128

9+
# this is for mac
10+
*.DS_Store
11+
**/.DS_Store
12+
13+
# Build directories
1314
.gradle/
1415
bin/
1516
build/
1617
gen/
18+
target/
1719

18-
# these are for java
20+
# Maven specific
21+
*.jar
22+
*.war
23+
*.ear
1924
*.class

README.md

Lines changed: 57 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# File Compression
2+
3+
[![CircleCI](https://dl.circleci.com/status-badge/img/gh/ayonious/File-Compression/tree/master.svg?style=svg)](https://dl.circleci.com/status-badge/redirect/gh/ayonious/File-Compression/tree/master)
4+
[![codecov](https://codecov.io/gh/ayonious/File-Compression/branch/master/graph/badge.svg)](https://codecov.io/gh/ayonious/File-Compression)
5+
[![GitHub stars](https://img.shields.io/github/stars/ayonious/File-Compression?style=social)](https://github.com/ayonious/File-Compression/stargazers)
6+
17
A File Compression software that helps zip/Unzip files using these 2 algorihtms:
28

39
1. Huffmans Code
@@ -16,20 +22,65 @@ Unlike Huffmans code LZW dont need an extra dictionary to be saved. Also
1622
LZW does not create a mapping to byte to bin sequence. It creates mapping
1723
of multiple byte to binary sequence.
1824

19-
## Running Instruction:
25+
## Installation
26+
27+
### Prerequisites
28+
- Java 21 or higher
29+
- Maven (for building)
30+
31+
<details>
32+
<summary> Installing Maven (click to expand)</summary>
33+
34+
On macOS:
35+
```bash
36+
brew install maven
2037
```
38+
39+
On Linux:
40+
```bash
41+
sudo apt-get install maven # For Debian/Ubuntu
42+
sudo dnf install maven # For Fedora
43+
```
44+
45+
Verify installation:
46+
```bash
47+
mvn -version
48+
```
49+
</details>
50+
51+
## Building and Running
52+
53+
### Directly Run the jar file
54+
I have included the already build jar file. You can run it simply if you dont want to build
55+
```bash
2156
java -jar FileCompression.jar
2257
```
2358

24-
to zip a file:
59+
60+
### Build and Run the project Using Maven
61+
```bash
62+
mvn clean package
63+
mvn test
64+
mvn exec:java
65+
```
66+
67+
### Using JAR directly
68+
After building with Maven, you can run the JAR:
69+
```bash
70+
java -jar target/file-compression-1.0-SNAPSHOT-jar-with-dependencies.jar
71+
```
72+
73+
![Outlook](/git_resource/outlook.png?raw=true "File Compression GUI")
74+
75+
## Zip a file
2576
file>open>click zip>the zipped file will be created on the same folder
2677

27-
to unzip a file:
28-
file>open>click unzip>the unzipped file will be created on the same folder
2978

79+
## Unzip a file
80+
file>open>click unzip>the unzipped file will be created on the same folder
3081

3182

32-
##Testing environment:
83+
## Testing environment:
3384

3485
I tested this project in:
35-
Linux Mint, OS X El Capitan (version 10.11.6)
86+
Linux Mint, OS X El Capitan (version 10.11.6), macOS Sonoma

build.gradle

Lines changed: 0 additions & 16 deletions
This file was deleted.

codecov.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
coverage:
2+
status:
3+
project:
4+
default:
5+
target: 80% # the required coverage value
6+
threshold: 1% # the leniency in hitting the target
7+
patch:
8+
default:
9+
target: 80%
10+
threshold: 1%
11+
12+
comment:
13+
layout: "reach, diff, flags, files"
14+
behavior: default
15+
require_changes: false
16+
require_base: no
17+
require_head: yes
18+
19+
ignore:
20+
- "**/Main.java" # Ignore main class
21+
- "**/*Test.java" # Ignore test files

git_resource/outlook.png

115 KB
Loading

pom.xml

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<groupId>prog</groupId>
8+
<artifactId>file-compression</artifactId>
9+
<version>1.0-SNAPSHOT</version>
10+
11+
<properties>
12+
<maven.compiler.source>21</maven.compiler.source>
13+
<maven.compiler.target>21</maven.compiler.target>
14+
<maven.compiler.release>21</maven.compiler.release>
15+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
16+
</properties>
17+
18+
<dependencies>
19+
<dependency>
20+
<groupId>org.junit.jupiter</groupId>
21+
<artifactId>junit-jupiter</artifactId>
22+
<version>5.10.2</version>
23+
<scope>test</scope>
24+
</dependency>
25+
</dependencies>
26+
27+
<build>
28+
<plugins>
29+
<!-- Maven Assembly Plugin to create fat JAR -->
30+
<plugin>
31+
<groupId>org.apache.maven.plugins</groupId>
32+
<artifactId>maven-assembly-plugin</artifactId>
33+
<version>3.3.0</version>
34+
<configuration>
35+
<archive>
36+
<manifest>
37+
<mainClass>prog.Main</mainClass>
38+
</manifest>
39+
</archive>
40+
<descriptorRefs>
41+
<descriptorRef>jar-with-dependencies</descriptorRef>
42+
</descriptorRefs>
43+
</configuration>
44+
<executions>
45+
<execution>
46+
<id>make-assembly</id>
47+
<phase>package</phase>
48+
<goals>
49+
<goal>single</goal>
50+
</goals>
51+
</execution>
52+
</executions>
53+
</plugin>
54+
55+
<!-- Maven Exec Plugin for running the application -->
56+
<plugin>
57+
<groupId>org.codehaus.mojo</groupId>
58+
<artifactId>exec-maven-plugin</artifactId>
59+
<version>3.0.0</version>
60+
<configuration>
61+
<mainClass>prog.Main</mainClass>
62+
</configuration>
63+
</plugin>
64+
65+
<!-- Maven Surefire Plugin for running tests -->
66+
<plugin>
67+
<groupId>org.apache.maven.plugins</groupId>
68+
<artifactId>maven-surefire-plugin</artifactId>
69+
<version>3.2.5</version>
70+
</plugin>
71+
72+
<!-- JaCoCo Plugin for code coverage -->
73+
<plugin>
74+
<groupId>org.jacoco</groupId>
75+
<artifactId>jacoco-maven-plugin</artifactId>
76+
<version>0.8.11</version>
77+
<executions>
78+
<execution>
79+
<id>prepare-agent</id>
80+
<goals>
81+
<goal>prepare-agent</goal>
82+
</goals>
83+
</execution>
84+
<execution>
85+
<id>report</id>
86+
<phase>test</phase>
87+
<goals>
88+
<goal>report</goal>
89+
</goals>
90+
</execution>
91+
</executions>
92+
</plugin>
93+
</plugins>
94+
</build>
95+
</project>

renovate.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"extends": ["config:base"],
3+
"groupName": "all dependencies",
4+
"separateMajorMinor": false,
5+
"groupSlug": "all",
6+
"packageRules": [
7+
{
8+
"packagePatterns": [ "*" ],
9+
"groupName": "all dependencies",
10+
"groupSlug": "all"
11+
}
12+
],
13+
"rangeStrategy": "bump",
14+
"automerge": false,
15+
"lockFileMaintenance": {
16+
"enabled": true,
17+
"automerge": true
18+
}
19+
}

0 commit comments

Comments
 (0)