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

add videoapi grpc server and vidit tool #2

Merged
merged 56 commits into from
May 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
6a7ca20
add videoapi grpc server and vidit tool
adwski Apr 29, 2024
4ac0e80
add main menu screen and videos screen
adwski May 1, 2024
d5595d9
add upload parts handling
adwski May 6, 2024
f5aad52
add upload and quota screens
adwski May 7, 2024
96c03c2
add multipart video upload
adwski May 8, 2024
5a11f13
add media reader
adwski May 9, 2024
d3ac939
add playback meta to video object
adwski May 10, 2024
461c23e
fix case when sync sample time diff > segment duration
adwski May 10, 2024
d4b8306
fix media reader seek with whence 1
adwski May 10, 2024
137986a
add upload resume, video delete, keyMap help messages
adwski May 10, 2024
9ec4846
rm static css and js
adwski May 10, 2024
373be02
bring watch url back, add it to videos screen, also add more help key…
adwski May 10, 2024
8558d22
disable tests temporary
adwski May 10, 2024
a751f36
fix segmentation by determining max diff between sync points
adwski May 11, 2024
f5bedcf
use audio/mp4 ct for init segments
adwski May 11, 2024
185e9fa
rename readerTS
adwski May 11, 2024
94796a5
update gitignore
adwski May 11, 2024
f502ef1
fix lint errs
adwski May 11, 2024
4435baa
update golangci-lint job
adwski May 11, 2024
d8def34
update statictest job
adwski May 11, 2024
da5d9f4
fix some err handlings
adwski May 11, 2024
9e34ad1
update go in dockerfiles, fix upload name in state, go mod tidy
adwski May 11, 2024
7a69360
fix tests
adwski May 11, 2024
5a50d0d
add video service unit tests, add unittest wf job
adwski May 12, 2024
ae1c608
add goreleaser
adwski May 13, 2024
7db87e8
configure goreleaser for local build
adwski May 13, 2024
5253739
turn e2e tests job back on, fix userapi test
adwski May 13, 2024
c56a7a5
chore: update coverage badge
adwski May 13, 2024
cf32615
update video e2e tests
adwski May 14, 2024
102ebda
chore: update coverage badge
adwski May 14, 2024
a7eb3f1
rm test s3 pkg
adwski May 14, 2024
13a1478
chore: update coverage badge
adwski May 14, 2024
273f2af
add vidit state and init tests
adwski May 14, 2024
58e8335
chore: update coverage badge
adwski May 14, 2024
1775d18
add tea unittests for startup cases
adwski May 15, 2024
94fe54b
chore: update coverage badge
adwski May 15, 2024
c5dd359
add vidit e2e main flow test
adwski May 15, 2024
92cb369
try to fix missing tty error
adwski May 15, 2024
6a479ff
chore: update coverage badge
adwski May 15, 2024
17982de
rm unused video api http serviceside client
adwski May 15, 2024
7f1b8c3
chore: update coverage badge
adwski May 15, 2024
86027d3
add requestid unittests
adwski May 15, 2024
47d6521
chore: update coverage badge
adwski May 15, 2024
733951f
fix lint errs
adwski May 15, 2024
8a33952
add more auth unittests
adwski May 16, 2024
41c8d85
add vidit login and re-login e2e tests
adwski May 16, 2024
dd6476b
chore: update coverage badge
adwski May 16, 2024
9ba8aa1
add cli tests and upload resume tests
adwski May 16, 2024
e0e2b37
chore: update coverage badge
adwski May 16, 2024
f2ec549
add session store unittests
adwski May 16, 2024
e39f4e7
chore: update coverage badge
adwski May 16, 2024
9564338
add comments
adwski May 16, 2024
960cbc3
add default-file-picker-dir cmdline arg to vidit
adwski May 17, 2024
9e58a2d
rm generated ca from config.json
adwski May 17, 2024
5a887f1
update README, rm old doc
adwski May 17, 2024
4995e3b
chore: update coverage badge
adwski May 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
- uses: actions/setup-go@v5
with:
go-version: "1.21"
cache: false
go-version-file: go.mod
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.55.2
version: v1.58.1
4 changes: 2 additions & 2 deletions .github/workflows/statictest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ on:
jobs:
statictest:
runs-on: ubuntu-latest
container: golang:1.21
container: golang:1.22
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Download statictest binary
uses: robinraju/[email protected]
Expand Down
17 changes: 16 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,21 @@ report.xml
profile.cov
coverage.html

