Skip to content

Commit

Permalink
workflow: Setup checksum generation and gpg signing for releases. (li…
Browse files Browse the repository at this point in the history
  • Loading branch information
hjpotter92 authored and ad-astra-video committed May 25, 2022
1 parent 299cf5c commit 5d900b0
Show file tree
Hide file tree
Showing 17 changed files with 608 additions and 387 deletions.
23 changes: 23 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# This file is the top-most EditorConfig file
root = true

# All Files
[*]
charset = utf-8
indent_style = space
indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true
end_of_line = lf

# Makefiles
[Makefile]
indent_style = tab

# YAML Files
[*.{yaml,sh}]
indent_size = 2

# Go source files
[*.go]
indent_style = tab
325 changes: 325 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,325 @@
name: Build binaries

on:
pull_request:
push:
branches:
- master

jobs:
linux:
name: Build linux binaries
runs-on: ubuntu-18.04
steps:
- name: Checkout
uses: actions/checkout@v2
with:
# Needed for commands that depend on git tags
fetch-depth: 0
# Check https://github.com/livepeer/go-livepeer/pull/1891
# for ref value discussion
ref: ${{ github.event.pull_request.head.sha }}

- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: '1.17.6'

- name: Cache go modules
id: cache-go-mod
uses: actions/[email protected]
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Cache ffmpeg
id: cache-ffmpeg
uses: actions/[email protected]
with:
path: ~/compiled
key: ${{ runner.os }}-ffmpeg-${{ hashFiles('**/install_ffmpeg.sh') }}
restore-keys: |
${{ runner.os }}-ffmpeg
- name: Cache binaries
uses: actions/[email protected]
with:
path: ~/build
key: ${{ runner.os }}-binaries-${{ github.sha }}

- name: Install dependencies
run: |
sudo apt-get update \
&& sudo apt-get install -y software-properties-common curl apt-transport-https \
&& sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 15CF4D18AF4F7421 \
&& sudo add-apt-repository "deb [arch=amd64] http://apt.llvm.org/xenial/ llvm-toolchain-xenial-8 main" \
&& sudo apt-get update \
&& sudo apt-get -y install clang-8 clang-tools-8 build-essential pkg-config autoconf git python
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-8 30 \
&& sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-8 30
- name: Install go modules
if: steps.cache-go-mod.outputs.cache-hit != 'true'
run: go mod download

- name: Install ffmpeg
if: steps.cache-ffmpeg.outputs.cache-hit != 'true'
run: ./install_ffmpeg.sh

- name: Build binaries
run: |
export PKG_CONFIG_PATH=~/compiled/lib/pkgconfig
./ci_env.sh make
rm -rf ~/build && mkdir ~/build && mv livepeer* ~/build/
env:
GHA_REF: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || github.ref }}

- name: Upload build
run: cp ~/build/* . && ./upload_build.sh
env:
GHA_REF: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || github.ref }}
GCLOUD_KEY: ${{ secrets.GCLOUD_KEY }}
GCLOUD_SECRET: ${{ secrets.GCLOUD_SECRET }}
DISCORD_URL: ${{ secrets.DISCORD_URL }}

- name: Upload artifacts for cutting release
uses: actions/upload-artifact@master
with:
name: release-artifacts
path: releases/

- name: Notify new build upload
run: curl -X POST https://holy-bread-207a.livepeer.workers.dev

macos:
name: Build MacOS binaries
strategy:
matrix:
arch:
- amd64
- arm64
runs-on: macos-latest
steps:
- name: Set build environment
run: echo "GOARCH=${{ matrix.arch }}" >> $GITHUB_ENV

- name: Checkout
uses: actions/checkout@v2
with:
# Needed for commands that depend on git tags
fetch-depth: 0
# Check https://github.com/livepeer/go-livepeer/pull/1891
# for ref value discussion
ref: ${{ github.event.pull_request.head.sha }}

- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: '1.17.6'

- name: Cache go modules
id: cache-go-mod
uses: actions/[email protected]
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-${{ matrix.arch }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-${{ matrix.arch }}-go-
- name: Cache ffmpeg
id: cache-ffmpeg
uses: actions/[email protected]
with:
path: ~/compiled
key: ${{ runner.os }}-${{ matrix.arch }}-ffmpeg-${{ hashFiles('**/install_ffmpeg.sh') }}
restore-keys: |
${{ runner.os }}-${{ matrix.arch }}-ffmpeg
- name: Install dependencies
run: brew install coreutils

- name: Install go modules
if: steps.cache-go-mod.outputs.cache-hit != 'true'
run: go mod download

- name: Install ffmpeg
if: steps.cache-ffmpeg.outputs.cache-hit != 'true'
run: ./install_ffmpeg.sh

- name: Build binaries
run: |
export PKG_CONFIG_PATH=~/compiled/lib/pkgconfig
./ci_env.sh make
env:
GHA_REF: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || github.ref }}

- name: Upload build
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository
env:
GHA_REF: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || github.ref }}
GCLOUD_KEY: ${{ secrets.GCLOUD_KEY }}
GCLOUD_SECRET: ${{ secrets.GCLOUD_SECRET }}
DISCORD_URL: ${{ secrets.DISCORD_URL }}
run: ./upload_build.sh

