Skip to content

Commit 647eaf0

Browse files
committed
Initial split to rpm/deb
1 parent 7fa2b13 commit 647eaf0

File tree

6 files changed

+413
-6
lines changed

6 files changed

+413
-6
lines changed

.github/workflows/release-test.yml

+366
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,366 @@
1+
name: Release (test)
2+
3+
on:
4+
pull_request:
5+
types:
6+
- labeled
7+
- synchronize
8+
- opened
9+
- reopened
10+
workflow_dispatch:
11+
12+
permissions:
13+
contents: write
14+
actions: read
15+
checks: write
16+
17+
jobs:
18+
make_sbom:
19+
name: SBOM Generation
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 1
25+
- name: "Install SBOM tool"
26+
run: |
27+
set -ex
28+
curl -Lo sbom-tool https://github.com/microsoft/sbom-tool/releases/latest/download/sbom-tool-linux-x64 > sbom-tool
29+
chmod +x sbom-tool
30+
shell: bash
31+
- name: "Produce SBOM"
32+
run: |
33+
set -ex
34+
CCF_VERSION=${{ github.ref_name }}
35+
CCF_VERSION=${CCF_VERSION#ccf-}
36+
./sbom-tool generate -b . -bc . -pn CCF -ps Microsoft -nsb https://sbom.microsoft -pv $CCF_VERSION -V Error
37+
shell: bash
38+
- name: "Upload SBOM"
39+
uses: actions/upload-artifact@v4
40+
with:
41+
name: sbom
42+
path: _manifest/spdx_2.2/*
43+
44+
# release_notes:
45+
# name: Release Notes
46+
# runs-on: ubuntu-latest
47+
# steps:
48+
# - uses: actions/checkout@v4
49+
# with:
50+
# fetch-depth: 1
51+
# - name: "Check Release Notes"
52+
# run: |
53+
# set -ex
54+
# python scripts/extract-release-notes.py --target-git-version
55+
# shell: bash
56+
# - name: "Produce Release Notes"
57+
# run: |
58+
# set -ex
59+
# set -o pipefail
60+
# python ./scripts/extract-release-notes.py --target-git-version --describe-path-changes "./samples/constitution" | tee rel-notes.md
61+
# - name: "Upload .deb Package"
62+
# uses: actions/upload-artifact@v4
63+
# with:
64+
# name: relnotes
65+
# path: rel-notes.md
66+
67+
build_release:
68+
name: Build Release
69+
# needs: release_notes
70+
if: ${{ contains(github.event.pull_request.labels.*.name, 'release-test') || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' }}
71+
strategy:
72+
matrix:
73+
platform:
74+
- name: virtual
75+
os: ubuntu
76+
image: ghcr.io/microsoft/ccf/ci/default:build-14-01-2025
77+
package_version: DEB
78+
test_filter: "benchmark|unit"
79+
- name: snp
80+
os: ubuntu
81+
image: ghcr.io/microsoft/ccf/ci/default:build-14-01-2025
82+
package_version: DEB
83+
- name: virtual
84+
os: azure-linux
85+
image: mcr.microsoft.com/azurelinux/base/core:3.0
86+
package_version: RPM
87+
test_filter: "benchmark|unit|protocolstest|lts"
88+
- name: snp
89+
os: azure-linux
90+
image: mcr.microsoft.com/azurelinux/base/core:3.0
91+
package_version: RPM
92+
93+
runs-on: [self-hosted, 1ES.Pool=gha-virtual-ccf-sub]
94+
container:
95+
image: ${{ matrix.platform.image }}
96+
options: "--user root --publish-all --cap-add NET_ADMIN --cap-add NET_RAW --cap-add SYS_PTRACE -v /lib/modules:/lib/modules:ro"
97+
98+
steps:
99+
- name: "Install dependencies"
100+
if: ${{ matrix.platform.os == 'azure-linux' }}
101+
shell: bash
102+
run: |
103+
set -ex
104+
gpg --import /etc/pki/rpm-gpg/MICROSOFT-RPM-GPG-KEY
105+
tdnf -y update
106+
# Source control
107+
tdnf -y install ca-certificates git
108+
# Build tools
109+
tdnf -y install build-essential clang cmake ninja-build which
110+
# libc++
111+
tdnf -y install libcxx-devel llvm-libunwind-devel llvm-libunwind-static
112+
# Dependencies
113+
tdnf -y install openssl-devel libuv-devel nghttp2-devel curl-devel
114+
# Test dependencies
115+
tdnf -y install libarrow-devel parquet-libs-devel lldb npm jq expect
116+
# Install CDDL via rubygems
117+
tdnf -y install rubygems
118+
gem install cddl
119+
# For packaging and release tests
120+
tdnf -y install rpm-build procps
121+
122+
- uses: actions/checkout@v4
123+
with:
124+
fetch-depth: 0
125+
126+
- name: "Build Release ${{ matrix.platform.name }}"
127+
shell: bash
128+
run: |
129+
set -ex
130+
git config --global --add safe.directory /__w/CCF/CCF
131+
mkdir build
132+
cd build
133+
CC=`which clang` CXX=`which clang++` cmake -GNinja -DCOMPILE_TARGET=${{ matrix.platform.name }} -DCLIENT_PROTOCOLS_TEST=ON -DPACKAGE_TYPE=${{ matrix.platform.package_version }} -DCMAKE_BUILD_TYPE=Release ..
134+
ninja -v | tee build.log
135+
136+
- name: "Install Extended Testing Tools"
137+
if: ${{ matrix.platform.os == 'ubuntu' && matrix.platform.name == 'virtual' }}
138+
run: |
139+
set -ex
140+
sudo apt-get -y update
141+
sudo apt install ansible -y
142+
cd getting_started/setup_vm
143+
ansible-playbook ccf-extended-testing.yml
144+
shell: bash
145+
146+
- name: "Test ${{ matrix.platform.name }}"
147+
if: "${{ matrix.platform.name == 'virtual' }}"
148+
run: |
149+
set -ex
150+
cd build
151+
rm -rf /github/home/.cache
152+
mkdir -p /github/home/.cache
153+
export ASAN_SYMBOLIZER_PATH=$(realpath /usr/bin/llvm-symbolizer-15)
154+
# Unit tests
155+
./tests.sh --output-on-failure -L unit -j$(nproc --all)
156+
# Suite tests
157+
./tests.sh --timeout 600 --output-on-failure -L "suite"
158+
# Most tests
159+
./tests.sh --timeout 360 --output-on-failure -LE "suite|${{ matrix.platform.test_filter }}"
160+
shell: bash
161+
162+
- name: "Upload logs for ${{ matrix.platform.os }}-${{ matrix.platform.name }}"
163+
if: success() || failure()
164+
uses: actions/upload-artifact@v4
165+
with:
166+
name: logs-${{ matrix.platform.os }}-${{ matrix.platform.name }}
167+
path: |
168+
build/workspace/*/*.config.json
169+
build/workspace/*/out
170+
build/workspace/*/err
171+
build/workspace/*.ledger/*
172+
if-no-files-found: ignore
173+
174+
- name: "Make .deb Package"
175+
if: "${{ matrix.platform.os == 'ubuntu' }}"
176+
id: make_deb
177+
run: |
178+
set -ex
179+
set -o pipefail
180+
cd build
181+
cmake -L .. 2>/dev/null | grep CMAKE_INSTALL_PREFIX: | cut -d = -f 2 > /tmp/install_prefix
182+
cpack -V -G DEB
183+
INITIAL_PKG=`ls *.deb`
184+
CCF_GITHUB_PKG=${INITIAL_PKG//\~/_}
185+
if [[ "$INITIAL_PKG" != "$CCF_GITHUB_PKG" ]]; then
186+
mv $INITIAL_PKG $CCF_GITHUB_PKG
187+
fi
188+
echo "name=$CCF_GITHUB_PKG" >> $GITHUB_OUTPUT
189+
shell: bash
190+
191+
- name: "Make .rpm Package"
192+
if: "${{ matrix.platform.os == 'azure-linux' }}"
193+
id: make_rpm
194+
run: |
195+
set -ex
196+
set -o pipefail
197+
cd build
198+
cmake -L .. 2>/dev/null | grep CMAKE_INSTALL_PREFIX: | cut -d = -f 2 > /tmp/install_prefix
199+
cpack -V -G RPM
200+
INITIAL_PKG=`ls *.rpm`
201+
CCF_GITHUB_PKG=${INITIAL_PKG//\~/_}
202+
if [[ "$INITIAL_PKG" != "$CCF_GITHUB_PKG" ]]; then
203+
mv $INITIAL_PKG $CCF_GITHUB_PKG
204+
fi
205+
echo "name=$CCF_GITHUB_PKG" >> $GITHUB_OUTPUT
206+
shell: bash
207+
208+
- name: "Install CCF Debian package"
209+
if: "${{ matrix.platform.os == 'ubuntu' }}"
210+
run: |
211+
set -ex
212+
cd build
213+
sudo apt -y install ./${{ steps.make_deb.outputs.name }}
214+
shell: bash
215+
216+
- name: "Install CCF RPM package"
217+
if: "${{ matrix.platform.os == 'azure-linux' }}"
218+
run: |
219+
set -ex
220+
cd build
221+
tdnf -y install ./${{ steps.make_rpm.outputs.name }}
222+
shell: bash
223+
224+
- name: "Test Installed CCF"
225+
if: "${{ matrix.platform.name == 'virtual' }}"
226+
run: |
227+
set -ex
228+
set -o pipefail
229+
cd build
230+
cat /tmp/install_prefix | xargs -i bash -c "PYTHON_PACKAGE_PATH=../python ./test_install.sh {}"
231+
shell: bash
232+
233+
- name: "Recovery Benchmark for Installed CCF"
234+
if: "${{ matrix.platform.name == 'virtual' }}"
235+
run: |
236+
set -ex
237+
set -o pipefail
238+
cd build
239+
cat /tmp/install_prefix | xargs -i bash -c "PYTHON_PACKAGE_PATH=../python ./recovery_benchmark.sh {}"
240+
shell: bash
241+
242+
- name: "Test Building a Sample Against Installed CCF"
243+
run: |
244+
set -ex
245+
./tests/test_install_build.sh -DCOMPILE_TARGET=${{ matrix.platform.name }}
246+
shell: bash
247+
248+
- name: "Upload .deb Package"
249+
if: "${{ matrix.platform.os == 'ubuntu' }}"
250+
uses: actions/upload-artifact@v4
251+
with:
252+
name: pkg-${{ matrix.platform.os }}-${{ matrix.platform.name }}
253+
path: build/${{ steps.make_deb.outputs.name }}
254+
255+
- name: "Upload .rpm Package"
256+
if: "${{ matrix.platform.os == 'azure-linux' }}"
257+
uses: actions/upload-artifact@v4
258+
with:
259+
name: pkg-${{ matrix.platform.os }}-${{ matrix.platform.name }}
260+
path: build/${{ steps.make_rpm.outputs.name }}
261+
262+
- name: "Upload Compatibility Report"
263+
if: "${{ matrix.platform.os == 'ubuntu' && matrix.platform.name == 'virtual' }}"
264+
uses: actions/upload-artifact@v4
265+
with:
266+
name: compatibility
267+
path: build/compatibility_report.json
268+
269+
- name: "Upload TLS Report"
270+
if: "${{ matrix.platform.os == 'ubuntu' && matrix.platform.name == 'virtual' }}"
271+
uses: actions/upload-artifact@v4
272+
with:
273+
name: tls
274+
path: build/tls_report.html
275+
276+
- name: "Build Python Wheel"
277+
if: "${{ matrix.platform.os == 'ubuntu' && matrix.platform.name == 'virtual' }}"
278+
id: build_wheel
279+
run: |
280+
set -ex
281+
cd python
282+
python3 -m venv env
283+
source ./env/bin/activate
284+
pip install wheel build
285+
python -m build --wheel
286+
WHL=`ls dist/*.whl`
287+
echo "name=$WHL" >> $GITHUB_OUTPUT
288+
shell: bash
289+
290+
- name: "Upload Python Wheel"
291+
if: "${{ matrix.platform.os == 'ubuntu' && matrix.platform.name == 'virtual' }}"
292+
uses: actions/upload-artifact@v4
293+
with:
294+
name: wheel
295+
path: python/${{ steps.build_wheel.outputs.name }}
296+
297+
- name: "Build TS Package"
298+
if: "${{ matrix.platform.os == 'ubuntu' && matrix.platform.name == 'virtual' }}"
299+
id: build_tstgz
300+
run: |
301+
set -ex
302+
cd js/ccf-app
303+
CCF_VERSION=$(<../../build/VERSION_LONG)
304+
CCF_VERSION=${CCF_VERSION#ccf-}
305+
echo "Setting npm package version to ${CCF_VERSION}"
306+
npm version $CCF_VERSION
307+
npm pack
308+
PKG=`ls *.tgz`
309+
echo "name=$PKG" >> $GITHUB_OUTPUT
310+
shell: bash
311+
312+
- name: "Upload TS Package"
313+
if: "${{ matrix.platform.os == 'ubuntu' && matrix.platform.name == 'virtual' }}"
314+
uses: actions/upload-artifact@v4
315+
with:
316+
name: tstgz
317+
path: js/ccf-app/${{ steps.build_tstgz.outputs.name }}
318+
319+
create_release:
320+
needs:
321+
- build_release
322+
- make_sbom
323+
name: Create Release
324+
runs-on: ubuntu-latest
325+
steps:
326+
- uses: actions/checkout@v4
327+
with:
328+
fetch-depth: 1
329+
- name: Download Packages
330+
uses: actions/download-artifact@v4
331+
with:
332+
path: pkg
333+
pattern: pkg-*
334+
merge-multiple: true
335+
- name: Download Release Notes
336+
uses: actions/download-artifact@v4
337+
with:
338+
name: relnotes
339+
- name: Download Compatibility Report
340+
uses: actions/download-artifact@v4
341+
with:
342+
name: compatibility
343+
- name: Download TLS Report
344+
uses: actions/download-artifact@v4
345+
with:
346+
name: tls
347+
- name: Download Python Wheel
348+
uses: actions/download-artifact@v4
349+
with:
350+
path: wheel
351+
name: wheel
352+
- name: Download TS Package
353+
uses: actions/download-artifact@v4
354+
with:
355+
path: tstgz
356+
name: tstgz
357+
- name: Download SBOM
358+
uses: actions/download-artifact@v4
359+
with:
360+
path: sbom
361+
name: sbom
362+
- run: |
363+
echo "Creating release will be done here"
364+
shell: bash
365+
env:
366+
GH_TOKEN: ${{ github.token }}

CMakeLists.txt

+5-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,11 @@ if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
3636
)
3737
endif()
3838

39-
include(${CCF_DIR}/cmake/cpack_settings.cmake)
39+
if(PACKAGE_TYPE STREQUAL "DEB")
40+
include(${CCF_DIR}/cmake/cpack_deb.cmake)
41+
elseif(PACKAGE_TYPE STREQUAL "RPM")
42+
include(${CCF_DIR}/cmake/cpack_rpm.cmake)
43+
endif()
4044

4145
message(STATUS "CMAKE_INSTALL_PREFIX is '${CMAKE_INSTALL_PREFIX}'")
4246

File renamed without changes.

0 commit comments

Comments
 (0)