Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
fugkco committed Dec 28, 2020
0 parents commit 0921e34
Show file tree
Hide file tree
Showing 16 changed files with 1,425 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .Dockerfile.goreleaser
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM scratch
COPY iptv-proxy /
ENTRYPOINT ["/iptv-proxy"]
33 changes: 33 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: CD

on:
push:
tags:
- '*'

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v2
-
name: Unshallow
run: git fetch --prune --unshallow
-
name: Github Docker login
run: echo ${{ secrets.GHCR_PAT }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin
-
name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.14
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release --rm-dist --skip-sign
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
70 changes: 70 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: CI

on:
pull_request:
push:

env:
GO111MODULE: on

jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.14.x
- name: Checkout code
uses: actions/checkout@v2
- name: Run linters
uses: golangci/golangci-lint-action@v2
with:
version: v1.29

vet:
runs-on: ubuntu-latest
steps:
- name: Install Go
if: success()
uses: actions/setup-go@v2
with:
go-version: 1.14.x
- name: Checkout code
uses: actions/checkout@v2
- name: Run vet
run: go vet ./...

test:
runs-on: ubuntu-latest
steps:
- name: Install Go
if: success()
uses: actions/setup-go@v2
with:
go-version: 1.14.x
- name: Checkout code
uses: actions/checkout@v2
- name: Run tests
run: go test -v -covermode=count ./...

coverage:
runs-on: ubuntu-latest
steps:
- name: Install Go
if: success()
uses: actions/setup-go@v2
with:
go-version: 1.14.x
- name: Checkout code
uses: actions/checkout@v2
- name: Calc coverage
run: |
go test -v -covermode=count -coverprofile=coverage.out ./...
- name: Convert coverage.out to coverage.lcov
uses: jandelgado/gcov2lcov-action@v1.0.6
- name: Coveralls
uses: coverallsapp/github-action@v1.1.2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: coverage.lcov
16 changes: 16 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Binaries for programs and plugins
*.exe
*.dll
*.so
*.dylib

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

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

/iptv-proxy
*.m3u
vendor
dist
65 changes: 65 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
project_name: iptv-proxy

builds:
- id: iptv-proxy
main: ./cmd/iptv-proxy/main.go
binary: iptv-proxy
env:
- CGO_ENABLED=0
goos:
- linux

goarch:
- amd64
- arm
- arm64

release:
github:
owner: fugkco
name: iptv-proxy
draft: false

dockers:
- &docker_build
goos: linux
goarch: amd64
binaries:
- iptv-proxy
builds:
- iptv-proxy
image_templates:
- "ghcr.io/fugkco/iptv-proxy:{{ .Tag }}-amd64"
- "ghcr.io/fugkco/iptv-proxy:v{{ .Major }}-amd64"
- "ghcr.io/fugkco/iptv-proxy:v{{ .Major }}.{{ .Minor }}-amd64"
- "ghcr.io/fugkco/iptv-proxy:latest-amd64"

skip_push: false

build_flag_templates:
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.name={{.ProjectName}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"

dockerfile: .Dockerfile.goreleaser
- <<: *docker_build
goarch: arm
goarm: 6
image_templates:
- "ghcr.io/fugkco/iptv-proxy:{{ .Tag }}-arm32v7"
- "ghcr.io/fugkco/iptv-proxy:v{{ .Major }}-arm32v7"
- "ghcr.io/fugkco/iptv-proxy:v{{ .Major }}.{{ .Minor }}-arm32v7"
- "ghcr.io/fugkco/iptv-proxy:latest-arm32v7"

- <<: *docker_build
goarch: arm64
image_templates:
- "ghcr.io/fugkco/iptv-proxy:{{ .Tag }}-arm64v8"
- "ghcr.io/fugkco/iptv-proxy:v{{ .Major }}-arm64v8"
- "ghcr.io/fugkco/iptv-proxy:v{{ .Major }}.{{ .Minor }}-arm64v8"
- "ghcr.io/fugkco/iptv-proxy:latest-arm64v8"

# .goreleaser.yml
checksum:
name_template: "{{ .ProjectName }}_{{ .Version }}_checksums.txt"
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM golang:1.14.4-alpine

WORKDIR /src
COPY . .
RUN GO111MODULE=on CGO_ENABLED=0 GOOS=linux go build -a -o iptv-proxy ./cmd/iptv-proxy/main.go

FROM scratch
COPY --from=0 /src/iptv-proxy /
ENTRYPOINT ["/iptv-proxy"]
Loading

0 comments on commit 0921e34

Please sign in to comment.