Skip to content

Commit c463cad

Browse files
author
Kasper Peeters
committed
Add logic to build ubuntu .deb package using github actions.
1 parent 6adf91f commit c463cad

File tree

2 files changed

+53
-0
lines changed

2 files changed

+53
-0
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Linux
2+
3+
on: [push]
4+
5+
jobs:
6+
build:
7+
8+
runs-on: ubuntu-22.04
9+
10+
steps:
11+
- uses: actions/checkout@v3
12+
13+
# - name: Exit if not on devel branch
14+
# if: github.ref != 'refs/heads/devel'
15+
# run: exit 1
16+
17+
- name: setup python
18+
uses: actions/setup-python@v4
19+
with:
20+
python-version: 3.11
21+
22+
- name: get dependencies
23+
run: sudo apt-get update && sudo DEBIAN_FRONTEND=noninteractive apt-get install git cmake python3-dev g++ libpcre3 libpcre3-dev libgmp3-dev libgtkmm-3.0-dev libboost-all-dev libgmp-dev libsqlite3-dev uuid-dev libmpfr-dev libmpc-dev && python3 --version && which python3 && python3 -m pip install --upgrade pip && python3 -m pip install wheel && python3 -m pip install sympy gmpy2 numpy
24+
25+
- name: configure
26+
run: mkdir build && cd build && cmake -DPACKAGING_MODE=ON -DENABLE_MATHEMATICA=OFF -DCMAKE_INSTALL_PREFIX=/usr ..
27+
28+
- name: make
29+
run: cd build && make
30+
31+
- name: package
32+
run: cd build && cpack
33+
34+
- name: Set version variables from output of cmake
35+
run: |
36+
VER=$(cat build/VERSION)
37+
echo "VERSION=$VER" >> $GITHUB_ENV
38+
39+
- name: Upload artifact to github assets
40+
uses: actions/upload-artifact@main
41+
with:
42+
name: cadabra2-${VERSION}-jammy.deb
43+
path: build/cadabra2-${VERSION}-jammy.deb
44+

CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,15 @@ message(STATUS "Build id '${CADABRA_VERSION_BUILD}' dated ${CADABRA_VERSION_DATE
7474
message(STATUS "Build mode is set to '${CMAKE_BUILD_TYPE}'")
7575
message(STATUS "Architecture is '${CMAKE_SYSTEM_PROCESSOR}}'")
7676

77+
# Store the version number in a build/VERSION file (so that e.g. github
78+
# actions can pick it up).
79+
if(NOT "${CADABRA_VERSION_TWEAK}" STREQUAL "0")
80+
file(WRITE build/VERSION "${CADABRA_VERSION_MAJOR}.${CADABRA_VERSION_MINOR}.${CADABRA_VERSION_PATCH}.${CADABRA_VERSION_TWEAK}")
81+
else()
82+
file(WRITE build/VERSION "${CADABRA_VERSION_MAJOR}.${CADABRA_VERSION_MINOR}.${CADABRA_VERSION_PATCH}")
83+
endif()
84+
85+
7786
# Notify about install directory
7887
if ("${CMAKE_INSTALL_PREFIX}" STREQUAL "")
7988
message(STATUS "Install directory not set")

0 commit comments

Comments
 (0)