Skip to content

Commit

Permalink
chore: ff changes from other branches
Browse files Browse the repository at this point in the history
  • Loading branch information
strophy committed Mar 8, 2022
1 parent b724667 commit daece1c
Show file tree
Hide file tree
Showing 4 changed files with 362 additions and 38 deletions.
116 changes: 85 additions & 31 deletions .github/workflows/release_alpha.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build alpha release for Docker Hub
name: Build and push image

on:
workflow_dispatch:
Expand All @@ -12,20 +12,42 @@ jobs:
name: Run Gitian build
runs-on: self-hosted
steps:
- name: Set up QEMU to run multi-arch builds
uses: docker/setup-qemu-action@v1
- name: Checkout
uses: actions/checkout@v2
with:
path: dash

- name: Checkout Gitian builder
uses: actions/checkout@v2
with:
repository: devrandom/gitian-builder
path: gitian-builder

- name: Set up Docker BuildX
id: buildx
uses: docker/setup-buildx-action@v1
- name: Checkout detached sigs
uses: actions/checkout@v2
with:
install: true
repository: dashpay/dash-detached-sigs
path: dash-detached-sigs

- name: Login to DockerHub
uses: docker/login-action@v1
- name: Checkout gitian sigs
uses: actions/checkout@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
repository: dashpay/gitian.sigs
path: gitian.sigs

- name: Import GPG key
id: import_gpg
uses: crazy-max/ghaction-import-gpg@v4
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}

- name: GPG user IDs
run: |
echo "fingerprint: ${{ steps.import_gpg.outputs.fingerprint }}"
echo "keyid: ${{ steps.import_gpg.outputs.keyid }}"
echo "name: ${{ steps.import_gpg.outputs.name }}"
echo "email: ${{ steps.import_gpg.outputs.email }}"
- name: Checkout
uses: actions/checkout@v2
Expand Down Expand Up @@ -64,30 +86,62 @@ jobs:
with:
images: strophy/dashd
tags: |
type=semver,pattern={{version}},value=${{github.event.inputs.tag}}
type=semver,pattern={{version}},value=${{ github.event.inputs.tag }}
type=raw,value=latest-dev
flavor: |
latest=false
- name: Install apt-cacher-ng
run: sudo DEBIAN_FRONTEND=noninteractive apt-get install -yq apt-cacher-ng

- name: Get branch name
id: branch-name
uses: tj-actions/branch-names@v5

- name: Prepare Gitian
run: dash/contrib/gitian-build.py --setup "Leon White" "${{steps.docker_meta.outputs.tags}}"
run: dash/contrib/gitian-build.py --setup "strophy" "${{ steps.branch-name.outputs.current_branch }}"

- uses: pat-s/always-upload-cache@v2
id: ccache
with:
path: /opt/actions-runner/_work/dash/dash/gitian-builder/cache/dash-linux-0.17
key: ${{ runner.os }}-ccache-${{ hashFiles('**/ccache.tar') }}
restore-keys: ${{ runner.os }}-ccache-

- name: Run Gitian build
run: dash/contrib/gitian-build.py -b -n -j $(nproc) -m `awk '/^Mem/ {print $7}' <(free -m)` "Leon White" "${{steps.docker_meta.outputs.tags}}"

- name: Setup tmate session
uses: mxschmitt/action-tmate@v3


# - name: Build and push Docker image
# id: docker_build
# uses: docker/build-push-action@v2
# with:
# file: ./docker/Dockerfile.GitHubActions.Dispatch
# push: true
# tags: ${{ steps.docker_meta.outputs.tags }}
# labels: ${{ steps.docker_meta.outputs.labels }}
# build-args: TAG=${{ steps.docker_meta.outputs.version }}
# cache-from: type=gha
# cache-to: type=gha,mode=max
# platforms: linux/amd64,linux/arm64
run: |
export GPG_TTY=$(tty)
dash/contrib/gitian-build.py -c -b -n -o l \
-u https://github.com/strophy/dash \
-j $(nproc) -m `awk '/^Mem/ {print $7}' <(free -m)` \
strophy ${{ steps.branch-name.outputs.current_branch }}
- name: Set up QEMU to run multi-arch builds
uses: docker/setup-qemu-action@v1

- name: Set up Docker BuildX
id: buildx
uses: docker/setup-buildx-action@v1
with:
version: v0.7.0
install: true

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push Docker image
id: docker_build
uses: docker/build-push-action@v2
with:
context: ${{ github.workspace }}
file: ./dash/contrib/containers/deploy/Dockerfile.GitHubActions.Gitian
push: true
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
platforms: linux/amd64,linux/arm64
build-args: |
TAG=${{ steps.docker_meta.outputs.version }}
BRANCH=${{ steps.branch-name.outputs.current_branch }}
46 changes: 46 additions & 0 deletions contrib/containers/deploy/Dockerfile.GitHubActions.Gitian
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# syntax=docker/dockerfile:1.3
FROM ubuntu:focal
LABEL maintainer="Dash Developers <dev@dash.org>"
LABEL description="Dockerised DashCore"

