-
Notifications
You must be signed in to change notification settings - Fork 182
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
.github/workflows: Add Linux build + test action
- Loading branch information
Showing
2 changed files
with
82 additions
and
0 deletions.
There are no files selected for viewing
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
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 |
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