feat[cicd]: Add docker image building Github action #6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CICD | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
golint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: "1.20" | |
- name: Prepare UT mocks | |
run: | | |
go install github.com/vektra/mockery/[email protected] | |
mockery --dir db --name PersistenceManager | |
mockery --dir db --name ConnectionManager | |
mockery --dir utils --name SegmentReader | |
mockery --dir utils --name VideoSegmentCache | |
mockery --dir utils --name S3Client | |
mockery --dir utils --name Broadcaster | |
mockery --dir vod --name PlaylistBuilder | |
mockery --dir vod --name SegmentManager | |
mockery --dir vod --name PlaylistManager | |
mockery --dir api --name RequestResponseClient | |
mockery --dir control --name SystemManager | |
mockery --dir control --name EdgeRequestClient | |
mockery --dir edge --name VideoSourceOperator | |
mockery --dir forwarder --name SegmentSender | |
mockery --dir forwarder --name RecordingSegmentForwarder | |
mockery --dir forwarder --name LiveStreamSegmentForwarder | |
- name: golint | |
uses: Jerome1337/[email protected] | |
with: | |
golint-path: "./..." | |
golangci-lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: "1.20" | |
- name: Prepare UT mocks | |
run: | | |
go install github.com/vektra/mockery/[email protected] | |
mockery --dir db --name PersistenceManager | |
mockery --dir db --name ConnectionManager | |
mockery --dir utils --name SegmentReader | |
mockery --dir utils --name VideoSegmentCache | |
mockery --dir utils --name S3Client | |
mockery --dir utils --name Broadcaster | |
mockery --dir vod --name PlaylistBuilder | |
mockery --dir vod --name SegmentManager | |
mockery --dir vod --name PlaylistManager | |
mockery --dir api --name RequestResponseClient | |
mockery --dir control --name SystemManager | |
mockery --dir control --name EdgeRequestClient | |
mockery --dir edge --name VideoSourceOperator | |
mockery --dir forwarder --name SegmentSender | |
mockery --dir forwarder --name RecordingSegmentForwarder | |
mockery --dir forwarder --name LiveStreamSegmentForwarder | |
- name: golangci-lint | |
uses: golangci/golangci-lint-action@v3 | |
with: | |
version: v1.51.2 | |
args: --timeout 3m0s | |
test: | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:15 | |
env: | |
POSTGRES_DB: postgres | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
ports: | |
- 5432:5432 | |
memcached: | |
image: bitnami/memcached:1.6.20 | |
ports: | |
- 11211:11211 | |
minio: | |
image: bitnami/minio:latest | |
env: | |
MINIO_ROOT_USER: root | |
MINIO_ROOT_PASSWORD: password | |
ports: | |
- 9000:9000 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: "1.20" | |
- name: Prepare UT mocks | |
run: | | |
go install github.com/vektra/mockery/[email protected] | |
mockery --dir db --name PersistenceManager | |
mockery --dir db --name ConnectionManager | |
mockery --dir utils --name SegmentReader | |
mockery --dir utils --name VideoSegmentCache | |
mockery --dir utils --name S3Client | |
mockery --dir utils --name Broadcaster | |
mockery --dir vod --name PlaylistBuilder | |
mockery --dir vod --name SegmentManager | |
mockery --dir vod --name PlaylistManager | |
mockery --dir api --name RequestResponseClient | |
mockery --dir control --name SystemManager | |
mockery --dir control --name EdgeRequestClient | |
mockery --dir edge --name VideoSourceOperator | |
mockery --dir forwarder --name SegmentSender | |
mockery --dir forwarder --name RecordingSegmentForwarder | |
mockery --dir forwarder --name LiveStreamSegmentForwarder | |
- name: Build | |
run: | | |
go build -o livemix.bin . | |
go build -o livemix-util.bin ./bin/util/... | |
- name: Test | |
run: go test --count 1 -timeout 60s -short ./... | |
env: | |
GOOGLE_APPLICATION_CREDENTIALS: /tmp/gcp-creds.json | |
PGHOST: localhost | |
PGPORT: "5432" | |
PGDATABASE: postgres | |
PGUSER: postgres | |
PGPASSWORD: postgres | |
MEMCACHED_HOST: localhost | |
MEMCACHED_PORT: "11211" | |
UNITTEST_S3_ENDPOINT: "localhost:9000" | |
AWS_ACCESS_KEY_ID: root | |
AWS_SECRET_ACCESS_KEY: password |