Skip to content

Commit

Permalink
Refactor the code (#16)
Browse files Browse the repository at this point in the history
- Updated the code so all the linters pass.
- Updated `README.md` and improved the badge styles.
- Updated `CONTRIBUTING.md` and added licensing information for pull requests.
- Updated `.editorconfig` to cover YAML and Go files correctly.
- Updated GitHub workflows and removed unnecessary comments.
  • Loading branch information
habedi authored Feb 2, 2025
1 parent be236f1 commit 70f257e
Show file tree
Hide file tree
Showing 17 changed files with 443 additions and 444 deletions.
10 changes: 6 additions & 4 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ insert_final_newline = true # Make sure files end with a newline
trim_trailing_whitespace = true # Remove trailing whitespace

# Go files
[*.Go]
[*.go]
max_line_length = 100

# Markdown files
Expand All @@ -25,8 +25,10 @@ trim_trailing_whitespace = false # Don't remove trailing whitespace in Markdown
[*.sh]
indent_size = 2
# YAML files
[*.yaml]
# PowerShell scripts
[*.ps1]
indent_size = 2
# YAML files
[*.{yaml,yml}]
indent_size = 2
72 changes: 33 additions & 39 deletions .github/workflows/build_linux.yml
Original file line number Diff line number Diff line change
@@ -1,44 +1,38 @@
name: Linux Build

on:
workflow_dispatch: # Enable manual execution
workflow_dispatch: # Allow manual execution

jobs:
build:
runs-on: ubuntu-latest

steps:
# Checkout the repository
- name: Checkout Repository
uses: actions/checkout@v4

# Set up Go
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.23

# Install dependencies and run the tests
- name: Install Dependencies
run: |
sudo apt-get install -y make
make format
make test
continue-on-error: false

# Build the application
- name: Build for Linux
run: |
make build
continue-on-error: false

# Debug: List Build Directory
- name: List Build Directory
run: ls -R bin

# Upload Build Artifact
- name: Upload Build Artifact
uses: actions/upload-artifact@v4
with:
name: gogg-linux-amd64
path: 'bin/gogg'
build:
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.23

- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install -y make
make test
continue-on-error: false

- name: Build for Linux
run: |
make build
continue-on-error: false

- name: List Build Directory (for Debugging)
run: ls -R bin

- name: Upload Build Artifact
uses: actions/upload-artifact@v4
with:
name: gogg-linux-amd64
path: 'bin/gogg'
71 changes: 32 additions & 39 deletions .github/workflows/build_macos.yml
Original file line number Diff line number Diff line change
@@ -1,44 +1,37 @@
name: MacOS Build

on:
workflow_dispatch: # Enable manual execution
workflow_dispatch: # Allow manual execution

jobs:
build:
runs-on: macos-latest

steps:
# Checkout the repository
- name: Checkout Repository
uses: actions/checkout@v4

# Set up Go
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.23

# Install dependencies and run the tests
- name: Install Dependencies
run: |
brew install make
make format
make test
continue-on-error: false

# Build the application
- name: Build for MacOS
run: |
make build-macos
continue-on-error: false

# Debug: List Build Directory
- name: List Build Directory
run: ls -R bin

# Upload Build Artifact
- name: Upload Build Artifact
uses: actions/upload-artifact@v4
with:
name: gogg-macos-universal
path: 'bin/gogg'
build:
runs-on: macos-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.23

- name: Install Dependencies
run: |
brew install make
make test
continue-on-error: false

- name: Build for MacOS
run: |
make build-macos
continue-on-error: false

- name: List Build Directory (for Debugging)
run: ls -R bin

- name: Upload Build Artifact
uses: actions/upload-artifact@v4
with:
name: gogg-macos-universal
path: 'bin/gogg'
71 changes: 32 additions & 39 deletions .github/workflows/build_windows.yml
Original file line number Diff line number Diff line change
@@ -1,44 +1,37 @@
name: Windows Build

on:
workflow_dispatch: # Enable manual execution
workflow_dispatch: # Allow manual execution

jobs:
build:
runs-on: windows-latest

steps:
# Checkout the repository
- name: Checkout Repository
uses: actions/checkout@v4

# Set up Go
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.23

# Install dependencies and run the tests
- name: Install Dependencies
run: |
choco install make -y
make format
make test
continue-on-error: false

# Build the application
- name: Build for Windows
run: |
make build GOGG_BINARY=gogg.exe
continue-on-error: false

# Debug: List Build Directory
- name: List Build Directory
run: ls -R bin

# Upload Build Artifact
- name: Upload Build Artifact
uses: actions/upload-artifact@v4
with:
name: gogg-windows-amd64
path: 'bin/gogg.exe'
build:
runs-on: windows-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.23

- name: Install Dependencies
run: |
choco install make -y
make test
continue-on-error: false

- name: Build for Windows
run: |
make build GOGG_BINARY=gogg.exe
continue-on-error: false

- name: List Build Directory (for Debugging)
run: ls -R bin

- name: Upload Build Artifact
uses: actions/upload-artifact@v4
with:
name: gogg-windows-amd64
path: 'bin/gogg.exe'
41 changes: 22 additions & 19 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,31 @@
name: Run Linters

on:
workflow_dispatch: # Allow manual execution
push:
tags:
- 'v*' # Trigger on version tags
workflow_dispatch: # Allow manual execution
push:
tags:
- 'v*' # Trigger on version tags

jobs:
lint:
runs-on: ubuntu-latest
lint:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.23'
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.23

- name: Install golangci-lint
run: |
make install-deps
- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install -y make
make install-deps
- name: Run golangci-lint
run: |
make lint
- name: Run Linters
run: |
make lint
continue-on-error: false
Loading

0 comments on commit 70f257e

Please sign in to comment.