ARG USER_ID
ARG GROUP_ID
ARG TAG
ARG BRANCH

ENV HOME /dash

# add user with specified (or default) user/group ids
ENV USER_ID ${USER_ID:-1000}
ENV GROUP_ID ${GROUP_ID:-1000}
RUN groupadd -g ${GROUP_ID} dash && \
useradd -u ${USER_ID} -g dash -s /bin/bash -m -d /dash dash && \
mkdir /dash/.dashcore && \
chown dash:dash -R /dash

RUN apt-get update && \
apt-get -y install --no-install-recommends \
wget \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*

COPY dashcore-binaries/${BRANCH}/dashcore* /dash

RUN mach=$(uname -m) \
&& case $mach in aarch64) arch="aarch64-linux-gnu"; ;; x86_64) arch="x86_64-linux-gnu"; ;; *) echo "ERROR: Machine type $mach not supported."; ;; esac \
&& cd /dash \
&& tar xvzf dashcore*$arch.tar.gz \
&& echo $(ls -1 /dash) \
&& cp dashcore-0.17.0/bin/* /usr/local/bin \
&& rm -rf dash*

USER dash

VOLUME ["/dash"]

COPY dash/contrib/containers/deploy/docker-entrypoint.sh /docker-entrypoint.sh
ENTRYPOINT ["/docker-entrypoint.sh"]

EXPOSE 9998 9999 19998 19999

WORKDIR /dash
12 changes: 5 additions & 7 deletions contrib/gitian-build.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ def setup():
if args.docker:
make_image_prog += ['--docker']
elif args.lxc:
make_image_prog += ['--lxc', '--disksize', '13000']
make_image_prog += ['--lxc']
print('\nAbout to run ', make_image_prog )
subprocess.check_call(make_image_prog)
os.chdir(workdir)
if args.is_focal and not args.kvm and not args.docker:
Expand All @@ -58,8 +59,8 @@ def build():

if args.linux:
print('\nCompiling ' + args.version + ' Linux')
subprocess.check_call(['bin/gbuild', '-j', args.jobs, '-m', args.memory, '--commit', 'dash='+args.commit, '--url', 'dash='+args.url, '../dash/contrib/gitian-descriptors/gitian-linux.yml'])
subprocess.check_call(['bin/gsign', '-p', args.sign_prog, '--signer', args.signer, '--release', args.version+'-linux', '--destination', '../gitian.sigs/', '../dash/contrib/gitian-descriptors/gitian-linux.yml'])
subprocess.check_call(['bin/gbuild', '-j', args.jobs, '-m', args.memory, '--commit', 'dash='+args.commit, '--url', 'dash='+args.url, '../dash/contrib/gitian-descriptors/gitian-linux-64-only.yml'])
subprocess.check_call(['bin/gsign', '-p', args.sign_prog, '--signer', args.signer, '--release', args.version+'-linux', '--destination', '../gitian.sigs/', '../dash/contrib/gitian-descriptors/gitian-linux-64-only.yml'])
subprocess.check_call('mv build/out/dashcore-*.tar.gz build/out/src/dashcore-*.tar.gz ../dashcore-binaries/'+args.version, shell=True)

if args.windows:
Expand Down Expand Up @@ -123,10 +124,7 @@ def verify():
os.chdir('gitian-builder')

print('\nVerifying v'+args.version+' Linux\n')
if subprocess.call(['bin/gverify', '-v', '-d', '../gitian.sigs/', '-r', args.version+'-linux', '../dash/contrib/gitian-descriptors/gitian-linux.yml']):
print('Verifying v'+args.version+' Linux FAILED\n')
rc = 1

subprocess.call(['bin/gverify', '-v', '-d', '../gitian.sigs/', '-r', args.version+'-linux', '../dash/contrib/gitian-descriptors/gitian-linux-64-only.yml'])
print('\nVerifying v'+args.version+' Windows\n')
if subprocess.call(['bin/gverify', '-v', '-d', '../gitian.sigs/', '-r', args.version+'-win-unsigned', '../dash/contrib/gitian-descriptors/gitian-win.yml']):
print('Verifying v'+args.version+' Windows FAILED\n')
Expand Down
Loading

0 comments on commit daece1c

Please sign in to comment.