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

Linux build and test GH action #1791

Merged
merged 5 commits into from
Mar 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
107 changes: 0 additions & 107 deletions .circleci/config.yml

This file was deleted.

80 changes: 80 additions & 0 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
6 changes: 3 additions & 3 deletions ci_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ fi
NETWORK_BRANCHES="dev rinkeby"

branch=""
if [[ "${CIRCLE_BRANCH:-}" != "" ]]; then
branch="$CIRCLE_BRANCH"
elif [[ "${TRAVIS_BRANCH:-}" != "" ]]; then
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
Expand Down
3 changes: 3 additions & 0 deletions server/push_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion upload_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down