Skip to content

date update

date update #39

Workflow file for this run

name: Continuous Integration
on:
push:
paths-ignore:
- '**/*.md'
pull_request:
paths-ignore:
- 'doc/**'
- 'contrib/**'
- '**/*.md'
env:
MAKEJOBS: 3
DOCKER_BUILDKIT: 1
GITIAN_DIR: /opt/gitian-builder
GITIAN_CACHE: /opt/gitian-builder/cache
DEBIAN_FRONTEND: noninteractive
USE_DOCKER: 1
jobs:
binary:
runs-on: ubuntu-latest
container: docker:stable-dind
strategy:
matrix:
name:
- armhf-linux
- aarch64-linux
- x86_64-linux
- x86_64-macos
- x86_64-win
include:
- os: linux
name: armhf-linux
host: arm-linux-gnueabihf
- os: linux
name: aarch64-linux
host: aarch64-linux-gnu
- os: linux
name: x86_64-linux
host: x86_64-linux-gnu
- os: osx
name: x86_64-macos
host: x86_64-apple-darwin16
- os: win
name: x86_64-win
host: x86_64-w64-mingw32
steps:
- name: Set up environment
run: |
apk add --no-cache curl make ruby wget git sed tar grep bash
git clone https://github.com/devrandom/gitian-builder.git ${GITIAN_DIR}
mkdir -p ${GITIAN_DIR}/inputs ${GITIAN_DIR}/var
wget https://github.com/mikefarah/yq/releases/download/v4.13.5/yq_linux_amd64.tar.gz -O - |\
tar xz && mv yq_linux_amd64 /usr/bin/yq
- name: Fetch OSX SDK
if: ${{ matrix.os == 'osx' }}
run: |
wget -N https://github.com/phracker/MacOSX-SDKs/releases/download/11.3/MacOSX10.14.sdk.tar.xz
tar xf MacOSX10.14.sdk.tar.xz
tar czf ${GITIAN_DIR}/inputs/MacOSX10.14.sdk.tar.gz MacOSX10.14.sdk
rm -rf MacOSX10.14.sdk MacOSX10.14.sdk.tar.xz
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Detect suite
id: detect
run: |
DESCRIPTOR=$PWD/contrib/gitian-descriptors/gitian-${{ matrix.os }}.yml
NAME=$(yq e '.name' ${DESCRIPTOR})
echo ::set-output name=descriptor::${DESCRIPTOR}
echo ::set-output name=name::${NAME}
echo ::set-output name=version::$(echo ${NAME} | grep -Eo [0-9.]+)
echo ::set-output name=suite::$(yq e '.suites[0]' ${DESCRIPTOR})
echo ::set-output name=architecture::$(yq e '.architectures[0]' ${DESCRIPTOR})
echo ::set-output name=build-dir::${PWD}
- name: Build gitian base image
run: |
docker build --tag base-${{ steps.detect.outputs.suite }}-${{ steps.detect.outputs.architecture }} -<<EOF
FROM ubuntu:${{ steps.detect.outputs.suite }}
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get --no-install-recommends -y install pciutils build-essential git subversion language-pack-en wget lsb-release
RUN useradd -ms /bin/bash -U ubuntu
USER ubuntu:ubuntu
WORKDIR /home/ubuntu
CMD ["sleep", "infinity"]
EOF
- name: Cache dependencies
uses: actions/cache@v2
id: gitian-deps
env:
cache-name: gitian-host
with:
path: ${{ env.GITIAN_CACHE }}/${{ steps.detect.outputs.name }}/${{ matrix.host }}
key: ${{ matrix.name }}-${{ env.cache-name }}-${{ hashFiles('depends/packages/*') }}
- name: Change release description if tag
if: startsWith(github.ref, 'refs/tags/')
shell: bash
run: |
sed -i "s|^\(DESC=\"\).*|\1$(echo ${GITHUB_REF/refs\/tags\//})\"|" share/genbuild.sh
git config user.name temp
git config user.email temp@temp.com
git add share/genbuild.sh
git commit -m "Update DESC"
- name: Build binary
working-directory: ${{ env.GITIAN_DIR }}
run: |
sed -i "s/^\ \ \(HOSTS=\"\).*/\ \ \1${{ matrix.host }}\"/g" ${{ steps.detect.outputs.descriptor }}
./bin/gbuild -j $MAKEJOBS --commit sumcoin=$(git -C ${{ steps.detect.outputs.build-dir }} log --format="%H" -n 1) --url sumcoin=${{ steps.detect.outputs.build-dir }} ${{ steps.detect.outputs.descriptor }}
cp -r ${GITIAN_DIR}/build/out/* ${{ steps.detect.outputs.build-dir }}/
- name: Get short SHA
id: slug
run: echo ::set-output name=sha8::$(echo ${{ github.sha }} | cut -c1-8)
- uses: actions/upload-artifact@v2
with:
name: sumcoin-${{ steps.slug.outputs.sha8 }}-${{ matrix.name }}
path: |
*.tar.gz
*.zip
*.exe
*.dmg
!*-debug*
!*-unsigned.tar.gz
retention-days: 5
docker:
runs-on: ubuntu-latest
needs: [binary]
steps:
- uses: actions/checkout@v2
with:
repository: sumcoin/packaging
- uses: actions/download-artifact@v2
with:
path: docker
- name: Place artifacts
working-directory: docker
run: |
mkdir -p linux/amd64 linux/arm64 linux/arm/v7
mv sumcoin-*-armhf-linux/sumcoin-*-arm-linux-gnueabihf.tar.gz linux/arm/v7/
mv sumcoin-*-aarch64-linux/sumcoin-*-aarch64-linux-gnu.tar.gz linux/arm64/
mv sumcoin-*-x86_64-linux/sumcoin-*-x86_64-linux-gnu.tar.gz linux/amd64/
- uses: crazy-max/ghaction-docker-buildx@v1
- uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Detect env
id: detect
shell: bash
run: |
PUSH=false
TAG_NAME=blank
if [[ $GITHUB_REF == refs/heads/develop ]]; then
PUSH=true
TAG_NAME=latest
fi
if [[ $GITHUB_REF == refs/heads/master ]]; then
PUSH=true
TAG_NAME=master
fi
if [[ $GITHUB_REF == refs/heads/release-* ]]; then
PUSH=true
TAG_NAME=${GITHUB_REF/refs\/heads\//}
fi
if [[ $GITHUB_REF == refs/tags/v* ]]; then
PUSH=true
TAG_NAME=${GITHUB_REF/refs\/tags\//}
TAG_NAME=${TAG_NAME/ppc\./}
TAG_NAME=${TAG_NAME/ppc/}
TAG_NAME=${TAG_NAME/v/}
fi
echo ::set-output name=push::${PUSH}
echo ::set-output name=tag-name::${TAG_NAME}
- name: Build and push
working-directory: docker
run: |
docker buildx build --platform linux/amd64,linux/arm/v7,linux/arm64 \
--output "type=image,push=${{ steps.detect.outputs.push }}" \
--progress=plain \
--tag ghcr.io/${{ github.repository }}/sumcoind:${{ steps.detect.outputs.tag-name }} \
.
appimage:
runs-on: ubuntu-latest
container: appimagecrafters/appimage-builder:latest
needs: [binary]
strategy:
matrix:
name:
- armhf
- aarch64
- x86_64
include:
- name: armhf
host: arm-linux-gnueabihf
sources_repo: http://ports.ubuntu.com/ubuntu-ports
apt_arch: armhf
- name: aarch64
host: aarch64-linux-gnu
sources_repo: http://ports.ubuntu.com/ubuntu-ports
apt_arch: arm64
- name: x86_64
host: x86_64-linux-gnu
sources_repo: http://archive.ubuntu.com/ubuntu
apt_arch: amd64
steps:
- uses: actions/checkout@v2
with:
repository: sumcoin/packaging
- uses: actions/download-artifact@v2
with:
path: appimage
- name: Set up environment
working-directory: appimage
run: |
apt-get -qq update
apt-get install -qqy git wget ca-certificates
pip3 install --upgrade git+https://github.com/AppImageCrafters/appimage-builder@v0.9.2
- name: Detect env
id: detect
shell: bash
run: |
SHA8=$(echo ${{ github.sha }} | cut -c1-8)
TAG_NAME=$SHA8
if [[ $GITHUB_REF == refs/tags/v* ]]; then
TAG_NAME=${GITHUB_REF/refs\/tags\//}
TAG_NAME=${TAG_NAME/ppc\./}
TAG_NAME=${TAG_NAME/ppc/}
TAG_NAME=${TAG_NAME/v/}
fi
echo ::set-output name=sha8::$SHA8
echo ::set-output name=tag-name::$TAG_NAME
echo ::set-output name=build-dir::${PWD}
- name: Build AppImage
working-directory: appimage
run: |
tar xzf sumcoin-${{ steps.detect.outputs.sha8 }}-${{ matrix.name }}-linux/sumcoin-*-${{ matrix.host }}.tar.gz -C AppDir --strip-components=1
rm AppDir/bin/sumcoin-cli AppDir/bin/sumcoin-tx AppDir/bin/sumcoin-wallet AppDir/bin/sumcoind
VERSION=${{ steps.detect.outputs.tag-name }} SOURCES_REPO=${{ matrix.sources_repo }} APT_ARCH=${{ matrix.apt_arch }} BUILD_ARCH=${{ matrix.name }} appimage-builder --skip-tests
mv *.AppImage* ${{ steps.detect.outputs.build-dir }}/
- uses: actions/upload-artifact@v2
with:
name: sumcoin-appimage-${{ steps.detect.outputs.tag-name }}-${{ matrix.name }}
path: |
*.AppImage*
retention-days: 5
release:
runs-on: ubuntu-latest
needs: [binary, appimage]
if: ${{ startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/develop' }}
steps:
- name: Detect env
id: detect
shell: bash
run: |
TAG_NAME=noop
RELEASE_TITLE=noop
if [[ $GITHUB_REF == refs/heads/develop ]]; then
TAG_NAME=latest
RELEASE_TITLE="Development Build"
fi
if [[ $GITHUB_REF == refs/tags/v* ]]; then
TAG_NAME=${GITHUB_REF/refs\/tags\//}
TAG_NAME_NO_DOT=${TAG_NAME/ppc\./}
RELEASE_TITLE="Release ${TAG_NAME_NO_DOT/ppc/}"
fi
if [[ -z "${{ secrets.GPG_PRIVATE_KEY }}" ]]; then
TAG_NAME=noop
RELEASE_TITLE=noop
fi
echo ::set-output name=tag-name::$TAG_NAME
echo ::set-output name=release-title::"${RELEASE_TITLE}"
echo ::set-output name=sha8::$(echo ${{ github.sha }} | cut -c1-8)
- name: Set up environment
if: ${{ steps.detect.outputs.tag-name != 'noop' }}
run: sudo apt-get update && sudo apt-get install -y mktorrent gpg bash
- uses: actions/checkout@v2
if: ${{ steps.detect.outputs.tag-name != 'noop' }}
- uses: actions/download-artifact@v2
if: ${{ steps.detect.outputs.tag-name != 'noop' }}
- name: Import GPG key
if: ${{ steps.detect.outputs.tag-name != 'noop' }}
id: import_gpg
uses: crazy-max/ghaction-import-gpg@v4
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
- name: GPG user IDs
if: ${{ steps.detect.outputs.tag-name != 'noop' }}
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 }}"
gpg --keyserver hkp://keyserver.ubuntu.com --send-key ${{ steps.import_gpg.outputs.keyid }}
- name: Create torrent
if: ${{ steps.detect.outputs.tag-name != 'noop' }}
run: |
rm -rf ${{ steps.detect.outputs.tag-name }}/*
mkdir -p ${{ steps.detect.outputs.tag-name }}
mv sumcoin-*-**/sumcoin-*.tar.gz \
sumcoin-*-**/sumcoin-*.zip \
sumcoin-*-**/sumcoin-*.exe \
sumcoin-*-**/sumcoin-*.dmg \
sumcoin-*-**/*.AppImage* \
${{ steps.detect.outputs.tag-name }}/
cd ${{ steps.detect.outputs.tag-name }}
sha256sum * > SHA256SUMS
gpg --digest-algo sha256 --clearsign SHA256SUMS
rm SHA256SUMS
cd -
mktorrent -w ${{ github.server_url }}/${{ github.repository }}/releases/download \
-o ${{ steps.detect.outputs.tag-name }}/sumcoin-${{ steps.detect.outputs.tag-name }}.torrent \
-a udp://tracker.opentrackr.org:1337/announce \
-a udp://tracker.openbittorrent.com:6969/announce \
-a udp://exodus.desync.com:6969/announce \
${{ steps.detect.outputs.tag-name }}
- name: Check latest
id: detect-publish-latest
if: ${{ steps.detect.outputs.tag-name != 'noop' && github.ref == 'refs/heads/develop' }}
run: |
PUBLISH=noop
git fetch origin +refs/tags/latest:refs/tags/latest
if ! git merge-base --is-ancestor refs/tags/latest HEAD; then
PUBLISH=op
fi
echo ::set-output name=publish::$PUBLISH
- name: Generate Changelog
if: ${{ steps.detect.outputs.tag-name != 'noop' && startsWith(github.ref, 'refs/tags/v') }}
run: |
git fetch --depth=1 origin +${{ github.ref }}:${{ github.ref }}
git tag -l --format='%(contents)' ${GITHUB_REF/refs\/tags\//} > ${{ github.workspace }}-CHANGELOG.txt
- uses: marvinpinto/action-automatic-releases@919008cf3f741b179569b7a6fb4d8860689ab7f0
if: ${{ steps.detect.outputs.tag-name != 'noop' && steps.detect-publish-latest.outputs.publish == 'op' && github.ref == 'refs/heads/develop' }}
with:
repo_token: ${{ github.token }}
automatic_release_tag: ${{ steps.detect.outputs.tag-name }}
prerelease: true
title: "${{ steps.detect.outputs.release-title }}"
files: ${{ steps.detect.outputs.tag-name }}/*
- uses: softprops/action-gh-release@6034af24fba4e5a8e975aaa6056554efe4c794d0
if: ${{ steps.detect.outputs.tag-name != 'noop' && startsWith(github.ref, 'refs/tags/v') }}
with:
body_path: ${{ github.workspace }}-CHANGELOG.txt
token: ${{ github.token }}
prerelease: true
name: "${{ steps.detect.outputs.release-title }}"
files: ${{ steps.detect.outputs.tag-name }}/*