# macos stuff
.DS_Store

output
# test paths
output/
cmd/vidictl/test.go
docker/compose/config/test.xml

# certs
docker/compose/tls/*
!docker/compose/tls/placeholder

e2e/cert.pem
e2e/key.pem

dist/

tapes/frames/
61 changes: 13 additions & 48 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,15 @@
# Options for analysis running.
run:
go: "1.21"
go: "1.22"
# Settable parameters #
timeout: 5m
tests: true
build-tags: []
# Which dirs to skip: issues from them won't be reported.
skip-dirs:
- "bin"
- "scripts"
- ".ci"
- ".gradle"
# Which files to skip: they will be analyzed, but issues from them won't be reported.
skip-files: []

# Invariable parameters #

# Exit code when at least one issue was found.
issues-exit-code: 1
# Enables skipping of directories:
# - vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
skip-dirs-use-default: false
# If set we pass it to "go list -mod={option}". From "go help modules":
# If invoked with -mod=readonly, the go command is disallowed from the implicit
# automatic updating of go.mod described above. Instead, it fails when any changes
Expand All @@ -43,7 +32,8 @@ run:

# Output configuration options
output:
format: colored-line-number
formats:
- format: colored-line-number
# Print lines of code with issue.
print-issued-lines: true
# Print linter name in the end of issue text.
Expand Down Expand Up @@ -100,43 +90,11 @@ linters-settings:

gocritic:
enabled-checks:
- appendAssign
- appendCombine
- argOrder
- assignOp
- badCall
- badCond
- captLocal
- caseOrder
- commentFormatting
- defaultCaseOrder
- deprecatedComment
- dupArg
- dupBranchBody
- dupCase
- dupSubExpr
- elseif
- exitAfterDefer
- flagDeref
- flagName
- ifElseChain
- indexAlloc
- mapKey
- newDeref
- offBy1
- rangeExprCopy
- rangeValCopy
- regexpMust
- singleCaseSwitch
- sloppyLen
- stringXbytes
- switchTrue
- typeSwitchVar
- underef
- unlambda
- unslice
- valSwap
- wrapperFunc

godot:
capital: true
Expand All @@ -150,7 +108,7 @@ linters-settings:
goimports:
local-prefixes: github.com/org/project

gomnd:
mnd:
checks:
- argument
- case
Expand Down Expand Up @@ -372,15 +330,14 @@ linters:
- errcheck
- errname
- errorlint
- execinquery
- exhaustive
- gocheckcompilerdirectives
- goconst
- gocritic
- godot
- gofmt
- goimports
- gomnd
- mnd
- goprintffuncname
- gosec
- gosimple
Expand Down Expand Up @@ -418,8 +375,16 @@ linters:

# Issues configuration
issues:
exclude-dirs:
- "bin"
- "scripts"
- ".ci"
- ".gradle"
exclude: []
exclude-case-sensitive: false
# Enables skipping of directories:
# - vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
exclude-dirs-use-default: false
exclude-rules:
- path: "_test\\.go"
text: "fieldalignment: struct with \\d+ pointer bytes could be \\d+"
Expand Down
34 changes: 34 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
version: 1

before:
hooks:
- go mod tidy

builds:
- env:
- CGO_ENABLED=0
main: ./cmd/vidit
binary: vidit
tags:
- netgo
goos:
- darwin
- linux
- windows
goarch:
- "386"
- amd64
- arm64

archives:
- format: tar.gz
name_template: >-
{{- .ProjectName -}}
{{- title .Os }}_
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
{{- if .Arm }}v{{ .Arm }}{{ end }}
format_overrides:
- goos: windows
format: zip
1 change: 1 addition & 0 deletions .mockery.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ packages:
github.com/adwski/vidi/internal/api/video:
interfaces:
Store: {}
SessionStore: {}
52 changes: 41 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
SHELL := /bin/bash

.PHONY: mock
mock:
find . -type f -name "mock_*" -exec rm -rf {} +
Expand All @@ -7,28 +9,36 @@ mock:
docker-dev:
cd docker/compose ;\
docker compose up -d
docker ps

.PHONY: docker-infra
docker-infra:
cd docker/compose ;\
docker compose -f docker-compose.infra.yml up -d
docker ps
docker compose -f docker-compose.infra.yml -f docker-compose.nginx.yml up -d

.PHONY: docker-infra-clean
docker-infra-clean:
cd docker/compose ;\
docker compose -f docker-compose.infra.yml down -v
docker ps
docker compose -f docker-compose.infra.yml -f docker-compose.nginx.yml down -v

.PHONY: docker-dev-build
docker-dev-build:
cd docker/compose ;\
docker compose up -d --build
docker ps

.PHONY: docker-dev-build-svc
docker-dev-build-svc:
cd docker/compose ;\
docker compose up -d --no-deps --build $$SVC

.PHONY: docker-dev-clean
docker-dev-clean:
cd docker/compose ;\
docker compose down -v

.PHONY: docker-ps
docker-ps:
docker ps --format="table {{.Image}}\t{{.Status}}\t{{.Names}}"

.PHONY: goimports
goimports:
goimports -w .
Expand All @@ -37,16 +47,19 @@ goimports:
lint:
golangci-lint run ./...

.PHONY: build
build:
go build -gcflags "-m" -race -o ./cmd/userapi/userapi ./cmd/userapi/*.go
build-tui:
goreleaser build --debug --clean

.PHONY: statictest
statictest:
go vet -vettool=$$(which statictest) ./...

.PHONY: test-nginx
test-nginx:
docker run --rm -it --entrypoint nginx -v ./docker/compose/nginx.conf:/etc/nginx/nginx.conf nginx:1.25.3-bookworm -t
docker run --rm -it --entrypoint nginx \
-v ./docker/compose/tls:/etc/nginx/tls \
-v ./docker/compose/nginx.conf:/etc/nginx/nginx.conf \
nginx:1.25.3-bookworm -t

.PHONY: unittests
unittests:
Expand All @@ -56,10 +69,27 @@ unittests:
cover:
go tool cover -html profile.cov -o coverage.html


.PHONY: test-all
test-all: docker-infra
go test -v -count=1 -cover -coverpkg=./... -coverprofile=profile.cov --tags e2e ./...
go tool cover -func profile.cov
$(MAKE) cover
$(MAKE) docker-infra-clean

.PHONY: grpc
grpc:
protoc --go_out=. --go-grpc_out=. internal/api/video/grpc/protobuf/user.proto
protoc --go_out=. --go-grpc_out=. internal/api/video/grpc/protobuf/service.proto

.PHONY: tls
tls:
openssl req -x509 -nodes -days 365 -newkey rsa:4096 \
-keyout ./docker/compose/tls/key.pem -out ./docker/compose/tls/cert.pem \
-subj "/C=RU/O=ViDi/OU=vidi/CN=vidi" \
-addext "subjectAltName = DNS:localhost, IP:127.0.0.1, IP:::1"

VIDI_CA=$$(base64 -i ./docker/compose/tls/cert.pem) && \
tmp=$$(mktemp) && \
cfg="./docker/compose/config/config.json" && \
jq --arg a "$$VIDI_CA" '.vidi_ca = $$a' $$cfg > $$tmp && \
mv $$tmp $$cfg
Loading