-
Notifications
You must be signed in to change notification settings - Fork 3
198 lines (180 loc) · 7.64 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
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
name: Build
on:
workflow_dispatch:
inputs:
package:
description: 'Package to build'
required: true
default: 'syno-magnet'
publish:
description: 'Publish to repository'
required: false
default: 'false'
pull_request:
paths:
- 'spk/**'
- 'cross/**'
- 'native/**'
push:
tags:
- "*-*"
branches:
- "**"
paths:
- 'spk/**'
- 'cross/**'
- 'native/**'
jobs:
prepare:
name: Prepare for Build
runs-on: ubuntu-latest
# provide results to other jobs
outputs:
arch_packages: ${{ steps.dependencies.outputs.arch_packages }}
noarch_packages: ${{ steps.dependencies.outputs.noarch_packages }}
download_packages: ${{ steps.dependencies.outputs.download_packages }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
submodules: recursive
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0
persist-credentials: false
- name: Get changed files for pull request
if: github.event_name == 'pull_request'
id: getfile_pr
run: |
git diff --no-commit-id --name-only -r origin/master...${{github.event.pull_request.head.sha}} | xargs
echo "::set-output name=files::$(git diff --no-commit-id --name-only -r origin/master...${{github.event.pull_request.head.sha}} | xargs)"
- name: Get changed files for push
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') == false
id: getfile
run: |
git diff-tree --no-commit-id --name-only -r ${{ github.sha }} | xargs
echo "::set-output name=files::$(git diff-tree --no-commit-id --name-only -r ${{ github.sha }} | xargs)"
- name: Evaluate dependencies
id: dependencies
run: ./.github/actions/prepare.sh
env:
GH_FILES: ${{ steps.getfile.outputs.files }} ${{ steps.getfile_pr.outputs.files }}
SPK_TO_BUILD: ${{ github.event.inputs.package }}
download:
name: Download sources
needs: prepare
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
submodules: recursive
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0
persist-credentials: false
- name: Cache downloaded files
uses: actions/cache@v2
with:
path: distrib
# use run_id in key to cache within workflow only.
key: distrib-${{ github.run_id }}
- name: Download source files
run: ./.github/actions/download.sh
env:
DOWNLOAD_PACKAGES: ${{ needs.prepare.outputs.download_packages }}
build:
name: Build
needs: [ download, prepare ]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# x64=x86_64, evansport=i686, aarch64=armv8, armv7, hi3535=armv7l, 88f6281=armv5, qoriq=ppc
# https://github.com/SynoCommunity/spksrc/wiki/Synology-and-SynoCommunity-Package-Architectures
# arch: [noarch, noarch-6.2, noarch-7.0, x64-6.2, x64-7.0, evansport-6.2, evansport-7.0, aarch64-6.2, aarch64-7.0, armv7-6.2, armv7-7.0, hi3535-6.2, 88f6281-6.2, qoriq-6.2, comcerto2k-7.0]
## arch: [armada37xx-6.2.3, armada37xx-7.0, cedarview-6.2.3, cedarview-7.0, x64-6.2.3, x64-7.0]
arch: [88f6281-6.2.3 ,alpine-6.2.3 ,apollolake-6.2.3 ,armada370-6.2.3 ,armada375-6.2.3 ,armada37xx-6.2.3 ,armada38x-6.2.3 ,armadaxp-6.2.3 ,avoton-6.2.3 ,braswell-6.2.3 ,broadwell-6.2.3 ,broadwellnk-6.2.3 ,bromolow-6.2.3 ,cedarview-6.2.3 ,comcerto2k-6.2.3 ,denverton-6.2.3 ,dockerx64-6.2.3 ,evansport-6.2.3 ,geminilake-6.2.3 ,grantley-6.2.3 ,hi3535-6.2.3 ,kvmx64-6.2.3 ,monaco-6.2.3 ,purley-6.2.3 ,qoriq-6.2.3 ,rtd1296-6.2.3 ,v1000-6.2.3 ,x64-6.2.3 ,x86-6.2.3 ,alpine-7.0 ,apollolake-7.0 ,armada370-7.0 ,armada375-7.0 ,armada37xx-7.0 ,armada38x-7.0 ,armadaxp-7.0 ,avoton-7.0 ,braswell-7.0 ,broadwellnk-7.0 ,bromolow-7.0 ,cedarview-7.0 ,comcerto2k-7.0 ,denverton-7.0 ,dockerx64-7.0 ,evansport-7.0 ,geminilake-7.0 ,grantley-7.0 ,hi3535-7.0 ,kvmx64-7.0 ,monaco-7.0 ,purley-7.0 ,qoriq-7.0 ,rtd1296-7.0 ,v1000-7.0]
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
submodules: recursive
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0
persist-credentials: false
- name: Cache toolchains
uses: actions/cache@v2
with:
path: toolchain/*/work
key: toolchain-${{ matrix.arch }}-v3-${{ hashFiles('toolchain/*/digests') }}
- name: Use cache of downloaded files
uses: actions/cache@v2
with:
path: distrib
key: distrib-${{ github.run_id }}
- name: Build Package (file changes)
if: startsWith(github.ref, 'refs/tags/') == false
# We don't want to stop the build on errors.
# Errors are reported in "Build Status"
continue-on-error: true
uses: docker://ghcr.io/synocommunity/spksrc:latest
with:
entrypoint: ./.github/actions/build.sh
env:
ARCH_PACKAGES: ${{ needs.prepare.outputs.arch_packages }}
NOARCH_PACKAGES: ${{ needs.prepare.outputs.noarch_packages }}
PUBLISH: ${{ github.event.inputs.publish }}
API_KEY: ${{ secrets.PUBLISH_API_KEY }}
# https://github.com/SynoCommunity/spksrc/wiki/Compile-and-build-rules
GH_ARCH: ${{ matrix.arch }}
BUILD_ERROR_FILE: /github/workspace/build_errors.txt
BUILD_ERROR_LOGFILE: /github/workspace/build_log_errors.txt
BUILD_UNSUPPORTED_FILE: /github/workspace/build_unsupported.txt
BUILD_SUCCESS_FILE: /github/workspace/build_success.txt
- name: Build Package (Tag)
if: startsWith(github.ref, 'refs/tags/')
# We don't want to stop the build on errors.
# Errors are reported in "Build Status"
continue-on-error: true
uses: docker://ghcr.io/synocommunity/spksrc:latest
with:
entrypoint: ./.github/actions/build-tag.sh
env:
# https://github.com/SynoCommunity/spksrc/wiki/Compile-and-build-rules
GH_ARCH: ${{ matrix.arch }}
API_KEY: ${{ secrets.PUBLISH_API_KEY }}
BUILD_ERROR_FILE: /github/workspace/build_errors.txt
BUILD_ERROR_LOGFILE: /github/workspace/build_log_errors.txt
BUILD_UNSUPPORTED_FILE: /github/workspace/build_unsupported.txt
BUILD_SUCCESS_FILE: /github/workspace/build_success.txt
- name: Build Status
id: build_status
# We need this status since we don't want to stop the build on errors.
# Here we fail on build errors found in the build error file.
uses: docker://ghcr.io/synocommunity/spksrc:latest
with:
entrypoint: ./.github/actions/build_status.sh
env:
BUILD_ERROR_FILE: /github/workspace/build_errors.txt
BUILD_ERROR_LOGFILE: /github/workspace/build_log_errors.txt
BUILD_UNSUPPORTED_FILE: /github/workspace/build_unsupported.txt
BUILD_SUCCESS_FILE: /github/workspace/build_success.txt
- name: Upload artifacts
if: success()
uses: actions/upload-artifact@v2
with:
name: packages
path: packages/*.spk
release:
needs: build
name: Release
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
- name: Download build artifacts
uses: actions/download-artifact@v2
- name: Create GitHub release
uses: softprops/action-gh-release@v1
with:
files: 'packages/*.spk'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}