Skip to content

Commit 674da71

Browse files
committed
CMake and CI maintenance, use Conan
1 parent 7bf95e0 commit 674da71

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1113
-786
lines changed

.github/workflows/documentation.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77

88
jobs:
99
deploy-docs:
10-
runs-on: ubuntu-20.04
10+
runs-on: ubuntu-22.04
1111

1212
steps:
1313
- uses: actions/checkout@v4
@@ -68,8 +68,6 @@ jobs:
6868
- name: Generate documentation
6969
run: ./scripts/ci/gen-docs.sh /tmp/staging
7070
env:
71-
CC: gcc-10
72-
CXX: g++-10
7371
CMAKE_PREFIX_PATH: /tmp/gtest
7472

7573
# Commit the new documentation, squash the commits, and push it to GitHub

.github/workflows/linux.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ on:
1212

1313
jobs:
1414
build:
15-
runs-on: ubuntu-20.04
15+
runs-on: ubuntu-22.04
1616
env:
1717
HOST: 'x86_64-centos7-linux-gnu'
1818
TOOLS_VERSION: '0.1.0-beta3'
@@ -66,7 +66,7 @@ jobs:
6666

6767
test:
6868
needs: [build]
69-
runs-on: ubuntu-20.04
69+
runs-on: ubuntu-22.04
7070

7171
steps:
7272
- uses: actions/checkout@v4
@@ -106,7 +106,7 @@ jobs:
106106
release:
107107
if: ${{ github.event.action == 'released' || github.event.action == 'prereleased' }}
108108
needs: [test]
109-
runs-on: ubuntu-20.04
109+
runs-on: ubuntu-22.04
110110

111111
steps:
112112
- name: Download

.github/workflows/matlab.yml

Lines changed: 65 additions & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -11,156 +11,108 @@ on:
1111
types: ['released', 'prereleased']
1212

