-
Notifications
You must be signed in to change notification settings - Fork 39
116 lines (96 loc) · 3.57 KB
/
opensuse-tumbleweed-package.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
# Create a OpenSUSE Tumbleweed package on a github release event.
# This assumes that the cadabra version is the same as the
# release name, and it will attempt to add the .rpm file
# to the release assets.
name: OpenSUSE-Tumbleweed package
# on: [push]
on:
release:
types: [created]
jobs:
build:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
# - name: Exit if not on devel branch
# if: github.ref != 'refs/heads/devel'
# run: exit 1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@master
- name: Pull OpenSUSE image
run: docker pull opensuse/tumbleweed:latest
- name: Set up GitHub CLI
run: |
sudo apt-get update
sudo apt-get install -y gh
- name: Authenticate GitHub CLI
run: gh auth setup-git
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Build RPM
run: |
docker run --rm \
-v ${{ github.workspace }}:/workspace \
-w /workspace \
opensuse/tumbleweed:latest \
bash -c "
zypper refresh
zypper update
zypper -n install --no-recommends rpmbuild git cmake python313-devel gcc-c++ \
gmp-devel libuuid-devel \
gtkmm3-devel sqlite3-devel \
python313-matplotlib libopenssl-devel \
libboost_system-devel libboost_filesystem-devel \
libboost_date_time-devel libboost_program_options-devel
git config --global --add safe.directory /workspace
mkdir build
cd build
cmake -DPACKAGING_MODE=ON -DENABLE_MATHEMATICA=OFF -DCMAKE_INSTALL_PREFIX=/usr ..
make
cpack
"
- name: Set version variables from output of cmake
run: |
VER=$(cat ${{ github.workspace }}/build/VERSION)
echo "VERSION=$VER" >> $GITHUB_ENV
- name: Upload Release Assets
run: |
gh release upload "${{ env.VERSION }}" build/cadabra2-${{ env.VERSION }}-tumbleweed.rpm --clobber
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
test:
needs: build
runs-on: ubuntu-22.04
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@master
- name: Pull OpenSUSE image
run: docker pull opensuse/tumbleweed:latest
- name: Download package and run inside OpenSUSE container
run: |
docker run --rm \
-v ${{ github.workspace }}:/workspace \
-w /workspace \
opensuse/tumbleweed:latest \
bash -c "
zypper refresh
zypper update
zypper -n install xvfb-run wget curl jq
export VERSION=\$(curl -s https://api.github.com/repos/kpeeters/cadabra2/releases|& jq .[0].tag_name -r)
export RPMNAME=cadabra2-\${VERSION}-tumbleweed.rpm
wget https://github.com/kpeeters/cadabra2/releases/download/\${VERSION}/\${RPMNAME}
zypper --no-gpg-checks -n install \${RPMNAME}
printf 'import sys\nprint(sys.path)\nimport cdb.main\nex:=(A+B) (C+D);\ndistribute(ex);\nquit()\n' > tst.cdb
cadabra2 tst.cdb
xvfb-run -a cadabra2-gtk &
APP_PID=\$!
sleep 10
if kill -0 \$APP_PID 2>/dev/null; then
echo 'cadabra2-gtk started successfully'
kill \$APP_PID
exit 0
else
echo 'cadabra2-gtk failed to start'
exit 1
fi
"