diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 000000000..1a074d18b --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,17 @@ +name: build +on: + push: + branches: + - master + pull_request: + branches: + - master +jobs: + build: + name: build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: build + run: make build diff --git a/.github/workflows/docker-avp.yaml b/.github/workflows/docker-avp.yaml new file mode 100644 index 000000000..2e3d8fa56 --- /dev/null +++ b/.github/workflows/docker-avp.yaml @@ -0,0 +1,34 @@ +name: avp docker +on: + push: + branches: + - master + release: + types: [published] + pull_request: + branches: + - master +jobs: + build: + name: build and push + runs-on: ubuntu-latest + timeout-minutes: 3 + steps: + - uses: actions/checkout@v2 + + - name: build + run: docker build --tag pionwebrtc/ion/avp:latest -f docker/avp.Dockerfile . + + - name: login + if: github.event_name == 'release' + run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin + + - name: tag + if: github.event_name == 'release' + run: docker tag pionwebrtc/ion/avp:latest pionwebrtc/ion/avp:"$TAG" + env: + TAG: ${{ github.event.release.tag_name }} + + - name: push + if: github.event_name == 'release' + run: docker push pionwebrtc/ion/avp diff --git a/.github/workflows/docker-biz.yaml b/.github/workflows/docker-biz.yaml new file mode 100644 index 000000000..61bd8cc4d --- /dev/null +++ b/.github/workflows/docker-biz.yaml @@ -0,0 +1,34 @@ +name: biz docker +on: + push: + branches: + - master + release: + types: [published] + pull_request: + branches: + - master +jobs: + build: + name: build and push + runs-on: ubuntu-latest + timeout-minutes: 3 + steps: + - uses: actions/checkout@v2 + + - name: build + run: docker build --tag pionwebrtc/ion/biz:latest -f docker/biz.Dockerfile . + + - name: login + if: github.event_name == 'release' + run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin + + - name: tag + if: github.event_name == 'release' + run: docker tag pionwebrtc/ion/biz:latest pionwebrtc/ion/biz:"$TAG" + env: + TAG: ${{ github.event.release.tag_name }} + + - name: push + if: github.event_name == 'release' + run: docker push pionwebrtc/ion/biz diff --git a/.github/workflows/docker-islb.yaml b/.github/workflows/docker-islb.yaml new file mode 100644 index 000000000..f26e57b55 --- /dev/null +++ b/.github/workflows/docker-islb.yaml @@ -0,0 +1,34 @@ +name: islb docker +on: + push: + branches: + - master + release: + types: [published] + pull_request: + branches: + - master +jobs: + build: + name: build and push + runs-on: ubuntu-latest + timeout-minutes: 3 + steps: + - uses: actions/checkout@v2 + + - name: build + run: docker build --tag pionwebrtc/ion/islb:latest -f docker/islb.Dockerfile . + + - name: login + if: github.event_name == 'release' + run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin + + - name: tag + if: github.event_name == 'release' + run: docker tag pionwebrtc/ion/islb:latest pionwebrtc/ion/islb:"$TAG" + env: + TAG: ${{ github.event.release.tag_name }} + + - name: push + if: github.event_name == 'release' + run: docker push pionwebrtc/ion/islb diff --git a/.github/workflows/docker-sfu.yaml b/.github/workflows/docker-sfu.yaml new file mode 100644 index 000000000..f2893c1f8 --- /dev/null +++ b/.github/workflows/docker-sfu.yaml @@ -0,0 +1,34 @@ +name: sfu docker +on: + push: + branches: + - master + release: + types: [published] + pull_request: + branches: + - master +jobs: + build: + name: build and push + runs-on: ubuntu-latest + timeout-minutes: 3 + steps: + - uses: actions/checkout@v2 + + - name: build + run: docker build --tag pionwebrtc/ion/sfu:latest -f docker/sfu.Dockerfile . + + - name: login + if: github.event_name == 'release' + run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin + + - name: tag + if: github.event_name == 'release' + run: docker tag pionwebrtc/ion/sfu:latest pionwebrtc/ion/sfu:"$TAG" + env: + TAG: ${{ github.event.release.tag_name }} + + - name: push + if: github.event_name == 'release' + run: docker push pionwebrtc/ion/sfu diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 000000000..d76c53ed1 --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,23 @@ +name: test +on: + push: + branches: + - master + pull_request: + branches: + - master +jobs: + test: + name: test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: test + run: make test + + - uses: codecov/codecov-action@v1 + with: + file: ./cover.out + name: codecov-umbrella + fail_ci_if_error: true diff --git a/Makefile b/Makefile index bc3b62e54..87a64edcb 100644 --- a/Makefile +++ b/Makefile @@ -5,34 +5,33 @@ GO_COVERPKGS:=$(shell echo $(GO_TESTPKGS) | paste -s -d ',') TEST_UID:=$(shell id -u) TEST_GID:=$(shell id -g) -all: nodes - -deps: - ./scripts/install-run-deps.sh - -go_deps: - go mod download +all: build clean: rm -rf bin -upx: - upx -9 bin/* - -example: - go build -o bin/service-node $(GO_LDFLAGS) examples/service/service-node.go - go build -o bin/service-watch $(GO_LDFLAGS) examples/watch/service-watch.go +go_deps: + go mod download + go generate ./... -nodes: go_deps +build: go_deps go build -o bin/biz $(GO_LDFLAGS) cmd/biz/main.go go build -o bin/islb $(GO_LDFLAGS) cmd/islb/main.go go build -o bin/sfu $(GO_LDFLAGS) cmd/sfu/main.go + go build -o bin/avp $(GO_LDFLAGS) cmd/avp/main.go -start_test_services: +start-services: docker network create ionnet || true - docker-compose -f docker-compose.stable.yml up -d redis nats etcd + docker-compose -f docker-compose.yml up -d redis nats etcd + +stop-services: + docker-compose -f docker-compose.yml stop redis nats etcd + +run: + docker-compose up --build -test: nodes start_test_services +test: go_deps start-services go test \ + -timeout 120s \ -coverpkg=${GO_COVERPKGS} -coverprofile=cover.out -covermode=atomic \ -v -race ${GO_TESTPKGS} diff --git a/codecov.yml b/codecov.yml index 44be0a36d..b8a2f37f6 100644 --- a/codecov.yml +++ b/codecov.yml @@ -1,9 +1,3 @@ -# -# DO NOT EDIT THIS FILE DIRECTLY -# -# It is automatically copied from https://github.com/pion/.goassets repository. -# - coverage: status: project: @@ -13,7 +7,4 @@ coverage: patch: off ignore: - - "cmd/*" - - "cmd/**/*" - - "pkg/node/*" - - "pkg/node/**/*" + - "cmd/*" \ No newline at end of file diff --git a/docker-compose.stable.yml b/docker-compose.stable.yml index 4f65e3bc0..c294d5173 100644 --- a/docker-compose.stable.yml +++ b/docker-compose.stable.yml @@ -1,30 +1,39 @@ version: "3.7" services: - sfu: - image: pionwebrtc/ion-sfu:v0.4.6 + biz: + image: pionwebrtc/ion/biz:v1.5.1 + volumes: + - "./configs/certs:/configs/certs" ports: - - "5000-5200:5000-5200/udp" + - 8443:8443 depends_on: - nats - etcd networks: - ionnet - biz: - image: pionwebrtc/ion-biz:v0.4.6 - volumes: - - "./configs/certs:/configs/certs" + sfu: + image: pionwebrtc/ion/sfu:v1.5.1 ports: - - 8443:8443 + - "5000-5200:5000-5200/udp" + depends_on: + - nats + - etcd networks: - ionnet + + avp: + image: pionwebrtc/ion/avp:v1.5.1 depends_on: - nats - etcd + networks: + - ionnet + islb: - image: pionwebrtc/ion-islb:v0.4.6 + image: pionwebrtc/ion/islb:v1.5.1 depends_on: - nats - etcd @@ -34,8 +43,6 @@ services: nats: image: nats - ports: - - 4223:4222 networks: - ionnet @@ -43,15 +50,11 @@ services: image: gcr.io/etcd-development/etcd:v3.4.14 entrypoint: "/usr/local/bin/etcd" command: "--listen-client-urls http://0.0.0.0:2379 --advertise-client-urls http://0.0.0.0:2379" - ports: - - 2389:2379 networks: - ionnet redis: - image: redis:5.0.10 - ports: - - 6380:6379 + image: redis:6.0.9 networks: - ionnet diff --git a/docker-compose.yml b/docker-compose.yml index 84fce9ca6..a4dc62fd4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,58 +1,58 @@ version: "3.7" services: - sfu: - image: pionwebrtc/ion-sfu:latest + islb: + image: pionwebrtc/ion/islb:latest build: - dockerfile: ./docker/sfu.Dockerfile + dockerfile: ./docker/islb.Dockerfile context: . volumes: - - "./configs/docker/sfu.toml:/configs/sfu.toml" - ports: - - "5000-5200:5000-5200/udp" + - "./configs/docker/islb.toml:/configs/islb.toml" depends_on: - nats - etcd + - redis networks: - ionnet - biz: - image: pionwebrtc/ion-biz:latest + sfu: + image: pionwebrtc/ion/sfu:latest build: - dockerfile: ./docker/biz.Dockerfile + dockerfile: ./docker/sfu.Dockerfile context: . volumes: - - "./configs/docker/biz.toml:/configs/biz.toml" + - "./configs/docker/sfu.toml:/configs/sfu.toml" ports: - - 8443:8443 - networks: - - ionnet + - "5000-5200:5000-5200/udp" depends_on: - nats - etcd + networks: + - ionnet - islb: - image: pionwebrtc/ion-islb:latest + avp: + image: pionwebrtc/ion/avp:latest build: - dockerfile: ./docker/islb.Dockerfile + dockerfile: ./docker/avp.Dockerfile context: . volumes: - - "./configs/docker/islb.toml:/configs/islb.toml" + - "./configs/docker/avp.toml:/configs/avp.toml" + - "./out:/out/" depends_on: - nats - etcd - - redis networks: - ionnet - avp: - image: pionwebrtc/ion-avp:latest + biz: + image: pionwebrtc/ion/biz:latest build: - dockerfile: ./docker/avp.Dockerfile + dockerfile: ./docker/biz.Dockerfile context: . volumes: - - "./configs/docker/avp.toml:/configs/avp.toml" - - "./out:/out/" + - "./configs/docker/biz.toml:/configs/biz.toml" + ports: + - 8443:8443 depends_on: - nats - etcd @@ -62,7 +62,7 @@ services: nats: image: nats ports: - - 4223:4222 + - 4222:4222 networks: - ionnet @@ -71,14 +71,14 @@ services: entrypoint: "/usr/local/bin/etcd" command: "--listen-client-urls http://0.0.0.0:2379 --advertise-client-urls http://0.0.0.0:2379" ports: - - 2389:2379 + - 2379:2379 networks: - ionnet redis: - image: redis:5.0.10 + image: redis:6.0.9 ports: - - 6380:6379 + - 6379:6379 networks: - ionnet diff --git a/pkg/db/redis_test.go b/pkg/db/redis_test.go index 118f30261..a22982690 100644 --- a/pkg/db/redis_test.go +++ b/pkg/db/redis_test.go @@ -42,7 +42,7 @@ var ( func init() { cfg := Config{ - Addrs: []string{":6380"}, + Addrs: []string{":6379"}, Pwd: "", DB: 0, }