1313
jobs:
14-
build-linux:
15-
runs-on: ubuntu-latest
16-
env:
17-
HOST: 'x86_64-centos7-linux-gnu'
18-
TOOLS_VERSION: '0.1.0-beta3'
19-
TOOLS_URL: 'https://github.com/tttapa/cross-python/releases/download'
20-
steps:
21-
- uses: actions/checkout@v4
22-
with:
23-
submodules: recursive
24-
- name: Set up MATLAB
25-
uses: matlab-actions/setup-matlab@64144ac4bb7c754f9ef7642f693671c873701c60
26-
with:
27-
release: R2020b
28-
- name: Download toolchain
29-
run: wget "${{ env.TOOLS_URL }}/${{ env.TOOLS_VERSION }}/full-${{ env.HOST }}.tar.xz" -O- | sudo tar xJ -C /opt
30-
- name: Configure
31-
run: |
32-
host="${{ env.HOST }}"
33-
staging="/opt/$host"
34-
cmake -B build -S QPALM \
35-
-D CMAKE_BUILD_TYPE=RelWithDebInfo \
36-
-D QPALM_WITH_MEX=On \
37-
-D CMAKE_POSITION_INDEPENDENT_CODE=On \
38-
-D CMAKE_C_COMPILER="$staging/x-tools/$host/bin/$host-gcc" \
39-
-D CMAKE_CXX_COMPILER="$staging/x-tools/$host/bin/$host-g++" \
40-
-D CMAKE_Fortran_COMPILER="$staging/x-tools/$host/bin/$host-gfortran"
41-
env:
42-
CXXFLAGS: "-march=skylake -static-libstdc++ -static-libgcc"
43-
LDFLAGS: "-static-libstdc++ -static-libgcc"
44-
CFLAGS: "-march=skylake -static-libgcc"
45-
- name: Build
46-
run: |
47-
cmake --build build \
48-
--config RelWithDebInfo \
49-
-j
50-
- name: Install
51-
run: |
52-
cmake --install build \
53-
--config RelWithDebInfo \
54-
--component mex_interface \
55-
--prefix staging
56-
- name: Package
57-
run: |
58-
zip -r ../qpalm-matlab-glnxa64.zip ./*
59-
working-directory: staging
60-
- name: Upload
61-
uses: actions/upload-artifact@v4
62-
with:
63-
name: qpalm-matlab-glnxa64
64-
path: qpalm-matlab-glnxa64.zip
65-
- name: Release
66-
if: ${{ github.event.action == 'released' || github.event.action == 'prereleased' }}
67-
uses: softprops/action-gh-release@73e673b2dead314c6b971e962dd8e84e230ae99d
68-
with:
69-
files: qpalm-matlab-glnxa64.zip
70-
71-
build-macos:
72-
runs-on: macos-${{ matrix.macos-version }}
14+
build:
7315
strategy:
7416
matrix:
75-
macos-version: ['13', '14']
7617
include:
77-
- macos-version: '14'
78-
arch: 'maca64'
18+
- os: ubuntu-22.04
19+
name: glnxa64
20+
matlab-release: 'R2021a'
21+
host: x86_64-bionic-linux-gnu
22+
- os: macos-14
23+
name: maca64
7924
matlab-release: 'R2023b'
80-
- macos-version: '13'
81-
arch: 'maci64'
25+
host: macos
26+
- os: macos-13
27+
name: maci64
8228
matlab-release: 'R2021a'
29+
host: macos
30+
fail-fast: false
31+
runs-on: ${{ matrix.os }}
8332
steps:
8433
- uses: actions/checkout@v4
8534
with:
8635
submodules: recursive
36+
37+
- name: Setup Conan and sccache
38+
uses: ./.github/workflows/setup-conan
39+
with:
40+
python-version: '3.12'
41+
cache-key: build-matlab-${{ matrix.name }}
42+
8743
- name: Set up MATLAB
8844
uses: matlab-actions/setup-matlab@64144ac4bb7c754f9ef7642f693671c873701c60
45+
id: matlab
8946
with:
9047
release: ${{ matrix.matlab-release }}
91-
- name: Configure
92-
run: |
93-
cmake -B build -S QPALM \
94-
-D CMAKE_BUILD_TYPE=RelWithDebInfo \
95-
-D QPALM_WITH_MEX=On \
96-
-D CMAKE_POSITION_INDEPENDENT_CODE=On
48+
9749
- name: Build
98-
run: |
99-
cmake --build build \
100-
--config RelWithDebInfo \
101-
-j
102-
- name: Install
103-
run: |
104-
cmake --install build \
105-
--config RelWithDebInfo \
106-
--component mex_interface \
107-
--prefix staging
50+
run: >
51+
bash scripts/ci/build-matlab.sh
52+
"${{ steps.matlab.outputs.matlabroot }}" ${{ matrix.host }} . staging
53+
10854
- name: Package
109-
run: |
110-
zip -r ../qpalm-matlab-${{ matrix.arch }}.zip ./*
55+
run: zip -r ../qpalm-matlab-${{ matrix.name }}.zip ./*
11156
working-directory: staging
57+
11258
- name: Upload
11359
uses: actions/upload-artifact@v4
11460
with:
115-
name: qpalm-matlab-${{ matrix.arch }}
116-
path: qpalm-matlab-${{ matrix.arch }}.zip
61+
name: qpalm-matlab-${{ matrix.name }}
62+
path: qpalm-matlab-${{ matrix.name }}.zip
11763
- name: Release
11864
if: ${{ github.event.action == 'released' || github.event.action == 'prereleased' }}
119-
uses: softprops/action-gh-release@73e673b2dead314c6b971e962dd8e84e230ae99d
65+
uses: softprops/action-gh-release@17cd0d34deddf848fc0e7d9be5202c148c270a0a
12066
with:
121-
files: qpalm-matlab-${{ matrix.arch }}.zip
67+
files: qpalm-matlab-${{ matrix.name }}.zip
68+
69+
- run: conan cache clean
12270

12371
build-windows:
124-
runs-on: windows-latest
72+
strategy:
73+
matrix:
74+
include:
75+
- os: windows-2022
76+
name: win64
77+
matlab-release: 'R2021a'
78+
host: amd64
79+
runs-on: ${{ matrix.os }}
12580
steps:
12681
- uses: actions/checkout@v4
12782
with:
12883
submodules: recursive
84+
85+
- name: Setup Conan and sccache
86+
uses: ./.github/workflows/setup-conan
87+
with:
88+
python-version: '3.12'
89+
cache-key: build-matlab-${{ matrix.name }}
90+
12991
- name: Set up MATLAB
13092
uses: matlab-actions/setup-matlab@64144ac4bb7c754f9ef7642f693671c873701c60
93+
id: matlab
13194
with:
132-
release: R2021a
133-
- name: Configure
134-
shell: pwsh
135-
run: |
136-
cmake -B build -S QPALM `
137-
-D CMAKE_BUILD_TYPE=RelWithDebInfo `
138-
-D QPALM_WITH_MEX=On `
139-
-D CMAKE_POSITION_INDEPENDENT_CODE=On
95+
release: ${{ matrix.matlab-release }}
96+
14097
- name: Build
141-
shell: pwsh
142-
run: |
143-
cmake --build build `
144-
--config RelWithDebInfo `
145-
-j
146-
- name: Install
147-
shell: pwsh
148-
run: |
149-
cmake --install build `
150-
--config RelWithDebInfo `
151-
--component mex_interface `
152-
--prefix staging
98+
shell: cmd
99+
run: >
100+
call .\scripts\ci\build-matlab-windows.bat
101+
"${{ steps.matlab.outputs.matlabroot }}" "${{ matrix.host }}" "." "staging"
102+
153103
- name: Package
154104
shell: pwsh
155-
run: |
156-
Compress-Archive -Path staging\* qpalm-matlab-win64.zip
105+
run: Compress-Archive -Path staging\* qpalm-matlab-${{ matrix.name }}.zip
106+
157107
- name: Upload
158108
uses: actions/upload-artifact@v4
159109
with:
160-
name: qpalm-matlab-win64
161-
path: qpalm-matlab-win64.zip
110+
name: qpalm-matlab-${{ matrix.name }}
111+
path: qpalm-matlab-${{ matrix.name }}.zip
162112
- name: Release
163113
if: ${{ github.event.action == 'released' || github.event.action == 'prereleased' }}
164-
uses: softprops/action-gh-release@73e673b2dead314c6b971e962dd8e84e230ae99d
114+
uses: softprops/action-gh-release@17cd0d34deddf848fc0e7d9be5202c148c270a0a
165115
with:
166-
files: qpalm-matlab-win64.zip
116+
files: qpalm-matlab-${{ matrix.name }}.zip
117+
118+
- run: conan cache clean
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Setup Conan
2+
description: >
3+
Installs Python, Conan, py-build-cmake, pybind11-stubgen and sccache.
4+
It initializes the default Conan profile using conan profile detect, sets
5+
up compiler caching using sccache, configures caching of Conan dependencies,
6+
and adds Conan recipes for cross-compilation and Python development files.
7+
inputs:
8+
python-version:
9+
required: false
10+
default: '3.13'
11+
description: The Python version to use for the build, e.g. '3.13'.
12+
conan-home:
13+
required: false
14+
default: ${{ github.workspace }}/.conan2
15+
description: Selects the Conan home folder, $CONAN_HOME. Will be cached.
16+
cache-key:
17+
required: false
18+
default: generic
19+
description: String to include in cache keys, to differentiate workflows.
20+
21+
runs:
22+
using: composite
23+
steps:
24+
25+
- name: Install Python
26+
uses: actions/setup-python@v5
27+
with:
28+
python-version: ${{ inputs.python-version }}
29+
30+
- name: Build py-build-cmake (Unix)
31+
if: runner.os != 'Windows'
32+
shell: bash
33+
run: |
34+
git clone https://github.com/tttapa/py-build-cmake --branch conan
35+
pip install -U pip build
36+
python3 -m build -w py-build-cmake
37+
echo "PIP_FIND_LINKS=$PWD/py-build-cmake/dist" >> "$GITHUB_ENV"
38+
39+
- name: Build py-build-cmake (Windows)
40+
if: runner.os == 'Windows'
41+
shell: pwsh
42+
run: |
43+
git clone https://github.com/tttapa/py-build-cmake --branch conan
44+
pip install -U pip build
45+
python3 -m build -w py-build-cmake
46+
echo "PIP_FIND_LINKS=$((Resolve-Path 'py-build-cmake\dist'))" >> $env:GITHUB_ENV
47+
48+
- name: Install Python dependencies
49+
shell: bash
50+
run: >
51+
pip install -U pip build
52+
conan~=2.19.1 'py-build-cmake~=0.6.0a1' 'pybind11-stubgen~=2.5.5'
53+
54+
- name: Configure sccache version
55+
shell: bash
56+
run: echo "SCCACHE_GHA_VERSION=${{ inputs.cache-key }}" >> "$GITHUB_ENV"
57+
58+
- name: Install sccache
59+
uses: mozilla-actions/sccache-action@7d986dd989559c6ecdb630a3fd2557667be217ad
60+
61+
- name: Cache Conan dependencies
62+
uses: actions/cache@v4
63+
with:
64+
path: ${{ inputs.conan-home }}/p
65+
key: conan-${{ runner.os }}-${{ inputs.cache-key }}-${{ github.sha }}
66+
restore-keys: conan-${{ runner.os }}-${{ inputs.cache-key }}-
67+
68+
- name: Configure Conan
69+
shell: bash
70+
run: |
71+
export CONAN_HOME="${{ inputs.conan-home }}"
72+
echo "CONAN_HOME=${{ inputs.conan-home }}" >> "$GITHUB_ENV"
73+
conan profile detect -f
74+
recipes="${{ github.workspace }}/tttapa-conan-recipes"
75+
git clone https://github.com/tttapa/conan-recipes "$recipes"
76+
conan remote add tttapa-conan-recipes "$recipes" --force

0 commit comments

Comments
 (0)