Merge pull request #61 from alephium/update-mining-protocol #61
Workflow file for this run
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
name: build artifacts | |
on: [push] | |
jobs: | |
build-linux-artifact: | |
name: build-linux-artifact | |
runs-on: ubuntu-18.04 | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: Jimver/cuda-toolkit@v0.2.5 | |
id: cuda-toolkit | |
with: | |
cuda: '11.3.0' | |
sub-packages: '["nvcc"]' | |
method: 'network' | |
- name: Install Dependency | |
run: | | |
temp_file=$(mktemp --suffix=.deb) | |
curl -L https://github.com/conan-io/conan/releases/latest/download/conan-ubuntu-64.deb -o $temp_file | |
sudo apt install $temp_file | |
- name: Build miner | |
run: ./make.sh | |
- name: Rename miner | |
run: mv bin/gpu-miner bin/gpu-miner_$(git rev-parse --short "$GITHUB_SHA") | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: linux-binary | |
path: bin/gpu-miner_* | |
build-windows-artifact: | |
name: build-windows-artifact | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
submodules: recursive | |
- uses: ilammy/msvc-dev-cmd@v1 | |
with: | |
arch: amd64 | |
- uses: Jimver/cuda-toolkit@v0.2.5 | |
id: cuda-toolkit | |
with: | |
cuda: '11.3.0' | |
sub-packages: '["nvcc", "cudart", "visual_studio_integration"]' | |
method: 'network' | |
- run: echo "conan==1.42.2" > requirements.txt | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: '3.x' | |
architecture: 'x64' | |
cache: 'pip' | |
- name: Install Dependency | |
run: pip install -r requirements.txt | |
- name: Build Miner | |
run: .\build.ps1 | |
- name: Rename Miner | |
run: | | |
$fileName = git rev-parse --short HEAD | |
cp bin/gpu-miner.exe "bin/gpu-miner_$fileName.exe" | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: windows-binary | |
path: bin/gpu-miner_*.exe | |
release: | |
name: release | |
runs-on: ubuntu-latest | |
# If both artifacts were built properly and this is a tag | |
if: ${{ needs.build-linux-artifact.result == 'success' && needs.build-linux-artifact.result == 'success' && startsWith(github.ref, 'refs/tags/') }} | |
needs: [build-linux-artifact, build-windows-artifact] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Get linux artifact | |
uses: actions/download-artifact@v2 | |
with: | |
name: linux-binary | |
- name: Get Windows artifact | |
uses: actions/download-artifact@v2 | |
with: | |
name: windows-binary | |
- name: Get the version (Release prep) | |
id: get_version | |
run: | | |
version=$(echo ${GITHUB_REF/refs\/tags\//} | cut -c 2-) | |
echo ::set-output name=VERSION::$version | |
shell: bash | |
- name: Generate miners checksums (Release prep) | |
run: | | |
filename=$(git rev-parse --short HEAD) | |
mv "gpu-miner_$filename" "alephium-${{ steps.get_version.outputs.VERSION }}-cuda-miner-linux" | |
mv "gpu-miner_$filename.exe" "alephium-${{ steps.get_version.outputs.VERSION }}-cuda-miner-windows.exe" | |
sha256sum "alephium-${{ steps.get_version.outputs.VERSION }}-cuda-miner-linux" > "alephium-${{ steps.get_version.outputs.VERSION }}-cuda-miner-linux.checksum" | |
sha256sum "alephium-${{ steps.get_version.outputs.VERSION }}-cuda-miner-windows.exe" > "alephium-${{ steps.get_version.outputs.VERSION }}-cuda-miner-windows.exe.checksum" | |
ls -la | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
alephium-${{ steps.get_version.outputs.VERSION }}-cuda-miner-linux | |
alephium-${{ steps.get_version.outputs.VERSION }}-cuda-miner-linux.checksum | |
alephium-${{ steps.get_version.outputs.VERSION }}-cuda-miner-windows.exe | |
alephium-${{ steps.get_version.outputs.VERSION }}-cuda-miner-windows.exe.checksum | |
buildx_and_push_to_registry: | |
name: Push Docker image to Docker Hub | |
runs-on: ubuntu-latest | |
if: ${{ needs.release.result == 'success' }} | |
needs: release | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v2 | |
- uses: docker/setup-qemu-action@v1 | |
- uses: docker/setup-buildx-action@v1 | |
- name: Get the version | |
id: get_version | |
run: | | |
version=$(git describe --tags --abbrev=0) | |
echo $version | |
echo ${version:1} | |
echo ::set-output name=VERSION::$version | |
echo ::set-output name=VERSION-NO-V::${version:1} | |
shell: bash | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build and publish docker image | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
file: ./Dockerfile | |
build-args: RELEASE=${{ steps.get_version.outputs.VERSION-NO-V }} | |
platforms: linux/amd64 | |
tags: | | |
docker.io/alephium/gpu-miner:${{ steps.get_version.outputs.VERSION }} | |
docker.io/alephium/gpu-miner:latest | |
push: true |