-
Notifications
You must be signed in to change notification settings - Fork 32
159 lines (134 loc) · 5.17 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
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/[email protected]
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/[email protected]
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