Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Commit

Permalink
Merge pull request #46 from myoung34/golang
Browse files Browse the repository at this point in the history
Refactor to go
  • Loading branch information
myoung34 authored Aug 25, 2022
2 parents 09de0b4 + 7060cf0 commit 7429dfa
Show file tree
Hide file tree
Showing 1,055 changed files with 616,068 additions and 4,242 deletions.
6 changes: 1 addition & 5 deletions .claire.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
generalwhitelist:
# musl 1.2.2 resolves -> A buffer overflow (CVE-2020-28928) in wcsnrtombs has been fixed with the function essentially rewritten
CVE-2020-28928: musl
CVE-2021-30139: apk-tools
CVE-2021-36159: apk-tools
generalwhitelist: {}
28 changes: 6 additions & 22 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,16 @@ on:

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ '3.7', '3.8', '3.9', '3.10' ]
go-version: [1.19.x]
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup python
uses: actions/setup-python@v1
- uses: actions/setup-go@v3
with:
python-version: ${{ matrix.python-version }}
architecture: x64
- name: Get short Python version
id: full-python-version
shell: bash
run: echo ::set-output name=version::$(python -c "import sys; print(f'py{sys.version_info.major}{sys.version_info.minor}')")
- name: install pre-reqs
run: sudo apt-get update && sudo apt-get install libbluetooth-dev && pip install poetry pre-commit
- name: lint
run: pre-commit run --all-files
- name: Configure poetry
run: poetry config virtualenvs.in-project true
- name: Install dependencies
run: poetry install
- name: Run tox
run: poetry run tox -e ${{ steps.full-python-version.outputs.version }}
go-version: ${{ matrix.go-version }}
- uses: actions/checkout@v3
- run: go test -coverprofile coverage.out -v ./...
latest_deploy:
runs-on: ubuntu-latest
needs: [test]
Expand Down
99 changes: 18 additions & 81 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,86 +5,23 @@ on:
- '*'

jobs:
test:
goreleaser:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ '3.7', '3.8', '3.9', '3.10' ]
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup python
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
architecture: x64
- name: Get short Python version
id: full-python-version
shell: bash
run: echo ::set-output name=version::$(python -c "import sys; print(f'py{sys.version_info.major}{sys.version_info.minor}')")
- name: install pre-reqs
run: sudo apt-get update && sudo apt-get install libbluetooth-dev && pip install poetry pre-commit
- name: lint
run: pre-commit run --all-files
- name: Configure poetry
run: poetry config virtualenvs.in-project true
- name: Install dependencies
run: poetry install
- name: Run tox
run: poetry run tox -e ${{ steps.full-python-version.outputs.version }}
create-release:
name: Create Release
needs: [test]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
upload_to_pypi:
runs-on: ubuntu-latest
needs: [create-release]
steps:
- name: Copy Repo Files
uses: actions/checkout@v2
- name: Setup python
uses: actions/setup-python@v1
with:
python-version: 3.7
architecture: x64
- name: pre-reqs
run: pip install twine wheel
- name: Build
run: python setup.py sdist bdist_wheel
- name: upload
run: python -m twine upload dist/* --verbose
env:
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }}
TWINE_PASSWORD : ${{ secrets.TWINE_PASSWORD }}
ubuntu_tag_deploy:
runs-on: ubuntu-latest
needs: [create-release]
steps:
- name: Copy Repo Files
uses: actions/checkout@v2
- name: get version
run: echo 'TAG='$(echo ${GITHUB_REF} | sed -e "s/refs\/tags\///g") >> $GITHUB_ENV
- name: Set up Docker Buildx
id: buildx
uses: crazy-max/ghaction-docker-buildx@v1
with:
buildx-version: latest
- name: Available platforms
run: echo ${{ steps.buildx.outputs.platforms }}
- name: Login
run: docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_TOKEN }}
- name: Build
run: docker buildx build -t myoung34/tilty:${TAG} --output "type=image,push=true" --platform linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64 .
-
name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
-
name: Set up Go
uses: actions/setup-go@v3
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v3
with:
distribution: goreleaser
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23 changes: 2 additions & 21 deletions .github/workflows/sast.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ jobs:
run: sudo apt-get update && sudo apt-get install libbluetooth-dev
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: go
- name: Autobuild
uses: github/codeql-action/autobuild@v2
- name: Perform CodeQL Analysis
Expand All @@ -33,24 +35,3 @@ jobs:
run: docker build -t myoung34/tilty:latest .
- name: Test
run: ./clair-scanner -w .claire.yml --ip $(ip -f inet addr show eth0 | grep -Po 'inet \K[\d.]+') myoung34/tilty:latest
bandit:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ '3.7', '3.8', '3.9', '3.10' ]
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup python
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
architecture: x64
- name: install pre-reqs
run: sudo apt-get update && sudo apt-get install libbluetooth-dev && pip install -U pip && pip install poetry pre-commit
- name: Configure poetry
run: poetry config virtualenvs.in-project true
- name: Install dependencies
run: poetry install
- name: Run bandit
run: poetry run bandit -r tilty
37 changes: 9 additions & 28 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,21 @@
name: Test

on:
push:
branches-ignore:
- 'master'
- 'refs/tags/*'
pull_request:
branches: [ main ]

name: Test
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ '3.7', '3.8', '3.9', '3.10' ]
go-version: [1.19.x]
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup python
uses: actions/setup-python@v1
- uses: actions/setup-go@v3
with:
python-version: ${{ matrix.python-version }}
architecture: x64
- name: Get short Python version
id: full-python-version
shell: bash
run: echo ::set-output name=version::$(python -c "import sys; print(f'py{sys.version_info.major}{sys.version_info.minor}')")
- name: install pre-reqs
run: sudo apt-get update && sudo apt-get install libbluetooth-dev && pip install poetry pre-commit
- name: lint
run: pre-commit run --all-files
- name: Configure poetry
run: poetry config virtualenvs.in-project true
- name: Install dependencies
run: poetry install
- name: Run tox
run: poetry run tox -e ${{ steps.full-python-version.outputs.version }}
- name: coveralls
run: poetry run coveralls
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
go-version: ${{ matrix.go-version }}
- uses: actions/checkout@v3
- run: go test -coverprofile coverage.out -v ./...
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ __pycache__
.coverage
*.sw[o-p]
config.ini
coverage.out
.idea
*.db
3 changes: 3 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
linters:
enable:
- golint
21 changes: 8 additions & 13 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,23 +1,18 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v1.4.0
rev: v4.3.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
exclude: ^vendor/
- id: trailing-whitespace
exclude: ^vendor/
- id: check-case-conflict
exclude: ^vendor/
- id: check-merge-conflict
- id: check-executables-have-shebangs
- id: check-ast
- id: flake8
args: ['--config=setup.cfg']
- id: fix-encoding-pragma
exclude: ^vendor/
- id: detect-private-key
- repo: https://github.com/detailyang/pre-commit-shell
rev: 1.0.2
- repo: https://github.com/hadolint/hadolint
rev: v2.10.0
hooks:
- id: shell-lint
- repo: https://github.com/stratasan/hadolint-pre-commit
rev: cdefcb096e520a6daa9552b1d4636f5f1e1729cd
hooks:
- id: hadolint
- id: hadolint
Loading

0 comments on commit 7429dfa

Please sign in to comment.