-
Notifications
You must be signed in to change notification settings - Fork 40
140 lines (133 loc) · 4.68 KB
/
custom_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
name: Custom Docker and Binary
on:
workflow_dispatch:
inputs:
branch_name:
description: 'Branch name'
default: ''
required: true
image_version:
description: 'Image version for docker hub'
default: ''
required: true
cmake_options:
description: 'Additional cmake options'
default: ''
required: false
jobs:
main_job:
runs-on: self-hosted
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
steps:
- name: update apt
run: sudo add-apt-repository ppa:ubuntu-toolchain-r/test; sudo apt-get update
- name: install packages
run: |
sudo apt-get -y remove libzmq* || true
sudo apt-get -y install software-properties-common
sudo apt-get -y install gcc-9 g++-9
- name: Use g++-9 and gcov-9 by default
run: |
echo "Updating all needed alternatives"
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 9
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-9 9
sudo update-alternatives --install /usr/bin/gcov gcov /usr/bin/gcov-9 9
sudo update-alternatives --install /usr/bin/gcov-dump gcov-dump /usr/bin/gcov-dump-9 9
sudo update-alternatives --install /usr/bin/gcov-tool gcov-tool /usr/bin/gcov-tool-9 9
echo "Checking alternative for gcc"
which gcc
gcc --version
echo "Checking alternative for g++"
which g++
g++ --version
echo "Checking alternative for gcov"
which gcov
gcov --version
echo "Checking alternative for gcov-dump"
which gcov-dump
gcov-dump --version
echo "Checking alternative for gcov-tool"
which gcov-tool
gcov-tool --version
- name: Extract repo name
run: echo ::set-env name=REPOSITORY_NAME::$(echo "$GITHUB_REPOSITORY" | awk -F / '{print $2}')
shell: bash
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch
- name: checkout
uses: actions/checkout@v2
with:
ref: ${{ github.event.inputs.branch_name }}
- name: Submodule update
run: |
rm -rf ./libconsensus || true
ls -1
git submodule update --init --recursive
- name: update apt
run: sudo add-apt-repository ppa:ubuntu-toolchain-r/test;
- name: Prepare ccache timestamp
id: ccache_cache_timestamp
shell: cmake -P {0}
run: |
string(TIMESTAMP current_date "%Y-%m-%d-%H;%M;%S" UTC)
message("::set-output name=timestamp::${current_date}")
- name: Ccache cache files
uses: actions/cache@v1.1.0
with:
path: .ccache
key: ${ { matrix.config.name } }-ccache-${ { steps.ccache_cache_timestamp.outputs.timestamp } }
restore-keys: |
${ { matrix.config.name } }-ccache-
- name: Build dependencies
run: |
export CC=gcc-9
export CXX=g++-9
export TARGET=all
export CMAKE_BUILD_TYPE=Debug
cd deps
./clean.sh
rm -f ./libwebsockets-from-git.tar.gz
./build.sh PARALLEL_COUNT=$(nproc) DEBUG=1
cd ..
- name: Configure all
run: |
export CC=gcc-9
export CXX=g++-9
export TARGET=all
export CMAKE_BUILD_TYPE=Debug
mkdir -p build
cd build
cmake -DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE ${{ github.event.inputs.cmake_options }} ..
cd ..
- name: Build all
run: |
export CC=gcc-9
export CXX=g++-9
export TARGET=all
export CMAKE_BUILD_TYPE=Debug
cd build
make skaled -j$(nproc)
#echo "Ensure release mode skaled does not have any debug markers"
#strip skaled/skaled
cd ..
- name: Build and publish container
run: |
cp build/skaled/skaled scripts/skale_build/executable/
export BRANCH=${{ github.event.inputs.branch_name }}
export VERSION=${{ github.event.inputs.image_version }}
echo "Version $VERSION"
export RELEASE=true
bash ./scripts/build_and_publish.sh
- name: Upload skaled binary as artifact
uses: actions/upload-artifact@v2
if: ${{ always() }}
with:
name: skaled
path: ./build/skaled/skaled