-
Notifications
You must be signed in to change notification settings - Fork 5
109 lines (108 loc) · 4.14 KB
/
Copy pathdeploy.yml
File metadata and controls
109 lines (108 loc) · 4.14 KB
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
name: deploy
on:
push:
branches:
- master
jobs:
build:
if: "!contains(github.event.head_commit.message, 'skipCI')"
runs-on: ubuntu-latest
env:
FILECOIN_FFI_COMMIT: 7912389334e347bbb2eac0520c836830875c39de
SOLANA_FFI_COMMIT: 720c0143d8655bfcd412ae73c949474df2c1dcf3
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: "1.16.6"
- name: Parse the reference
run: |
cd $GITHUB_WORKSPACE
echo "REF=$(sed -n 's/^ref=//p' var.env)" >> $GITHUB_ENV
echo "RELEASE=$(sed -n 's/^release=//p' var.env)" >> $GITHUB_ENV
echo "PRERELEASE=$(sed -n 's/^prerelease=//p' var.env)" >> $GITHUB_ENV
- name: Configure git for private modules
env:
TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
run: git config --global url."https://tok-kkk:${TOKEN}@github.com".insteadOf "https://github.com"
- name: Check out darknode with the reference
uses: actions/checkout@v2
with:
repository: renproject/darknode
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
ref: ${{ env.REF }}
path: darknode
- name: Cache filecoin and solana dependencies
id: cache-extern
uses: actions/cache@v2
env:
cache-name: cache-externs
with:
path: darknode/.extern
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.FILECOIN_FFI_COMMIT }}-${{ env.SOLANA_FFI_COMMIT }}
- name: Cache golang packages
id: cache-packages
uses: actions/cache@v2
env:
cache-name: cache-packages
with:
path: ~/go
key: ${{ runner.os }}-gomod-${{ hashFiles('.darknode/go.sum') }}
- name: Install dependency packages
run: |
sudo apt-get update
sudo apt-get install -y build-essential
sudo apt-get install -y jq mesa-opencl-icd ocl-icd-opencl-dev pkg-config libudev-dev hwloc libhwloc-dev
- name: Install dependencies (Filecoin FFI)
if: steps.cache-extern.outputs.cache-hit != 'true'
run: |
cd darknode
git submodule add https://github.com/filecoin-project/filecoin-ffi.git .extern/filecoin-ffi
cd .extern/filecoin-ffi
git checkout ${{ env.FILECOIN_FFI_COMMIT }}
make
- name: Install dependencies (Solana FFI)
if: steps.cache-extern.outputs.cache-hit != 'true'
run: |
go get -u github.com/xlab/c-for-go@cef5ec7
cd darknode
git submodule add https://github.com/renproject/solana-ffi.git .extern/solana-ffi
cd .extern/solana-ffi
git checkout ${{ env.SOLANA_FFI_COMMIT }}
make clean
make
- name: Replace submodule extern with cached extern
run: |
cd darknode
go mod edit -replace=github.com/filecoin-project/filecoin-ffi=./.extern/filecoin-ffi
go mod edit -replace=github.com/renproject/solana-ffi=./.extern/solana-ffi
- name: Build the binary
run: |
cd darknode
MAIN_VERSION=$(cat ./VERSION | tr -d "[:space:]")
BRANCH=$(git branch | grep \* | cut -d ' ' -f2)
COMMIT_HASH=$(git describe --always --long)
FULL_VERSION=${MAIN_VERSION}-${BRANCH}-${COMMIT_HASH}
LDFLAGS="-s -w -X main.version=${FULL_VERSION}"
go build -o darknode-linux -ldflags="${LDFLAGS}" ./cmd/darknode
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.RELEASE }}
release_name: ${{ env.RELEASE }}
draft: false
prerelease: ${{ env.PRERELEASE }}
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: darknode/darknode-linux
asset_name: darknode
asset_content_type: application/octet-stream