Skip to content

Commit 147521f

Browse files
Add tests + CI
1 parent 93c59e2 commit 147521f

10 files changed

Lines changed: 1446 additions & 15 deletions

File tree

.codecov.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
coverage:
2+
precision: 2
3+
round: down
4+
range: "70...100"
5+
6+
ignore:
7+
- "test"
8+
- "stego/stego_test.go"
9+
- "stego/archive_test.go"
10+
- "stego/size_test.go"
11+
- "stego/integration_test.go"
12+
13+
comment:
14+
layout: "reach,diff,files,footer"
15+
behavior: default
16+
require_changes: false
17+
require_base: no
18+
require_head: yes
19+
hide_project_coverage: false
20+
hide_compare: false
21+
22+
github:
23+
require_ci_to_pass: true
24+
25+
flags:
26+
unittests:
27+
carryforward: true
28+
paths:
29+
- stego/

.github/workflows/tests.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ '*' ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
name: Test
13+
14+
steps:
15+
- uses: actions/checkout@v3
16+
17+
- name: Set up Go
18+
uses: actions/setup-go@v4
19+
with:
20+
go-version: 1.21
21+
22+
- name: Download dependencies
23+
run: go mod download
24+
25+
- name: Run tests
26+
run: go test -v -race -coverprofile=coverage.out ./...
27+
28+
- name: Upload coverage to Codecov
29+
if: github.ref == 'refs/heads/master' || github.event_name == 'pull_request'
30+
uses: codecov/codecov-action@v3
31+
with:
32+
files: ./coverage.out
33+
flags: unittests
34+
name: codecov-umbrella
35+
fail_ci_if_error: false
36+
37+
- name: Check test results
38+
run: |
39+
if ! go test ./... > /dev/null; then
40+
echo "Tests failed"
41+
exit 1
42+
fi
43+
echo "All tests passed!"

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
BINARY_NAME := steg-go
1+
BINARY_NAME := stego
22
DIST_DIR := dist
33
VERSION ?= dev
44

README.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1-
# Steganography Tool
1+
# SteGo
2+
3+
[![Tests](https://github.com/dustin/CS/steg-go/actions/workflows/tests.yml/badge.svg)](https://github.com/dustin/CS/steg-go/actions/workflows/tests.yml)
4+
[![codecov](https://codecov.io/gh/dustin/steg-go/graph/badge.svg)](https://codecov.io/gh/dustin/steg-go)
25

36
A Go program that hides files inside images using least-significant-bit (LSB) steganography.
47
## Project Structure
58

69
```
7-
steg-go/
10+
stego/
811
├── main.go # CLI application
912
├── stego/ # Reusable steganography package
1013
│ ├── stego.go # LSB encode/decode functions
@@ -20,7 +23,7 @@ steg-go/
2023
## Usage
2124

2225
```bash
23-
steg-go -i <input_image> [-f <file1> -f <file2> ...] -o <output>
26+
stego -i <input_image> [-f <file1> -f <file2> ...] -o <output>
2427
```
2528

2629
### Flags
@@ -33,19 +36,19 @@ steg-go -i <input_image> [-f <file1> -f <file2> ...] -o <output>
3336

3437
```bash
3538
# Build the executable
36-
go build -o steg-go
39+
go build -o stego
3740

3841
# Encode: Hide files in an image
39-
./steg-go -i input.jpg -f secret1.txt -f secret2.dat -o output.png
42+
./stego -i input.jpg -f secret1.txt -f secret2.dat -o output.png
4043

4144
# Encode: Hide multiple files
42-
./steg-go -i photo.png -f file1.txt -f file2.pdf -f file3.zip -o encoded.png
45+
./stego -i photo.png -f file1.txt -f file2.pdf -f file3.zip -o encoded.png
4346

4447
# Encode: Hide entire directory
45-
./steg-go -i photo.jpg -f my_secret_folder -o encoded.png
48+
./stego -i photo.jpg -f my_secret_folder -o encoded.png
4649

4750
# Extract: Extract hidden files from image
48-
./steg-go -i encoded.png -o extracted_files/
51+
./stego -i encoded.png -o extracted_files/
4952
```
5053

5154
## Features

stego/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Stego Package
22

3-
A reusable Go package for LSB (Least Significant Bit) steganography operations.
3+
A reusable Go package for LSB (Least Significant Bit) steganography operations used by SteGo.
44

55
## Overview
66

@@ -52,7 +52,7 @@ import (
5252
"image"
5353
"image/png"
5454
"os"
55-
"steg-go/stego"
55+
"SteGo/stego"
5656
)
5757

5858
func main() {
@@ -83,13 +83,13 @@ func main() {
8383
This package can be imported into other Go projects:
8484

8585
```go
86-
import "steg-go/stego"
86+
import "SteGo/stego"
8787
```
8888

8989
Or if published as a module:
9090

9191
```go
92-
import "github.com/username/steg-go/stego"
92+
import "github.com/username/SteGo/stego"
9393
```
9494

9595
## Technical Details

0 commit comments

Comments
 (0)