From 6c2a94911fc08278c80be54956d3d9f7be9116ac Mon Sep 17 00:00:00 2001 From: Yondon Fu Date: Wed, 10 Mar 2021 15:04:35 -0500 Subject: [PATCH 1/5] .github/workflows: Rename windows action --- .github/workflows/{main.yml => windows.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{main.yml => windows.yml} (100%) diff --git a/.github/workflows/main.yml b/.github/workflows/windows.yml similarity index 100% rename from .github/workflows/main.yml rename to .github/workflows/windows.yml From b0351a6674b3ce33504913ddd7060394160f2d67 Mon Sep 17 00:00:00 2001 From: Yondon Fu Date: Thu, 11 Mar 2021 15:29:45 -0500 Subject: [PATCH 2/5] .github/workflows: Use GITHUB_REF for Windows build --- .github/workflows/windows.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index ffa48f262c..4fe13f0d8f 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -23,7 +23,7 @@ jobs: - name: Upload build shell: msys2 {0} env: - CIRCLE_BRANCH: ${{ github.head_ref }} + GITHUB_REF: ${{ github.ref }} GCLOUD_KEY: ${{ secrets.GCLOUD_KEY }} GCLOUD_SECRET: ${{ secrets.GCLOUD_SECRET }} DISCORD_URL: ${{ secrets.DISCORD_URL }} From 8c931f69cdfb22ea82896d931e796f57bb0b975a Mon Sep 17 00:00:00 2001 From: Yondon Fu Date: Wed, 10 Mar 2021 15:30:31 -0500 Subject: [PATCH 3/5] ci: Remove CircleCI config --- .circleci/config.yml | 107 ------------------------------------------- ci_env.sh | 4 +- upload_build.sh | 2 +- 3 files changed, 2 insertions(+), 111 deletions(-) delete mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index ecc69af3aa..0000000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,107 +0,0 @@ -version: 2 - -workflows: - version: 2 - build_and_test: - jobs: - - build-builder - - build: - requires: - - build-builder - -jobs: - build-builder: - docker: - - image: circleci/golang:1.15.5 - working_directory: /go/src/github.com/livepeer/go-livepeer - - environment: - PKG_CONFIG_PATH: /root/compiled/lib/pkgconfig - GOPATH: /go - DOCKER_CLI_EXPERIMENTAL: enabled - - steps: - - checkout - - setup_remote_docker - - run: docker login -u $DOCKER_USER -p $DOCKER_PASS - - # First, build the Linux-specific builder container - - run: docker pull livepeerci/build-platform:latest || echo 'no pre-existing cache found' - - run: docker build -t livepeerci/build-platform:latest --cache-from=livepeerci/build-platform:latest -f docker/Dockerfile.build-linux . - - run: docker push livepeerci/build-platform:latest - - # Then, build the actual app in a container shared between Linux and Windows - - run: docker pull livepeerci/build:latest || echo 'no pre-existing cache found' - - run: |- - ./ci_env.sh docker build --build-arg HIGHEST_CHAIN_TAG -t livepeerci/build:latest --cache-from=livepeerci/build:latest -f docker/Dockerfile.build . - - run: docker push livepeerci/build:latest - - # Finally, build the minimal go-livepeer distributable. We publish two tags for each build: - # livepeer/go-livepeer:BRANCH_NAME and livepeer/go-livepeer:VERSION_STRING. Both are useful - # to pull from in different contexts. - - run: |- - # Our Docker tag name should be our branch name with just alphanums - BRANCH_TAG=$(echo $CIRCLE_BRANCH | sed 's/\//-/g' | tr -cd '[:alnum:]_-') - VERSION_TAG=$(./print_version.sh) - docker build -t current-build -f docker/Dockerfile.release-linux . - for TAG in $BRANCH_TAG $VERSION_TAG; do - docker tag current-build livepeer/go-livepeer:${TAG}-linux - docker push livepeer/go-livepeer:${TAG}-linux - # Manifest step is optional in case the Windows build hasn't finished yet - docker manifest create livepeer/go-livepeer:${TAG} livepeer/go-livepeer:${TAG}-linux livepeer/go-livepeer:${TAG}-windows || true - docker manifest push livepeer/go-livepeer:${TAG} || true - done - - build: - docker: - # Note race condition - we might get the wrong builder if lots of builds are happening in - # parallel because this pulls it down from Docker Hub. - - image: livepeerci/build:latest - working_directory: /build - - environment: - PKG_CONFIG_PATH: /root/compiled/lib/pkgconfig - TEST_RESULTS: /tmp/test-results - GOPATH: /go - - steps: - - checkout - - - setup_remote_docker - - - run: mkdir -p $TEST_RESULTS - - - run: - name: Lint - command: | - golangci-lint --disable-all --enable=gofmt --enable=vet --enable=golint --deadline=4m run pm verification - - - run: - name: Run unit tests - command: | - trap "go-junit-report <${TEST_RESULTS}/go-test.out > ${TEST_RESULTS}/go-test-report.xml" EXIT - /bin/bash test.sh 2>&1 | tee $TEST_RESULTS/go-test.out - - - run: - name: Localdocker build check - command: make localdocker - - - run: - name: Upload build - command: ./upload_build.sh - - - run: - name: Notify that new build has been uploaded - command: curl -X POST https://holy-bread-207a.livepeer.workers.dev - - - save_cache: - key: v3-pkg-cache - paths: - - "/go/pkg" - - "/home/circleci/compiled" - - "/home/circleci/nasm/nasm" - - "/home/circleci/x264/x264" - - "/home/circleci/ffmpeg/libavcodec/libavcodec.a" - - - store_test_results: - path: /tmp/test-results diff --git a/ci_env.sh b/ci_env.sh index df4178a089..7cbfe3ef9f 100755 --- a/ci_env.sh +++ b/ci_env.sh @@ -22,9 +22,7 @@ fi NETWORK_BRANCHES="dev rinkeby" branch="" -if [[ "${CIRCLE_BRANCH:-}" != "" ]]; then - branch="$CIRCLE_BRANCH" -elif [[ "${TRAVIS_BRANCH:-}" != "" ]]; then +if [[ "${TRAVIS_BRANCH:-}" != "" ]]; then branch="$TRAVIS_BRANCH" fi diff --git a/upload_build.sh b/upload_build.sh index c93114de34..c996e2d658 100755 --- a/upload_build.sh +++ b/upload_build.sh @@ -14,7 +14,7 @@ else fi BASE="livepeer-$ARCH-amd64" -BRANCH="${TRAVIS_BRANCH:-${CIRCLE_BRANCH:-unknown}}" +BRANCH="${TRAVIS_BRANCH:-unknown}" if [[ "${GITHUB_REF:-}" != "" ]]; then BRANCH="$(echo $GITHUB_REF | sed 's/refs\/heads\///')" fi From 254665c7df23a91b57abcd5c3758a86c48fc9a79 Mon Sep 17 00:00:00 2001 From: Yondon Fu Date: Wed, 10 Mar 2021 15:30:08 -0500 Subject: [PATCH 4/5] .github/workflows: Add Linux build + test action --- .github/workflows/linux.yml | 80 +++++++++++++++++++++++++++++++++++++ ci_env.sh | 2 + 2 files changed, 82 insertions(+) create mode 100644 .github/workflows/linux.yml diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml new file mode 100644 index 0000000000..c3ac77c363 --- /dev/null +++ b/.github/workflows/linux.yml @@ -0,0 +1,80 @@ +name: Linux Build +on: push +jobs: + build: + runs-on: ubuntu-16.04 + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + # Needed for commands that depend on git tags + fetch-depth: 0 + - name: Set global environment variables + run: | + echo "PKG_CONFIG_PATH=/root/compiled/lib/pkgconfig" >> $GITHUB_ENV + echo "GOPATH=/go" >> $GITHUB_ENV + - name: DockerHub login + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASS }} + - name: Build Linux specific builder container + run: | + docker pull livepeerci/build-platform:latest || echo 'no pre-existing cache found' + docker build -t livepeerci/build-platform:latest --cache-from=livepeerci/build-platform:latest -f docker/Dockerfile.build-linux . + docker push livepeerci/build-platform:latest + - name: Build livepeer in a container shared between Linux and Windows + run: | + docker pull livepeerci/build:latest || echo 'no pre-existing cache found' + ./ci_env.sh docker build --build-arg HIGHEST_CHAIN_TAG -t livepeerci/build:latest --cache-from=livepeerci/build:latest -f docker/Dockerfile.build . + docker push livepeerci/build:latest + - name: Build minimal livepeer distributable + run: | + # We publish two tags for each build: + # livepeer/go-livepeer:BRANCH_NAME and livepeer/go-livepeer:VERSION_STRING. Both are useful + # to pull from in different contexts. + # Our Docker tag name should be our branch name with just alphanums + BRANCH_TAG=$(echo $GITHUB_REF | sed 's/refs\/heads\///' | sed 's/\//-/g' | tr -cd '[:alnum:]_-') + VERSION_TAG=$(./print_version.sh) + docker build -t current-build -f docker/Dockerfile.release-linux . + for TAG in $BRANCH_TAG $VERSION_TAG; do + docker tag current-build livepeer/go-livepeer:${TAG}-linux + docker push livepeer/go-livepeer:${TAG}-linux + # Manifest step is optional in case the Windows build hasn't finished yet + docker manifest create livepeer/go-livepeer:${TAG} livepeer/go-livepeer:${TAG}-linux livepeer/go-livepeer:${TAG}-windows || true + docker manifest push livepeer/go-livepeer:${TAG} || true + done + env: + GITHUB_REF: ${{ github.ref }} + + test: + runs-on: ubuntu-16.04 + needs: build + container: + image: livepeerci/build:latest + credentials: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASS }} + defaults: + run: + working-directory: /build + steps: + - name: Set global environment variables + run: | + echo "PKG_CONFIG_PATH=/root/compiled/lib/pkgconfig" >> $GITHUB_ENV + echo "GOPATH=/go" >> $GITHUB_ENV + - name: Lint + run: golangci-lint --disable-all --enable=gofmt --enable=vet --enable=golint --deadline=4m run pm verification + - name: Run unit tests + run: /bin/bash test.sh + - name: Local Docker build check + run: make localdocker + - name: Upload build + run: ./upload_build.sh + env: + GITHUB_REF: ${{ github.ref }} + GCLOUD_KEY: ${{ secrets.GCLOUD_KEY }} + GCLOUD_SECRET: ${{ secrets.GCLOUD_SECRET }} + DISCORD_URL: ${{ secrets.DISCORD_URL }} + - name: Notify new build upload + run: curl -X POST https://holy-bread-207a.livepeer.workers.dev diff --git a/ci_env.sh b/ci_env.sh index 7cbfe3ef9f..e953319f67 100755 --- a/ci_env.sh +++ b/ci_env.sh @@ -24,6 +24,8 @@ NETWORK_BRANCHES="dev rinkeby" branch="" if [[ "${TRAVIS_BRANCH:-}" != "" ]]; then branch="$TRAVIS_BRANCH" +elif [[ "${GITHUB_REF:-}" != "" ]]; then + branch="$(echo $GITHUB_REF | sed 's/refs\/heads\///')" fi # By default we build with mainnet support From 6a707bd08ca889b75b98460eb3291ae870404fee Mon Sep 17 00:00:00 2001 From: Yondon Fu Date: Thu, 11 Mar 2021 20:03:26 -0500 Subject: [PATCH 5/5] server: Fix flaky push OS per stream test --- server/push_test.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/server/push_test.go b/server/push_test.go index 82ae687fb7..bd67d4f6a5 100644 --- a/server/push_test.go +++ b/server/push_test.go @@ -1010,6 +1010,9 @@ func TestPush_OSPerStream(t *testing.T) { body, _ = ioutil.ReadAll(fi.Body) assert.Equal("transcoded binary data", string(body)) + // Saving to record store is async so sleep for a bit + time.Sleep(100 * time.Millisecond) + store2 := drivers.TestMemoryStorages["store2"] sess2 := store2.GetSession("sess1/" + lpmon.NodeID) assert.NotNil(sess2)