Skip to content

Commit

Permalink
chore: first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Lunkers committed Feb 14, 2025
0 parents commit f54ef4c
Show file tree
Hide file tree
Showing 10 changed files with 263 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Go

on:
push:
branches: [main]
pull_request:
branches: [main]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
build:
strategy:
matrix:
platform: [macos-latest, ubuntu-latest, windows-latest]
go-version: ["1.23"]
runs-on: ${{ matrix.platform }}
steps:
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}

- name: Checkout
uses: actions/checkout@v4

- name: Download Go dependencies
run: go mod download
env:
GOPROXY: "https://proxy.golang.org"

- name: Build
run: go build -v ./...

- name: Test
run: go test -v ./...
24 changes: 24 additions & 0 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: golangci-lint
on:
push:
tags:
- v*
branches:
- main
pull_request:
jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
only-new-issues: true

- name: go-report-card
uses: creekorful/goreportcard-action@v1.0
with:
only-new-issues: true
18 changes: 18 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib

# Test binary, built with `go test -c`
*.test

# Output of the make coverage target
coverage.*

# Dependency directories (remove the comment below to include it)
vendor/

# Configuration from VSCode
*.DS_Store
11 changes: 11 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
linters:
enable:
- lll

linters-settings:
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: 120
# tab width in spaces. Default to 1.
tab-width: 4
18 changes: 18 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
- id: trailing-whitespace
- repo: https://github.com/dnephin/pre-commit-golang
rev: v0.5.0
hooks:
- id: go-fmt
- id: golangci-lint
- id: go-unit-tests
- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
rev: v8.0.0
hooks:
- id: commitlint
stages: [commit-msg]
additional_dependencies: ['@commitlint/config-conventional']
10 changes: 10 additions & 0 deletions .wwhrd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
denylist:

allowlist:
- Apache-2.0
- MIT
- BSD-2-Clause
- BSD-3-Clause
- CC0-1.0

exceptions:
29 changes: 29 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Added

- ...

### Changed

- ...

### Removed

- ...

## [0.1.0] - 2024-01-15

### Added

- initial version of the repo

[Unreleased]: https://github.com/Eyevinn/mp2ts-tools/releases/tag/v0.1.0...HEAD
[0.1.0]: https://github.com/Eyevinn/mp2ts-tools/releases/tag/v0.1.0
47 changes: 47 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
.PHONY: all
all: lint test coverage check-licenses build

.PHONY: build
build: cmd1 cmd2

.PHONY: lint
lint: prepare
golangci-lint run

.PHONY: prepare
prepare:
go mod vendor

cmd1 cmd2:
go build -ldflags "-X github.com/Eyevinn/{Name}/internal.commitVersion=$$(git describe --tags HEAD) -X github.com/Eyevinn/{Name}/internal.commitDate=$$(git log -1 --format=%ct)" -o out/$@ ./cmd/$@/main.go

.PHONY: test
test: prepare
go test ./...

.PHONY: coverage
coverage:
# Ignore (allow) packages without any tests
set -o pipefail
go test ./... -coverprofile coverage.out
set +o pipefail
go tool cover -html=coverage.out -o coverage.html
go tool cover -func coverage.out -o coverage.txt
tail -1 coverage.txt

.PHONY: clean
clean:
rm -f out/*
rm -r examples-out/*

.PHONY: install
install: all
cp out/* $(GOPATH)/bin/

.PHONY: update
update:
go get -t -u ./...

.PHONY: check-licenses
check-licenses: prepare
wwhrd check
34 changes: 34 additions & 0 deletions readme-go-default.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# go-default

This is a default setup for Go projects.

Use `internal` directories for code that should not be exported.
Use `testdata` directories for test files.

## Get started

1. Run "go mod init github/Eyevinn/name"
2. Edit the installed files appropriately
3. Place code for executables in directories with proper names under cmd/cmd1 etc
and update the Makefile
4. To run the license check program `wwhrd`. Check its web site for how to install
5. The readme.md file requires quite some work to be updated. Check [mp4ff][mp4ff]
for an example how to update it.
6. For code coverage (open source projects), you can use coveralls.io in the same
way as [mp4ff][coveralls].


## Included

The defaults for all go projects include:

- A .gitignore file
- Github actions for running tests and golang-ci-lint
- A Makefile for running tests, coverage, and update dependencies.
Exchange cmd1, cmd2 with the names of your binaries.
- A README skeleton (update badges to Go, see e.g. mp4ff)
- A CHANGELOG.md file that should be changed manually
- A config file for pre-commit (see https://pre-commit.com)

[mp4ff]: https://github.com/Eyevinn/mp4ff
[coveralls]: https://coveralls.io/github/Eyevinn/mp4ff
36 changes: 36 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# {{Name}}

<!--
## Requirements
Add any external project dependencies such as node.js version etc here
## Installation / Usage
Add clear instructions on how to use the project here
## Development
Add clear instructions on how to start development of the project here
-->

### Contributing

See [CONTRIBUTING](CONTRIBUTING.md)

# Support

Join our [community on Slack](http://slack.streamingtech.se) where you can post any questions regarding any of our open source projects. Eyevinn's consulting business can also offer you:

- Further development of this component
- Customization and integration of this component into your platform
- Support and maintenance agreement

Contact [sales@eyevinn.se](mailto:sales@eyevinn.se) if you are interested.

# About Eyevinn Technology

[Eyevinn Technology](https://www.eyevinntechnology.se) is an independent consultant firm specialized in video and streaming. Independent in a way that we are not commercially tied to any platform or technology vendor. As our way to innovate and push the industry forward we develop proof-of-concepts and tools. The things we learn and the code we write we share with the industry in [blogs](https://dev.to/video) and by open sourcing the code we have written.

Want to know more about Eyevinn and how it is to work here. Contact us at work@eyevinn.se!

0 comments on commit f54ef4c

Please sign in to comment.