forked from KomodoPlatform/komodo
-
Notifications
You must be signed in to change notification settings - Fork 2
203 lines (183 loc) · 8.29 KB
/
komodod_cd.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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
# we are using separate workflow because CI producing test binaries with CPPFLAGS=-DTESTMODE
name: Komodo CD test releases
on:
push:
branches:
- beta
- dev
- research
jobs:
linux-build:
name: Linux Build
# using there as old release as possible with GHA worker to provide better compatibility
runs-on: ubuntu-16.04
steps:
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch
- name: Shortify commit sha
shell: bash
run: echo "##[set-output name=sha_short;]$(echo ${GITHUB_SHA::7})"
id: shortify_commit
- name: Checkout code
uses: actions/checkout@v2
- name: Install deps (Linux)
run: |
sudo apt-get update # prevents repo404 errors on apt-remove below
sudo apt-get remove php* msodbcsql17 mysql* powershell dotn*
sudo apt-get update
sudo ACCEPT_EULA=Y apt-get upgrade -y
sudo apt-get install -q \
curl \
python3 \
python3-dev \
python3-setuptools \
python3-pip \
libcurl4-openssl-dev \
libssl-dev -y
- name: Build (Linux)
if: runner.os == 'Linux'
run: |
./zcutil/build.sh -j$(nproc)
zip --junk-paths komodo-linux src/komodod src/komodo-cli
- name: Upload komodo-linux.zip as artifact
uses: actions/upload-artifact@v1
with:
name: komodo-linux
path: ./komodo-linux.zip
- name: Login to docker hub
uses: actions-hub/docker/login@master
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
- name: Build container
run: docker build -f Dockerfile.release -t komodoofficial/komodo:cd_release_${{ steps.shortify_commit.outputs.sha_short }}_${{ steps.extract_branch.outputs.branch }} .
- name: Push to docker hub
uses: actions-hub/docker@master
with:
args: push komodoofficial/komodo:cd_release_${{ steps.shortify_commit.outputs.sha_short }}_${{ steps.extract_branch.outputs.branch }}
osx-build:
name: OSX Build
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- name: Install deps (macOS)
run: |
brew update
brew upgrade
brew tap discoteq/discoteq; brew install flock
brew install autoconf autogen automake
brew install gcc@8
brew install binutils
brew install protobuf
brew install coreutils
brew install wget
brew install python3
brew install gmp
- name: Build (macOS)
run: |
./zcutil/build-mac.sh -j4
zip --junk-paths komodo-osx src/komodod src/komodo-cli
- name: Upload komodo-osx.zip as artifact
uses: actions/upload-artifact@v1
with:
name: komodo-osx
path: ./komodo-osx.zip
windows-build:
name: Windows Build (mingw)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install deps (Windows)
env:
DEBIAN_FRONTEND: noninteractive
run: |
sudo apt-get update # prevents repo404 errors on apt-remove below
sudo apt-get remove php* msodbcsql17 mysql* powershell containernetworking-* containers* dotn*
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install build-essential pkg-config libc6-dev m4 g++-multilib autoconf libtool \
libncurses-dev unzip wget bsdmainutils automake libboost-all-dev libssl-dev \
libprotobuf-dev protobuf-compiler libqrencode-dev libdb++-dev ntp ntpdate nano \
software-properties-common curl libevent-dev libcurl4-gnutls-dev cmake clang \
libsodium-dev ncurses-dev git python3 python3-zmq zlib1g-dev mingw-w64 -y
curl https://sh.rustup.rs -sSf | sh -s -- -y
source $HOME/.cargo/env
rustup target add x86_64-pc-windows-gnu
sudo update-alternatives --set x86_64-w64-mingw32-gcc /usr/bin/x86_64-w64-mingw32-gcc-posix
sudo update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix
- name: Build (Windows)
run: |
./zcutil/build-win.sh -j$(nproc)
zip --junk-paths komodo-win src/komodod.exe src/komodo-cli.exe
- name: Upload komodo-win.zip as artifact
uses: actions/upload-artifact@v1
with:
name: komodo-win
path: ./komodo-win.zip
publish-release:
name: Publishing CD releases
runs-on: ubuntu-latest
needs: [linux-build, osx-build, windows-build]
steps:
- name: Download komodo-linux.zip
uses: actions/download-artifact@v1
with:
name: komodo-linux
- name: Download komodo-osx.zip
uses: actions/download-artifact@v1
with:
name: komodo-osx
- name: Download komodo-win.zip
uses: actions/download-artifact@v1
with:
name: komodo-win
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch
- name: Shortify commit sha
shell: bash
run: echo "##[set-output name=sha_short;]$(echo ${GITHUB_SHA::7})"
id: shortify_commit
- name: Create Release
id: create_release
uses: actions/create-release@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: cd_release_${{ steps.shortify_commit.outputs.sha_short }}_${{ steps.extract_branch.outputs.branch }}
release_name: CD Release ${{ steps.shortify_commit.outputs.sha_short }} ${{ steps.extract_branch.outputs.branch }}
draft: false
prerelease: true
- name: Upload Linux Release Asset
id: upload-linux-release-asset
uses: actions/upload-release-asset@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: komodo-linux/komodo-linux.zip
asset_name: komodo_${{ steps.shortify_commit.outputs.sha_short }}_${{ steps.extract_branch.outputs.branch }}_linux.zip
asset_content_type: application/zip
- name: Upload OSX Release Asset
id: upload-osx-release-asset
uses: actions/upload-release-asset@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: komodo-osx/komodo-osx.zip
asset_name: komodo_${{ steps.shortify_commit.outputs.sha_short }}_${{ steps.extract_branch.outputs.branch }}_osx.zip
asset_content_type: application/zip
- name: Upload Windows Release Asset
id: upload-windows-release-asset
uses: actions/upload-release-asset@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: komodo-win/komodo-win.zip
asset_name: komodo_${{ steps.shortify_commit.outputs.sha_short }}_${{ steps.extract_branch.outputs.branch }}_win.zip
asset_content_type: application/zip