Skip to content
This repository was archived by the owner on Sep 29, 2025. It is now read-only.

Commit 04f8050

Browse files
author
Philip de Nier
committed
Build release on Ubuntu and use source release from Ubuntu
This also fixes the loss of execute file permissions on shell scripts.
1 parent 5da66e0 commit 04f8050

File tree

2 files changed

+69
-1
lines changed

2 files changed

+69
-1
lines changed

.github/workflows/release.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ jobs:
1111
os: windows-2019
1212
- name: macos-xcode-universal
1313
os: macos-13
14+
- name: ubuntu
15+
os: ubuntu-latest
1416

1517
runs-on: ${{ matrix.os }}
1618

@@ -52,15 +54,27 @@ jobs:
5254
cd bmx-*
5355
cmake -P release/macos_universal_binary_release.cmake
5456
57+
- name: Ubuntu binary build (build only, no artefacts)
58+
if: ${{ contains(matrix.os, 'ubuntu') }}
59+
shell: bash
60+
working-directory: ../
61+
run: |
62+
mkdir binary_release
63+
cd binary_release
64+
tar -xzf ../source_release/bmx-*.tar.gz
65+
cd bmx-*
66+
cmake -P release/ubuntu_binary_release_build_only.cmake
67+
5568
# actions/upload-artifact doesn't allow . and .. in paths
5669
- name: Move artefacts into working directory
70+
if: ${{ !contains(matrix.os, 'ubuntu') }}
5771
shell: bash
5872
run: |
5973
mv ../source_release .
6074
mv ../binary_release/bmx-*/out/package ./binary_release
6175
6276
- name: Upload source release
63-
if: ${{ contains(matrix.name, 'windows') }}
77+
if: ${{ contains(matrix.name, 'ubuntu') }}
6478
uses: actions/upload-artifact@v4
6579
with:
6680
name: source-release
@@ -69,6 +83,7 @@ jobs:
6983
source_release/*.tar.gz
7084
7185
- name: Upload binary release
86+
if: ${{ !contains(matrix.os, 'ubuntu') }}
7287
uses: actions/upload-artifact@v4
7388
with:
7489
name: binary-release-${{ matrix.name }}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Build bmx on Ubuntu using the source release.
2+
3+
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)
4+
5+
if(NOT DEFINED BMX_BRANCH)
6+
set(BMX_BRANCH main)
7+
endif()
8+
if(NOT DEFINED USE_GIT_CLONE)
9+
set(USE_GIT_CLONE OFF)
10+
endif()
11+
12+
include(${CMAKE_CURRENT_LIST_DIR}/common.cmake)
13+
14+
15+
function(copy_and_rename_file source dest)
16+
get_filename_component(dest_dir ${dest} DIRECTORY)
17+
get_filename_component(source_name ${source} NAME)
18+
file(COPY ${source} DESTINATION ${dest_dir})
19+
file(RENAME ${dest_dir}/${source_name} ${dest})
20+
endfunction()
21+
22+
23+
if(USE_GIT_CLONE)
24+
# Clone bmx
25+
set(bmx_dir "${CMAKE_CURRENT_BINARY_DIR}/bmx")
26+
if(EXISTS ${bmx_dir})
27+
message(FATAL_ERROR "Can't continue with clean release as 'bmx' directory already exists")
28+
endif()
29+
run_command("${CMAKE_CURRENT_BINARY_DIR}" git clone https://github.com/bbc/bmx.git)
30+
run_command("${bmx_dir}" git checkout ${BMX_BRANCH})
31+
else()
32+
get_filename_component(bmx_dir "${CMAKE_CURRENT_LIST_DIR}/.." REALPATH)
33+
if(EXISTS ${bmx_dir}/out)
34+
message(FATAL_ERROR "Can't continue with clean release as 'out' sub-directory already exists")
35+
endif()
36+
endif()
37+
38+
# Create build, install and package directories
39+
set(build_dir "${bmx_dir}/out/build")
40+
file(MAKE_DIRECTORY ${build_dir})
41+
set(install_dir "${bmx_dir}/out/install")
42+
file(MAKE_DIRECTORY ${install_dir})
43+
44+
extract_version("${bmx_dir}/CMakeLists.txt" bmx_version)
45+
set(package_dir "${bmx_dir}/out/package")
46+
set(bmx_package_dir "${package_dir}/bmx-ubuntu-binary-${bmx_version}")
47+
file(MAKE_DIRECTORY ${bmx_package_dir})
48+
49+
# Configure, build, test and install
50+
run_command("${build_dir}" cmake -DCMAKE_INSTALL_PREFIX=../install -DBMX_BUILD_URIPARSER_SOURCE=ON -DBMX_BUILD_EXPAT_SOURCE=ON -DBMX_BUILD_WITH_LIBCURL=ON -DCMAKE_BUILD_TYPE=Release ../../)
51+
run_command("${build_dir}" cmake --build .)
52+
run_command("${build_dir}" ctest --output-on-failure)
53+
run_command("${build_dir}" cmake --build . --target install)

0 commit comments

Comments
 (0)