- name: Upload artifacts for cutting release
uses: actions/upload-artifact@master
with:
name: release-artifacts
path: releases/

windows:
name: Build windows binaries
runs-on: windows-latest
steps:
- name: configure git line endings
run: git config --global core.autocrlf false

- uses: actions/checkout@v2
with:
# Needed for commands that depend on git tags
fetch-depth: 0
# Check https://github.com/livepeer/go-livepeer/pull/1891
# for ref value discussion
ref: ${{ github.event.pull_request.head.sha }}

- name: Setup Msys2 environment
uses: msys2/setup-msys2@v2
with:
msystem: MSYS

- name: Prepare mingw64 environment
shell: msys2 {0}
run: ./prepare_mingw64.sh

- name: Build ffmpeg
shell: msys2 {0}
run: ./install_ffmpeg.sh
# For some reason the next step sometimes cannot find protoc
# - name: Install protoc
# uses: arduino/setup-protoc@v1
# We do not just run `make` because it would also require protoc
# Due to the issue described above with finding protoc, for now we just specify the individual binaries

- name: Build binaries
shell: msys2 {0}
run: ./ci_env.sh make livepeer livepeer_cli livepeer_bench livepeer_router

- name: Upload build
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository
shell: msys2 {0}
env:
GHA_REF: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || github.ref }}
GCLOUD_KEY: ${{ secrets.GCLOUD_KEY }}
GCLOUD_SECRET: ${{ secrets.GCLOUD_SECRET }}
DISCORD_URL: ${{ secrets.DISCORD_URL }}
run: ./upload_build.sh

- name: Upload artifacts for cutting release
uses: actions/upload-artifact@master
with:
name: release-artifacts
path: releases/

linux-tensorflow:
name: Build binaries for linux using tensorflow
runs-on: ubuntu-18.04
steps:
- name: Checkout
uses: actions/checkout@v2
with:
# Needed for commands that depend on git tags
fetch-depth: 0
# Check https://github.com/livepeer/go-livepeer/pull/1891
# for ref value discussion
ref: ${{ github.event.pull_request.head.sha }}

- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: '1.17.6'

- name: Cache go modules
id: cache-go-mod
uses: actions/[email protected]
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Cache ffmpeg
id: cache-ffmpeg
uses: actions/[email protected]
with:
path: ~/compiled
key: ${{ runner.os }}-ffmpeg-tensorflow-${{ hashFiles('**/install_ffmpeg.sh') }}
restore-keys: |
${{ runner.os }}-ffmpeg-tensorflow
- name: Cache binaries
uses: actions/[email protected]
with:
path: ~/build
key: ${{ runner.os }}-binaries-tensorflow-${{ github.sha }}

- name: Install dependencies
run: |
sudo apt-get update \
&& sudo apt-get install -y software-properties-common curl apt-transport-https \
&& sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 15CF4D18AF4F7421 \
&& sudo add-apt-repository "deb [arch=amd64] http://apt.llvm.org/xenial/ llvm-toolchain-xenial-8 main" \
&& sudo apt-get update \
&& sudo apt-get -y install clang-8 clang-tools-8 build-essential pkg-config autoconf gnutls-dev git python
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-8 30 \
&& sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-8 30
LIBTENSORFLOW_VERSION=2.6.3 \
&& curl -LO https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-gpu-linux-x86_64-${LIBTENSORFLOW_VERSION}.tar.gz \
&& sudo tar -C /usr/local -xzf libtensorflow-gpu-linux-x86_64-${LIBTENSORFLOW_VERSION}.tar.gz \
&& sudo ldconfig
- name: Install go modules
if: steps.cache-go-mod.outputs.cache-hit != 'true'
run: go mod download

- name: Install ffmpeg
if: steps.cache-ffmpeg.outputs.cache-hit != 'true'
run: BUILD_TAGS=experimental ./install_ffmpeg.sh

- name: Build binaries
run: |
export PKG_CONFIG_PATH=~/compiled/lib/pkgconfig
./ci_env.sh make
rm -rf ~/build && mkdir ~/build && mv livepeer* ~/build/
env:
GHA_REF: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || github.ref }}

- name: Install libtensorflow
run: |
LIBTENSORFLOW_VERSION=2.6.3 \
&& curl -LO https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-gpu-linux-x86_64-${LIBTENSORFLOW_VERSION}.tar.gz \
&& sudo tar -C /usr/local -xzf libtensorflow-gpu-linux-x86_64-${LIBTENSORFLOW_VERSION}.tar.gz \
&& sudo ldconfig
- name: Upload build
run: cp ~/build/* . && ./upload_build.sh
env:
GHA_REF: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || github.ref }}
GCLOUD_KEY: ${{ secrets.GCLOUD_KEY }}
GCLOUD_SECRET: ${{ secrets.GCLOUD_SECRET }}
DISCORD_URL: ${{ secrets.DISCORD_URL }}
RELEASE_TAG: 'tensorflow'

- name: Upload artifacts for cutting release
uses: actions/upload-artifact@master
with:
name: release-artifacts
path: releases/

- name: Notify new build upload
run: curl -X POST https://holy-bread-207a.livepeer.workers.dev
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 5d900b0

Please sign in to comment.