Skip to content

Commit

Permalink
.github/workflows: Add Linux build + test action
Browse files Browse the repository at this point in the history
  • Loading branch information
yondonfu committed Mar 11, 2021
1 parent 8c931f6 commit 254665c
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 0 deletions.
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
2 changes: 2 additions & 0 deletions ci_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 254665c

Please sign in to comment.