Skip to content

Avoid dnf prompt.

Avoid dnf prompt. #13

# Create a Fedora 41 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: Fedora-41 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 Fedora image
run: docker pull fedora:41
- 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 in Fedora container
run: |
docker run --rm \
-v ${{ github.workspace }}:/workspace \
-w /workspace \
fedora:40 \
bash -c "
git config --global --add safe.directory /workspace
dnf install -y rpm-build make gcc-c++ git python3-devel cmake gmp-devel libuuid-devel sqlite-devel openssl-devel gtkmm30-devel boost-devel python3-matplotlib python3-pip
pip3 install sympy
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 }}-fedora41.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 Fedora image
run: docker pull fedora:41
- name: Download package and run inside Fedora container
run: |
docker run --rm \
-v ${{ github.workspace }}:/workspace \
-w /workspace \
fedora:41 \
bash -c "
dnf install -y xorg-x11-server-Xvfb wget curl jq
export VERSION=\$(curl -s https://api.github.com/repos/kpeeters/cadabra2/releases|& jq .[0].tag_name -r)
export RPMNAME=cadabra2-\${VERSION}-fedora41.rpm
wget https://github.com/kpeeters/cadabra2/releases/download/\${VERSION}/\${RPMNAME}
dnf install -y \${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
"