forked from dashpay/dash
-
Notifications
You must be signed in to change notification settings - Fork 0
157 lines (133 loc) · 5.07 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
name: CI
on:
push:
pull_request:
env:
DOCKER_DRIVER: overlay2
FAST_MODE: false
jobs:
builder-image:
name: Builder Image
runs-on: ubuntu-20.04
services:
docker:
image: docker:20.10.20-dind
options: --privileged
ports:
- 2375:2375
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Log in to GitHub Container Registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Set lowercase branch name
id: vars
run: echo "::set-output name=lowercase_branch::${GITHUB_REF##*/}" | tr '[:upper:]' '[:lower:]'
- name: Pull builder image
run: |
docker pull ghcr.io/${{ github.repository }}/builder-${{ steps.vars.outputs.lowercase_branch }} || true
docker pull ghcr.io/${{ github.repository }}/builder-develop || true
- name: Build and push builder image
run: |
cd contrib/containers/ci
docker build --cache-from ghcr.io/${{ github.repository }}/builder-${{ steps.vars.outputs.lowercase_branch }} --cache-from ghcr.io/${github.repository}/builder-develop -t ghcr.io/${{ github.repository }}/builder-${{ steps.vars.outputs.lowercase_branch }} -f Dockerfile .
docker push ghcr.io/${{ github.repository }}/builder-${{ steps.vars.outputs.lowercase_branch }}
build-depends:
name: Build Dependencies
runs-on: ubuntu-20.04
needs: builder-image
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup MacOS SDK
if: env.HOST == 'x86_64-apple-darwin'
run: |
mkdir -p depends/SDKs
mkdir -p depends/sdk-sources
OSX_SDK_BASENAME="Xcode-${XCODE_VERSION}-${XCODE_BUILD_ID}-extracted-SDK-with-libcxx-headers.tar.gz"
OSX_SDK_PATH="depends/sdk-sources/${OSX_SDK_BASENAME}"
if [ ! -f "$OSX_SDK_PATH" ]; then
echo "Downloading MacOS SDK"
curl --location --fail "${SDK_URL}/${OSX_SDK_BASENAME}" -o "$OSX_SDK_PATH"
fi
if [ -f "$OSX_SDK_PATH" ]; then
echo "Extracting MacOS SDK"
tar -C depends/SDKs -xf "$OSX_SDK_PATH"
- name: Build dependencies
run: make -j$(nproc) -C depends HOST=${HOST} $DEP_OPTS
- name: Cache dependencies
uses: actions/cache@v2
with:
path: |
depends/built
depends/sdk-sources
key: ${{ runner.os }}-depends-${{ hashFiles('contrib/containers/ci/Dockerfile') }}
- name: Upload dependency artifacts
uses: actions/upload-artifact@v2
with:
name: depends
path: |
depends/${HOST}
depends/SDKs
build:
name: Build
runs-on: ubuntu-20.04
needs: build-depends
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup environment
run: |
export CACHE_DIR=$GITHUB_WORKSPACE/cache
echo BUILD_TARGET=$BUILD_TARGET
source ./ci/dash/matrix.sh
- name: Build source
run: ./ci/dash/build_src.sh
- name: Run unit tests
run: ./ci/dash/test_unittests.sh
- name: Cache ccache
uses: actions/cache@v2
with:
path: cache/ccache
key: ${{ runner.os }}-ccache-${{ hashFiles('contrib/containers/ci/Dockerfile') }}
- name: Create tar archive of binaries
run: |
mkdir -p build-ci-tar
tar --exclude='build-ci/dashcore-${{ env.BUILD_TARGET }}/src/bench/bench_dash' \
--exclude='build-ci/dashcore-${{ env.BUILD_TARGET }}/src/bench/bench_dash.exe' \
--exclude='build-ci/dashcore-${{ env.BUILD_TARGET }}/src/qt/test/test_dash-qt' \
--exclude='build-ci/dashcore-${{ env.BUILD_TARGET }}/src/qt/test/test_dash-qt.exe' \
--exclude='build-ci/dashcore-${{ env.BUILD_TARGET }}/src/test/test_dash' \
--exclude='build-ci/dashcore-${{ env.BUILD_TARGET }}/src/test/test_dash.exe' \
--exclude='build-ci/dashcore-${{ env.BUILD_TARGET }}/src/test/fuzz/*' \
-czvf build-ci-tar/binaries.tar.gz build-ci
- name: Upload binaries
uses: actions/upload-artifact@v2
with:
name: binaries
path: build-ci-tar/binaries.tar.gz
test:
name: Test
runs-on: ubuntu-20.04
needs: build
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup environment
run: |
export CACHE_DIR=$GITHUB_WORKSPACE/cache
echo BUILD_TARGET=$BUILD_TARGET
source ./ci/dash/matrix.sh
- name: Run integration tests
run: ./ci/dash/test_integrationtests.sh $INTEGRATION_TESTS_ARGS
- name: Upload test logs
uses: actions/upload-artifact@v2
with:
name: testlogs
path: testlogs
if-no-files-found: ignore
- name: Cache releases
uses: actions/cache@v2
with:
path: releases
key: ${{ runner.os }}-releases-${{ hashFiles('ci/test/00_setup_env_native_qt5.sh') }}