-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: rewrite codebase from python to golang
Refactor entire codebase from Python to Golang for improved performance
- Loading branch information
Showing
59 changed files
with
2,555 additions
and
1,776 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
name: Package Build | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
tag: | ||
description: 'Tag to release' | ||
required: true | ||
push: | ||
tags: | ||
- '*' | ||
env: | ||
DOCKER_BUILDKIT: 1 | ||
|
||
jobs: | ||
build_image: | ||
name: Build Image | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
with: | ||
config-inline: | | ||
[worker.oci] | ||
platforms = ["linux/amd64", "linux/arm64"] | ||
max-parallelism = 4 | ||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Setup ENV vars | ||
id: env-vars | ||
run: | | ||
echo "TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | ||
echo "IMAGE_NAME=ghcr.io/${GITHUB_ACTOR,,}/fsb" >> $GITHUB_ENV | ||
- name: Build docker image and push | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: ./ | ||
pull: true | ||
push: true | ||
platforms: linux/amd64,linux/arm64 | ||
tags: ${{ env.IMAGE_NAME }}:${{ env.TAG }} , ${{ env.IMAGE_NAME }}:latest |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,44 @@ | ||
name: Release | ||
name: Goreleaser | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
goReleaserArgs: | ||
description: 'Args goreleaser' | ||
required: false | ||
default: '--clean' | ||
push: | ||
tags: | ||
- "*" | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
Release: | ||
if: "contains(github.event.head_commit.message, 'Bump version')" | ||
runs-on: ubuntu-22.04 | ||
goreleaser: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Setup ENV | ||
run: echo "VERSION=$(echo ${{ github.event.head_commit.message }} | sed -r 's/Bump\s+version\s+?(to\s+?)?`?v?([a-z0-9.\-_]+)`?$/\2/')" >> $GITHUB_ENV | ||
- name: Generate CHANGELOGS | ||
run: | | ||
chmod +x .github/workflows/generate_changelogs.sh | ||
./.github/workflows/generate_changelogs.sh > CHANGELOGS.md | ||
- name: Package Server | ||
run: | | ||
rm -fr .vscode .git* | ||
zip -r ${{ github.WORKSPACE }}/TG-FileStreamBot-v${{ env.VERSION }}-main.zip * | ||
- name: Release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
name: TG-FileStreamBot-v${{ env.VERSION }} (main) | ||
body_path: CHANGELOGS.md | ||
files: | | ||
${{ github.WORKSPACE }}/TG-FileStreamBot-v${{ env.VERSION }}-main.zip | ||
prerelease: false | ||
tag_name: v${{ env.VERSION }} | ||
fetch-depth: 0 | ||
- run: git fetch --force --tags | ||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: 1.21 | ||
- name: Import GPG key | ||
id: import_gpg | ||
uses: crazy-max/ghaction-import-gpg@v6 | ||
with: | ||
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} | ||
passphrase: ${{ secrets.PASSPHRASE }} | ||
- name: Run GoReleaser | ||
uses: goreleaser/goreleaser-action@v5 | ||
with: | ||
distribution: goreleaser | ||
version: latest | ||
args: release ${{ github.event.inputs.goReleaserArgs }}" | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,121 +1,33 @@ | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
# Binaries for programs and plugins | ||
*.exe | ||
*.exe~ | ||
*.dll | ||
*.so | ||
*.dylib | ||
|
||
# Distribution / packaging | ||
.Python | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
MANIFEST | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.nox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*.cover | ||
.hypothesis/ | ||
.pytest_cache/ | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
local_settings.py | ||
db.sqlite3 | ||
|
||
# Flask stuff: | ||
instance/ | ||
.webassets-cache | ||
|
||
# Scrapy stuff: | ||
.scrapy | ||
# Test binary, built with `go test -c` | ||
*.test | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
# Output of the go coverage tool, specifically when used with LiteIDE | ||
*.out | ||
|
||
# PyBuilder | ||
target/ | ||
# Dependency directories | ||
vendor/ | ||
|
||
# Jupyter Notebook | ||
.ipynb_checkpoints | ||
# Go workspace file | ||
go.work | ||
|
||
# IPython | ||
profile_default/ | ||
ipython_config.py | ||
|
||
# pyenv | ||
.python-version | ||
|
||
# celery beat schedule file | ||
celerybeat-schedule | ||
|
||
# SageMath parsed files | ||
*.sage.py | ||
|
||
# Environments | ||
# Env files | ||
fsb.env | ||
.env | ||
.venv | ||
env/ | ||
venv/ | ||
ENV/ | ||
env.bak/ | ||
venv.bak/ | ||
|
||
# Spyder project settings | ||
.spyderproject | ||
.spyproject | ||
|
||
# Rope project settings | ||
.ropeproject | ||
# Session files | ||
*.session* | ||
sessons/ | ||
|
||
# mkdocs documentation | ||
/site | ||
|
||
# mypy | ||
.mypy_cache/ | ||
.dmypy.json | ||
dmypy.json | ||
|
||
# Pyre type checker | ||
.pyre/ | ||
# build folder | ||
dist/ | ||
|
||
#session files | ||
sessions/ | ||
*.session | ||
*.session-journal | ||
.env | ||
test.py | ||
# logs folder | ||
logs/ | ||
*.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
version: 1 | ||
project_name: TG-FileStreamBot | ||
env: | ||
- GO111MODULE=on | ||
before: | ||
hooks: | ||
- go mod tidy | ||
- go generate ./... | ||
|
||
builds: | ||
- main: ./cmd/fsb | ||
env: | ||
- CGO_ENABLED=0 | ||
flags: -tags=musl | ||
ldflags: "-extldflags -static -s -w" | ||
binary: fsb | ||
goos: | ||
- linux | ||
- windows | ||
- darwin | ||
goarch: | ||
- amd64 | ||
- arm64 | ||
mod_timestamp: '{{ .CommitTimestamp }}' | ||
|
||
archives: | ||
- format: tar.gz | ||
name_template: "{{ .ProjectName }}-{{ .Tag }}-{{ .Os }}-{{ .Arch }}" | ||
format_overrides: | ||
- goos: windows | ||
format: zip | ||
|
||
signs: | ||
- artifacts: checksum | ||
cmd: gpg2 | ||
args: | ||
- "--batch" | ||
- "-u" | ||
- "{{ .Env.GPG_FINGERPRINT }}" | ||
- "--output" | ||
- "${signature}" | ||
- "--detach-sign" | ||
- "${artifact}" | ||
|
||
checksum: | ||
name_template: "{{ .ProjectName }}-{{ .Tag }}-checksums.txt" | ||
|
||
changelog: | ||
sort: asc | ||
filters: | ||
exclude: | ||
- "^docs:" | ||
- "^test:" |
Oops, something went wrong.