Skip to content

Commit

Permalink
Attempt to unify job descriptions by using env settings
Browse files Browse the repository at this point in the history
  • Loading branch information
pmconrad committed Nov 28, 2019
1 parent d39e36f commit 3873660
Showing 1 changed file with 84 additions and 68 deletions.
152 changes: 84 additions & 68 deletions .github/workflows/build-and-sign.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,59 +3,63 @@ env:
USE_DOCKER: 1
jobs:
prepare-bionic:
env:
BASE: bionic
name: Prepare "bionic" Gitian build environment
runs-on: ubuntu-latest
steps:
- name: Load Prep Cache
id: cache-bionic
id: cache-${{ env.BASE }}
uses: actions/cache@v1
with:
path: docker
key: prep-cache-bionic
key: prep-cache-${{ env.BASE }}
- uses: actions/checkout@v1
if: steps.cache-bionic.outputs.cache-hit != 'true'
if: steps.cache-${{ env.BASE }}.outputs.cache-hit != 'true'
with:
submodules: recursive
- name: Prepare
if: steps.cache-bionic.outputs.cache-hit != 'true'
if: steps.cache-${{ env.BASE }}.outputs.cache-hit != 'true'
run: |
mkdir -p docker
echo "Argh - caching only works for push and pull events. See https://github.com/actions/cache/issues/63"
vendor/gitian-builder/bin/make-base-vm --docker --suite bionic
docker save base-bionic-amd64 | xz >docker/base-bionic-amd64.tar.xz
vendor/gitian-builder/bin/make-base-vm --docker --suite "${{ env.BASE }}"
docker save "base-${{ env.BASE }}-amd64" | xz >"docker/base-${{ env.BASE }}-amd64.tar.xz"
- name: Upload build artifacts
if: steps.cache-bionic.outputs.cache-hit != 'true'
if: steps.cache-${{ env.BASE }}.outputs.cache-hit != 'true'
uses: actions/upload-artifact@master
with:
name: docker-bionic
path: docker/base-bionic-amd64.tar.xz
name: docker-${{ env.BASE }}
path: docker/base-${{ env.BASE }}-amd64.tar.xz
prepare-xenial:
env:
BASE: xenial
name: Prepare "xenial" Gitian build environment
runs-on: ubuntu-latest
steps:
- name: Load Prep Cache
id: cache-xenial
id: cache-${{ env.BASE }}
uses: actions/cache@v1
with:
path: docker
key: prep-cache-xenial
key: prep-cache-${{ env.BASE }}
- uses: actions/checkout@v1
if: steps.cache-xenial.outputs.cache-hit != 'true'
if: steps.cache-${{ env.BASE }}.outputs.cache-hit != 'true'
with:
submodules: recursive
- name: Prepare
if: steps.cache-xenial.outputs.cache-hit != 'true'
if: steps.cache-${{ env.BASE }}.outputs.cache-hit != 'true'
run: |
mkdir -p docker
echo "Argh - caching only works for push and pull events. See https://github.com/actions/cache/issues/63"
vendor/gitian-builder/bin/make-base-vm --docker --suite xenial
docker save base-xenial-amd64 | xz >docker/base-xenial-amd64.tar.xz
vendor/gitian-builder/bin/make-base-vm --docker --suite "${{ env.BASE }}"
docker save "base-${{ env.BASE }}-amd64" | xz >"docker/base-${{ env.BASE }}-amd64.tar.xz"
- name: Upload build artifacts
if: steps.cache-xenial.outputs.cache-hit != 'true'
if: steps.cache-${{ env.BASE }}.outputs.cache-hit != 'true'
uses: actions/upload-artifact@master
with:
name: docker-xenial
path: docker/base-xenial-amd64.tar.xz
name: docker-${{ env.BASE }}
path: docker/base-${{ env.BASE }}-amd64.tar.xz
prepare-mac:
name: Scrape mac-SDK
runs-on: macos-latest
Expand Down Expand Up @@ -87,65 +91,73 @@ jobs:
name: MacOS-SDK
path: osx/MacOSX10.15.sdk.tar.xz
linux:
name: Build and sign linux binaries
env:
BASE: xenial
OS_NAME: Linux
OS_KEY: linux
name: Build and sign Linux binaries
needs: prepare-xenial
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
with:
submodules: recursive
- name: Load Prep Cache
id: cache-xenial
- name: Load Docker Cache
id: cache-${{ env.BASE }}
uses: actions/cache@v1
with:
path: docker
key: prep-cache-xenial
- name: Poor man's cache
if: steps.cache-xenial.outputs.cache-hit != 'true'
key: prep-cache-${{ env.BASE }}
- name: Poor man's Docker cache
if: steps.cache-${{ env.BASE }}.outputs.cache-hit != 'true'
uses: actions/download-artifact@master
with:
name: docker-xenial
name: docker-${{ env.BASE }}
path: docker/
- name: Load Build Cache
uses: actions/cache@v1
with:
path: vendor/gitian-builder/cache/bitshares-core-linux
key: build-cache-linux-${{ github.event.deployment.payload.coreversion }}
path: vendor/gitian-builder/cache/bitshares-core-${{ env.OS_KEY }}
key: build-cache-${{ env.OS_KEY }}-${{ github.event.deployment.payload.coreversion }}
restore-keys: |
build-cache-linux-
build-cache-${{ env.OS_KEY }}-
- name: Prepare
run: |
docker load -i docker/base-xenial-amd64.tar.xz
docker load -i docker/base-${{ env.BASE }}-amd64.tar.xz
- name: Build and Sign
run: |
sudo apt-get install ruby
export GNUPGHOME=`pwd`/.gpghome
./run-gitian -b -O linux \
./run-gitian -b -O ${{ env.OS_KEY }} \
${{ github.event.deployment.payload.coreversion }} \
-j 1 \
|| ( echo Install log: && cat vendor/gitian-builder/var/install.log \
&& echo Build log: && cat vendor/gitian-builder/var/build.log \
&& false )
PGP_PASS="${{ secrets.PGP_PASSPHRASE }}" \
./run-gitian -s BitShares-Gitian-Auto-Build-Signer \
-O linux -p `pwd`/.github/gpg-wrapper \
-O ${{ env.OS_KEY }} -p `pwd`/.github/gpg-wrapper \
${{ github.event.deployment.payload.coreversion }}
- name: Push Signatures
run: |
git config add user.name "BitShares Github Autobuild"
git config add user.email "bga@noreply"
BRANCH="autobuild-signatures-linux-$(date -u +%Y-%m-%dT%H:%M:%SZ)"
BRANCH="autobuild-signatures-${{ env.OS_KEY }}-$(date -u +%Y-%m-%dT%H:%M:%SZ)"
git checkout -b "$BRANCH"
git add signatures
git commit -m "Add Linux autobuild signature for ${{ github.event.deployment.payload.coreversion }}"
git commit -m "Add ${{ env.OS_NAME }} autobuild signature for ${{ github.event.deployment.payload.coreversion }}"
git push "https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" "$BRANCH"
- name: Upload build artifacts
uses: actions/upload-artifact@master
with:
name: Linux-Binaries
name: ${{ env.OS_NAME }}-Binaries
path: vendor/gitian-builder/build/out
mac:
name: Build and sign mac binaries
env:
BASE: bionic
OS_NAME: MacOSX
OS_KEY: osx
name: Build and sign MacOSX binaries
needs:
- prepare-bionic
- prepare-mac
Expand All @@ -154,17 +166,17 @@ jobs:
- uses: actions/checkout@v1
with:
submodules: recursive
- name: Load Docker Prep Cache
id: cache-bionic
- name: Load Docker Cache
id: cache-${{ env.BASE }}
uses: actions/cache@v1
with:
path: docker
key: prep-cache-bionic
- name: Poor man's docker cache
if: steps.cache-bionic.outputs.cache-hit != 'true'
key: prep-cache-${{ env.BASE }}
- name: Poor man's Docker cache
if: steps.cache-${{ env.BASE }}.outputs.cache-hit != 'true'
uses: actions/download-artifact@master
with:
name: docker-bionic
name: docker-${{ env.BASE }}
path: docker/
- name: Load OSX Prep Cache
id: cache-osx
Expand All @@ -181,98 +193,102 @@ jobs:
- name: Load Build Cache
uses: actions/cache@v1
with:
path: vendor/gitian-builder/cache/bitshares-core-osx
key: build-cache-osx-${{ github.event.deployment.payload.coreversion }}
path: vendor/gitian-builder/cache/bitshares-core-${{ env.OS_KEY }}
key: build-cache-${{ env.OS_KEY }}-${{ github.event.deployment.payload.coreversion }}
restore-keys: |
build-cache-osx-
build-cache-${{ env.OS_KEY }}-
- name: Prepare
run: |
docker load -i docker/base-bionic-amd64.tar.xz
docker load -i docker/base-${{ env.BASE }}-amd64.tar.xz
- name: Build and Sign
run: |
sudo apt-get install ruby
mkdir -p vendor/gitian-builder/inputs
mv osx/* vendor/gitian-builder/inputs
./run-gitian -b -O osx \
export GNUPGHOME=`pwd`/.gpghome
./run-gitian -b -O ${{ env.OS_KEY }} \
${{ github.event.deployment.payload.coreversion }} \
-j 1 \
|| ( echo Install log: && cat vendor/gitian-builder/var/install.log \
&& echo Build log: && cat vendor/gitian-builder/var/build.log \
&& false )
export GNUPGHOME=`pwd`/.gpghome
PGP_PASS="${{ secrets.PGP_PASSPHRASE }}" \
./run-gitian -s BitShares-Gitian-Auto-Build-Signer \
-O osx -p `pwd`/.github/gpg-wrapper \
-O ${{ env.OS_KEY }} -p `pwd`/.github/gpg-wrapper \
${{ github.event.deployment.payload.coreversion }}
- name: Push Signatures
run: |
git config add user.name "BitShares Github Autobuild"
git config add user.email "bga@noreply"
BRANCH="autobuild-signatures-osx-$(date -u +%Y-%m-%dT%H:%M:%SZ)"
BRANCH="autobuild-signatures-${{ env.OS_KEY }}-$(date -u +%Y-%m-%dT%H:%M:%SZ)"
git checkout -b "$BRANCH"
git add signatures
git commit -m "Add OSX autobuild signature for ${{ github.event.deployment.payload.coreversion }}"
git commit -m "Add ${{ env.OS_NAME }} autobuild signature for ${{ github.event.deployment.payload.coreversion }}"
git push "https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" "$BRANCH"
- name: Upload build artifacts
uses: actions/upload-artifact@master
with:
name: Mac Binaries
name: ${{ env.OS_NAME }}-Binaries
path: vendor/gitian-builder/build/out
windows:
name: Build and sign windows binaries
env:
BASE: bionic
OS_NAME: Windows
OS_KEY: win
name: Build and sign Windows binaries
needs: prepare-bionic
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
with:
submodules: recursive
- name: Load Docker Prep Cache
id: cache-bionic
- name: Load Docker Cache
id: cache-${{ env.BASE }}
uses: actions/cache@v1
with:
path: docker
key: prep-cache-bionic
- name: Poor man's cache
if: steps.cache-bionic.outputs.cache-hit != 'true'
key: prep-cache-${{ env.BASE }}
- name: Poor man's Docker cache
if: steps.cache-${{ env.BASE }}.outputs.cache-hit != 'true'
uses: actions/download-artifact@master
with:
name: docker-bionic
name: docker-${{ env.BASE }}
path: docker/
- name: Load Build Cache
uses: actions/cache@v1
with:
path: vendor/gitian-builder/cache/bitshares-core-win
key: build-cache-win-${{ github.event.deployment.payload.coreversion }}
path: vendor/gitian-builder/cache/bitshares-core-${{ env.OS_KEY }}
key: build-cache-${{ env.OS_KEY }}-${{ github.event.deployment.payload.coreversion }}
restore-keys: |
build-cache-win-
build-cache-${{ env.OS_KEY }}-
- name: Prepare
run: |
docker load -i docker/base-bionic-amd64.tar.xz
docker load -i docker/base-${{ env.BASE }}-amd64.tar.xz
- name: Build and Sign
run: |
sudo apt-get install ruby
./run-gitian -b -O win \
export GNUPGHOME=`pwd`/.gpghome
./run-gitian -b -O ${{ env.OS_KEY }} \
${{ github.event.deployment.payload.coreversion }} \
-j 1 \
|| ( echo Install log: && cat vendor/gitian-builder/var/install.log \
&& echo Build log: && cat vendor/gitian-builder/var/build.log \
&& false )
export GNUPGHOME=`pwd`/.gpghome
PGP_PASS="${{ secrets.PGP_PASSPHRASE }}" \
./run-gitian -s BitShares-Gitian-Auto-Build-Signer \
-O win -p `pwd`/.github/gpg-wrapper \
-O ${{ env.OS_KEY }} -p `pwd`/.github/gpg-wrapper \
${{ github.event.deployment.payload.coreversion }}
- name: Push Signatures
run: |
git config add user.name "BitShares Github Autobuild"
git config add user.email "bga@noreply"
BRANCH="autobuild-signatures-win-$(date -u +%Y-%m-%dT%H:%M:%SZ)"
BRANCH="autobuild-signatures-${{ env.OS_KEY }}-$(date -u +%Y-%m-%dT%H:%M:%SZ)"
git checkout -b "$BRANCH"
git add signatures
git commit -m "Add win autobuild signature for ${{ github.event.deployment.payload.coreversion }}"
git commit -m "Add ${{ env.OS_NAME }} autobuild signature for ${{ github.event.deployment.payload.coreversion }}"
git push "https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" "$BRANCH"
- name: Upload build artifacts
uses: actions/upload-artifact@master
with:
name: Windows Binaries
name: ${{ env.OS_NAME }}-Binaries
path: vendor/gitian-builder/build/out

0 comments on commit 3873660

Please sign in to comment.