From fb2d9de539b660a261af19b1cbcceb7ee7980cb1 Mon Sep 17 00:00:00 2001 From: Mistivia Date: Sun, 2 Nov 2025 15:27:43 +0800 Subject: add misc --- teleirc/matterbridge/.dockerignore | 2 + teleirc/matterbridge/.fixmie.yml | 3 + teleirc/matterbridge/.github/ISSUE_TEMPLATE.md | 36 +++ .../.github/ISSUE_TEMPLATE/Bug_report.md | 27 +++ .../.github/ISSUE_TEMPLATE/Feature_request.md | 18 ++ .../.github/workflows/codeql-analysis.yml | 71 ++++++ .../matterbridge/.github/workflows/development.yml | 58 +++++ teleirc/matterbridge/.github/workflows/docker.yml | 68 ++++++ teleirc/matterbridge/.gitignore | 9 + teleirc/matterbridge/.golangci.yaml | 244 +++++++++++++++++++++ teleirc/matterbridge/.goreleaser.yml | 41 ++++ 11 files changed, 577 insertions(+) create mode 100644 teleirc/matterbridge/.dockerignore create mode 100644 teleirc/matterbridge/.fixmie.yml create mode 100644 teleirc/matterbridge/.github/ISSUE_TEMPLATE.md create mode 100644 teleirc/matterbridge/.github/ISSUE_TEMPLATE/Bug_report.md create mode 100644 teleirc/matterbridge/.github/ISSUE_TEMPLATE/Feature_request.md create mode 100644 teleirc/matterbridge/.github/workflows/codeql-analysis.yml create mode 100644 teleirc/matterbridge/.github/workflows/development.yml create mode 100644 teleirc/matterbridge/.github/workflows/docker.yml create mode 100644 teleirc/matterbridge/.gitignore create mode 100644 teleirc/matterbridge/.golangci.yaml create mode 100644 teleirc/matterbridge/.goreleaser.yml diff --git a/teleirc/matterbridge/.dockerignore b/teleirc/matterbridge/.dockerignore new file mode 100644 index 0000000..c7f78fd --- /dev/null +++ b/teleirc/matterbridge/.dockerignore @@ -0,0 +1,2 @@ +Dockerfile +tgs.Dockerfile diff --git a/teleirc/matterbridge/.fixmie.yml b/teleirc/matterbridge/.fixmie.yml new file mode 100644 index 0000000..602d110 --- /dev/null +++ b/teleirc/matterbridge/.fixmie.yml @@ -0,0 +1,3 @@ +go: + comments: + disabled: true diff --git a/teleirc/matterbridge/.github/ISSUE_TEMPLATE.md b/teleirc/matterbridge/.github/ISSUE_TEMPLATE.md new file mode 100644 index 0000000..6b333c9 --- /dev/null +++ b/teleirc/matterbridge/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,36 @@ + + + + + +### Environment + + +Version: + + +Operating system: + + + +### Please describe the expected behavior. + + +### Please describe the actual behavior. + + + +### Any steps to reproduce the behavior? + + +### Please add your configuration file + diff --git a/teleirc/matterbridge/.github/ISSUE_TEMPLATE/Bug_report.md b/teleirc/matterbridge/.github/ISSUE_TEMPLATE/Bug_report.md new file mode 100644 index 0000000..9334b30 --- /dev/null +++ b/teleirc/matterbridge/.github/ISSUE_TEMPLATE/Bug_report.md @@ -0,0 +1,27 @@ +--- +name: Bug report +about: Create a report to help us improve. (Check the FAQ on the wiki first) +labels: bug + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior: + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots/debug logs** +If applicable, add screenshots to help explain your problem. +Use logs from running `matterbridge -debug` if possible. + +**Environment (please complete the following information):** + - OS: [e.g. linux] + - Matterbridge version: output of `matterbridge -version` + - If self compiled: output of `git rev-parse HEAD` + +**Additional context** +Please add your configuration file (be sure to exclude or anonymize private data (tokens/passwords)) diff --git a/teleirc/matterbridge/.github/ISSUE_TEMPLATE/Feature_request.md b/teleirc/matterbridge/.github/ISSUE_TEMPLATE/Feature_request.md new file mode 100644 index 0000000..13240ef --- /dev/null +++ b/teleirc/matterbridge/.github/ISSUE_TEMPLATE/Feature_request.md @@ -0,0 +1,18 @@ +--- +name: Feature request +about: Suggest an idea for this project +labels: enhancement + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/teleirc/matterbridge/.github/workflows/codeql-analysis.yml b/teleirc/matterbridge/.github/workflows/codeql-analysis.yml new file mode 100644 index 0000000..8523184 --- /dev/null +++ b/teleirc/matterbridge/.github/workflows/codeql-analysis.yml @@ -0,0 +1,71 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +name: "CodeQL" + +on: + push: + branches: [master] + pull_request: + # The branches below must be a subset of the branches above + branches: [master] + schedule: + - cron: '0 16 * * 1' + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + # Override automatic language detection by changing the below list + # Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python'] + language: ['go'] + # Learn more... + # https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + with: + # We must fetch at least the immediate parents so that if this is + # a pull request then we can checkout the head. + fetch-depth: 2 + + # If this run was triggered by a pull request event, then checkout + # the head of the pull request instead of the merge commit. + - run: git checkout HEAD^2 + if: ${{ github.event_name == 'pull_request' }} + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v1 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + # queries: ./path/to/local/query, your-org/your-repo/queries@main + + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v1 + + # â„šī¸ Command-line programs to run using the OS shell. + # 📚 https://git.io/JvXDl + + # âœī¸ If the Autobuild fails above, remove it and uncomment the following three lines + # and modify them (or add more) to build your code if your project + # uses a compiled language + + #- run: | + # make bootstrap + # make release + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v1 diff --git a/teleirc/matterbridge/.github/workflows/development.yml b/teleirc/matterbridge/.github/workflows/development.yml new file mode 100644 index 0000000..4d00e0e --- /dev/null +++ b/teleirc/matterbridge/.github/workflows/development.yml @@ -0,0 +1,58 @@ +name: Development +on: [push, pull_request] +jobs: + lint: + name: golangci-lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 20 + - name: Run golangci-lint + uses: golangci/golangci-lint-action@v2 + with: + version: latest + args: "-v --new-from-rev HEAD~5" + test-build-upload: + strategy: + matrix: + go-version: [1.18.x] + platform: [ubuntu-latest] + runs-on: ${{ matrix.platform }} + steps: + - name: Install Go + uses: actions/setup-go@v2 + with: + go-version: ${{ matrix.go-version }} + stable: false + - name: Checkout code + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Test + run: go test ./... -mod=vendor + - name: Build + run: | + mkdir -p output/{win,lin,arm,mac} + VERSION=$(git describe --tags) + CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-s -X github.com/42wim/matterbridge/version.GitHash=$(git log --pretty=format:'%h' -n 1)" -o output/lin/matterbridge-$VERSION-linux-amd64 + CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags "-s -X github.com/42wim/matterbridge/version.GitHash=$(git log --pretty=format:'%h' -n 1)" -o output/win/matterbridge-$VERSION-windows-amd64.exe + CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags "-s -X github.com/42wim/matterbridge/version.GitHash=$(git log --pretty=format:'%h' -n 1)" -o output/mac/matterbridge-$VERSION-darwin-amd64 + - name: Upload linux 64-bit + if: startsWith(matrix.go-version,'1.18') + uses: actions/upload-artifact@v2 + with: + name: matterbridge-linux-64bit + path: output/lin + - name: Upload windows 64-bit + if: startsWith(matrix.go-version,'1.18') + uses: actions/upload-artifact@v2 + with: + name: matterbridge-windows-64bit + path: output/win + - name: Upload darwin 64-bit + if: startsWith(matrix.go-version,'1.18') + uses: actions/upload-artifact@v2 + with: + name: matterbridge-darwin-64bit + path: output/mac diff --git a/teleirc/matterbridge/.github/workflows/docker.yml b/teleirc/matterbridge/.github/workflows/docker.yml new file mode 100644 index 0000000..c1caf27 --- /dev/null +++ b/teleirc/matterbridge/.github/workflows/docker.yml @@ -0,0 +1,68 @@ +name: docker + +on: + push: + branches: + - 'master' + tags: + - 'v*' + pull_request: + branches: + - 'master' + +jobs: + docker: + runs-on: ubuntu-latest + steps: + - + name: Checkout + uses: actions/checkout@v2 + - + name: Set up QEMU + uses: docker/setup-qemu-action@v1 + with: + platforms: amd64,arm64 + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - + name: Docker meta + id: meta + uses: docker/metadata-action@v3 + with: + images: 42wim/matterbridge,ghcr.io/42wim/matterbridge + flavor: | + latest=true + tags: | + type=ref,event=branch + type=ref,event=pr + type=semver,pattern={{version}} + type=semver,pattern=stable + type=semver,pattern={{major}} + type=semver,pattern={{major}}.{{minor}} + - + name: Login to DockerHub + uses: docker/login-action@v1 + if: github.event_name != 'pull_request' + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - + name: Log into registry ghcr.io + uses: docker/login-action@v1 + if: github.event_name != 'pull_request' + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + - + name: Build and push + id: docker_build + uses: docker/build-push-action@v2 + with: + context: . + platforms: linux/amd64,linux/arm64 + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + diff --git a/teleirc/matterbridge/.gitignore b/teleirc/matterbridge/.gitignore new file mode 100644 index 0000000..51f3f40 --- /dev/null +++ b/teleirc/matterbridge/.gitignore @@ -0,0 +1,9 @@ +# Exclude matterbridge binary +/matterbridge +/matterbridge.exe + +# Exclude configuration file +matterbridge.toml + +# Exclude IDE Files +.vscode diff --git a/teleirc/matterbridge/.golangci.yaml b/teleirc/matterbridge/.golangci.yaml new file mode 100644 index 0000000..63e671a --- /dev/null +++ b/teleirc/matterbridge/.golangci.yaml @@ -0,0 +1,244 @@ +# For full documentation of the configuration options please +# see: https://github.com/golangci/golangci-lint#config-file. + +# options for analysis running +run: + # default concurrency is the available CPU number + # concurrency: 4 + + # timeout for analysis, e.g. 30s, 5m, default is 1m + deadline: 5m + + # exit code when at least one issue was found, default is 1 + issues-exit-code: 1 + + # include test files or not, default is true + tests: true + + # list of build tags, all linters use it. Default is empty list. + build-tags: + + # which dirs to skip: they won't be analyzed; + # can use regexp here: generated.*, regexp is applied on full path; + # default value is empty list, but next dirs are always skipped independently + # from this option's value: + # vendor$, third_party$, testdata$, examples$, Godeps$, builtin$ + skip-dirs: gateway/bridgemap$ + + # which files to skip: they will be analyzed, but issues from them + # won't be reported. Default value is empty list, but there is + # no need to include all autogenerated files, we confidently recognize + # autogenerated files. If it's not please let us know. + skip-files: + + +# output configuration options +output: + # colored-line-number|line-number|json|tab|checkstyle, default is "colored-line-number" + format: colored-line-number + + # print lines of code with issue, default is true + print-issued-lines: true + + # print linter name in the end of issue text, default is true + print-linter-name: true + + +# all available settings of specific linters, we can set an option for +# a given linter even if we deactivate that same linter at runtime +linters-settings: + errcheck: + # report about not checking of errors in type assertions: `a := b.(MyStruct)`; + # default is false: such cases aren't reported by default. + check-type-assertions: false + + # report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`; + # default is false: such cases aren't reported by default. + check-blank: false + govet: + # report about shadowed variables + check-shadowing: true + golint: + # minimal confidence for issues, default is 0.8 + min-confidence: 0.8 + gofmt: + # simplify code: gofmt with `-s` option, true by default + simplify: true + goimports: + # put imports beginning with prefix after 3rd-party packages; + # it's a comma-separated list of prefixes + local-prefixes: github.com + gocyclo: + # minimal code complexity to report, 30 by default (but we recommend 10-20) + min-complexity: 15 + maligned: + # print struct with more effective memory layout or not, false by default + suggest-new: true + dupl: + # tokens count to trigger issue, 150 by default + threshold: 150 + goconst: + # minimal length of string constant, 3 by default + min-len: 3 + # minimal occurrences count to trigger, 3 by default + min-occurrences: 3 + depguard: + list-type: blacklist + include-go-root: false + packages: + # List of packages that we would want to blacklist for... reasons. + misspell: + # Correct spellings using locale preferences for US or UK. + # Default is to use a neutral variety of English. + # Setting locale to US will correct the British spelling of 'colour' to 'color'. + lll: + # max line length, lines longer will be reported. Default is 120. + # '\t' is counted as 1 character by default, and can be changed with the tab-width option + line-length: 150 + # tab width in spaces. Default to 1. + tab-width: 1 + unused: + # treat code as a program (not a library) and report unused exported identifiers; default is false. + # XXX: if you enable this setting, unused will report a lot of false-positives in text editors: + # if it's called for subdir of a project it can't find funcs usages. All text editor integrations + # with golangci-lint call it on a directory with the changed file. + check-exported: false + unparam: + # Inspect exported functions, default is false. Set to true if no external program/library imports your code. + # XXX: if you enable this setting, unparam will report a lot of false-positives in text editors: + # if it's called for subdir of a project it can't find external interfaces. All text editor integrations + # with golangci-lint call it on a directory with the changed file. + check-exported: false + nakedret: + # make an issue if func has more lines of code than this setting and it has naked returns; default is 30 + max-func-lines: 0 # Warn on all naked returns. + prealloc: + # XXX: we don't recommend using this linter before doing performance profiling. + # For most programs usage of prealloc will be a premature optimization. + + # Report preallocation suggestions only on simple loops that have no returns/breaks/continues/gotos in them. + # True by default. + simple: true + range-loops: true # Report preallocation suggestions on range loops, true by default + for-loops: false # Report preallocation suggestions on for loops, false by default + gocritic: + # which checks should be enabled; can't be combined with 'disabled-checks'; + # default are: [appendAssign assignOp caseOrder dupArg dupBranchBody dupCase flagDeref + # ifElseChain regexpMust singleCaseSwitch sloppyLen switchTrue typeSwitchVar underef + # unlambda unslice rangeValCopy defaultCaseOrder]; + # all checks list: https://github.com/go-critic/checkers + # disabled for now - hugeParam + enabled-checks: + - appendAssign + - assignOp + - boolExprSimplify + - builtinShadow + - captLocal + - caseOrder + - commentedOutImport + - defaultCaseOrder + - dupArg + - dupBranchBody + - dupCase + - dupSubExpr + - elseif + - emptyFallthrough + - ifElseChain + - importShadow + - indexAlloc + - methodExprCall + - nestingReduce + - offBy1 + - ptrToRefParam + - regexpMust + - singleCaseSwitch + - sloppyLen + - switchTrue + - typeSwitchVar + - typeUnparen + - underef + - unlambda + - unnecessaryBlock + - unslice + - valSwap + - wrapperFunc + - yodaStyleExpr + + +# linters that we should / shouldn't run +linters: + enable-all: true + disable: + - gochecknoglobals + - lll + - maligned + - prealloc + - wsl + - gomnd + - godox + - goerr113 + - testpackage + - godot + - interfacer + - goheader + - noctx + - gci + - errorlint + - nlreturn + - exhaustivestruct + - forbidigo + - wrapcheck + - varnamelen + - ireturn + - errorlint + - tparallel + - wrapcheck + - paralleltest + - makezero + - thelper + - cyclop + - revive + - importas + - gomoddirectives + - promlinter + - tagliatelle + - errname + - typecheck + - grouper + - decorder + - maintidx + - exhaustruct + - asasalint + - execinquery + - nosnakecase + - exhaustive +# rules to deal with reported isues +issues: + # List of regexps of issue texts to exclude, empty list by default. + # But independently from this option we use default exclude patterns, + # it can be disabled by `exclude-use-default: false`. To list all + # excluded by default patterns execute `golangci-lint run --help` + exclude: + + # Independently from option `exclude` we use default exclude patterns, + # it can be disabled by this option. To list all + # excluded by default patterns execute `golangci-lint run --help`. + # Default value for this option is true. + exclude-use-default: true + + # Maximum issues count per one linter. Set to 0 to disable. Default is 50. + max-per-linter: 0 + + # Maximum count of issues with the same text. Set to 0 to disable. Default is 3. + max-same-issues: 0 + + # Show only new issues: if there are unstaged changes or untracked files, + # only those changes are analyzed, else only changes in HEAD~ are analyzed. + # It's a super-useful option for integration of golangci-lint into existing + # large codebase. It's not practical to fix all existing issues at the moment + # of integration: much better don't allow issues in new code. + # Default is false. + new: false + + # Show only new issues created after git revision `REV` + new-from-rev: "HEAD~1" diff --git a/teleirc/matterbridge/.goreleaser.yml b/teleirc/matterbridge/.goreleaser.yml new file mode 100644 index 0000000..c4f9064 --- /dev/null +++ b/teleirc/matterbridge/.goreleaser.yml @@ -0,0 +1,41 @@ +release: + prerelease: auto + name_template: "{{.ProjectName}} v{{.Version}}" + +builds: +- env: + - CGO_ENABLED=0 + goos: + - freebsd + - windows + - darwin + - linux + - dragonfly + - netbsd + - openbsd + goarch: + - amd64 + - arm + - arm64 + - 386 + goarm: + - 6 + - 7 + ldflags: + - -s -w -X github.com/42wim/matterbridge/version.GitHash={{.ShortCommit}} + +archives: + - + id: matterbridge + builds: + - matterbridge + name_template: "{{ .Binary }}-{{ .Version }}-{{ .Os }}-{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}" + format: binary + files: + - none* + replacements: + 386: 32bit + amd64: 64bit + +checksum: + name_template: 'checksums.txt' -- cgit v1.0