Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor the code #16

Merged
merged 11 commits into from
Feb 2, 2025
Merged

Refactor the code #16

merged 11 commits into from
Feb 2, 2025

Conversation

habedi
Copy link
Owner

@habedi habedi commented Feb 2, 2025

  • 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.

Comment on lines +8 to +38
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'

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions Job or Workflow does not set permissions
Comment on lines +8 to +37
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'

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions Job or Workflow does not set permissions
Comment on lines +8 to +37
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'

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions Job or Workflow does not set permissions
Comment on lines +11 to +31
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

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions Job or Workflow does not set permissions
Comment on lines +11 to +36
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

- name: Build Windows Binary
run: |
make build GOGG_BINARY=gogg.exe

- name: Upload Windows Artifact
uses: actions/upload-artifact@v4
with:
name: gogg-windows
path: bin/gogg.exe

build-linux:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions Job or Workflow does not set permissions
Comment on lines +64 to +89
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

- name: Build macOS Binary
run: |
make build-macos

- name: Upload macOS Artifact
uses: actions/upload-artifact@v4
with:
name: gogg-macos
path: bin/gogg

release:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions Job or Workflow does not set permissions
Comment on lines +90 to +134
runs-on: ubuntu-latest
needs: [ build-windows, build-linux, build-macos ]
steps:
- name: Download Windows Artifact
uses: actions/download-artifact@v4
with:
name: gogg-windows
path: ./windows

- name: Download Linux Artifact
uses: actions/download-artifact@v4
with:
name: gogg-linux
path: ./linux

- name: Download macOS Artifact
uses: actions/download-artifact@v4
with:
name: gogg-macos
path: ./macos

- name: List Downloaded Files (for debugging)
run: ls -R .

- name: Rename Extracted Binaries
run: |
cd windows && zip -r9 ../gogg-windows-amd64.zip gogg.exe && cd ..
cd linux && zip -r9 ../gogg-linux-amd64.zip gogg && cd ..
cd macos && zip -r9 ../gogg-macos-universal.zip gogg && cd ..

- name: Create GitHub Release
uses: ncipollo/release-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
name: ${{ github.ref_name }}
tag: ${{ github.ref_name }}
body: |
Release version ${{ github.ref_name }}
- Binary builds for Windows, Linux, and macOS
artifacts: |
gogg-windows-amd64.zip
gogg-linux-amd64.zip
gogg-macos-universal.zip
draft: false
prerelease: false

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions Job or Workflow does not set permissions
cd macos && zip -r9 ../gogg-macos-universal.zip gogg && cd ..

- name: Create GitHub Release
uses: ncipollo/release-action@v1

Check warning

Code scanning / CodeQL

Unpinned tag for a non-immutable Action in workflow Medium

Unpinned 3rd party Action 'Build and Release' step
Uses Step
uses 'ncipollo/release-action' with ref 'v1', not a pinned commit hash
Comment on lines +11 to +43
runs-on: ubuntu-latest

strategy:
matrix:
# Go versions to test against
go-version: [ "1.21", "1.22", "1.23" ]

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

- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}

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

- name: Run Tests and Generate Coverage Report
run: |
make test # Generates a coverage.txt file for Codecov
continue-on-error: false

- name: Upload Coverage Reports to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
continue-on-error: false # Set to true to prevent failing the build if Codecov fails

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium test

Actions Job or Workflow does not set permissions
continue-on-error: false

- name: Upload Coverage Reports to Codecov
uses: codecov/codecov-action@v5

Check warning

Code scanning / CodeQL

Unpinned tag for a non-immutable Action in workflow Medium test

Unpinned 3rd party Action 'Tests' step
Uses Step
uses 'codecov/codecov-action' with ref 'v5', not a pinned commit hash
@habedi habedi merged commit 70f257e into main Feb 2, 2025
11 checks passed
@habedi habedi deleted the dev-hassan branch February 2, 2025 11:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant