Skip to content

Another attempt to get brew logs. #39

Another attempt to get brew logs.

Another attempt to get brew logs. #39

# This is a build which gets triggered on every push to the
# 'devel' branch, to update the homebrew-repo the cadabra2-devel
# package.
name: Homebrew-devel
on:
push:
branches:
- devel
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Cadabra
uses: actions/checkout@v4
with:
ref: 'devel'
- name: Checkout Homebrew repo
uses: actions/checkout@v4
with:
repository: kpeeters/homebrew-repo
path: homebrew-repo
token: ${{ secrets.ACTIONS_HOMEBREW_REPO_TOKEN }}
- 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: Get dependencies
run: sudo apt-get update && sudo DEBIAN_FRONTEND=noninteractive apt-get install git cmake jq 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
- name: Configure
run: mkdir build && cd build && cmake -DPACKAGING_MODE=ON -DENABLE_MATHEMATICA=OFF -DCMAKE_INSTALL_PREFIX=/usr ..
- name: Set variables
run: |
export VERSION=$(cat build/VERSION)
export COMMIT=$(curl -s https://api.github.com/repos/kpeeters/cadabra2/commits/devel | jq -r .sha)
wget https://github.com/kpeeters/cadabra2/archive/${COMMIT}.tar.gz
export SHA=`cat ${COMMIT}.tar.gz | sha256sum -b | cut -d " " -f 1`
echo "SHA=${SHA}" >> $GITHUB_ENV
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "COMMIT=$COMMIT" >> $GITHUB_ENV
- name: Update Homebrew repo
run: |
cd homebrew-repo
cat cadabra2-devel.rb | sed -e 's/^ url .*/ url "https:\/\/github.com\/kpeeters\/cadabra2\/archive\/${{ env.COMMIT }}.tar.gz"/' | sed -e 's/^ sha256.*/ sha256 "${{ env.SHA }}"/' | sed -e 's/^ version.*/ version "${{ env.VERSION }}.${{ env.COMMIT }}"/' > out.rb
mv out.rb cadabra2-devel.rb
cat cadabra2-devel.rb
git config user.name "Kasper Peeters"
git config user.email "[email protected]"
git add cadabra2-devel.rb
git commit -a -m "Update to release ${{ env.VERSION }} commit ${{ env.COMMIT }}."
git push
test:
needs: build
runs-on: macos-latest
steps:
- name: get dependencies
run: brew tap kpeeters/repo && brew install --verbose cadabra2-devel
- name: show where cadabra is located
run: cat `which cadabra2`
- name: test simple cli run
run: printf "import sys\nprint(sys.path)\nimport cdb.main\nex:=(A+B) (C+D);\ndistribute(ex);\nquit()\n" > tst.cdb && cadabra2 tst.cdb
- name: test gtk app launch
run: |
cadabra2-gtk &
APP_PID=$!
sleep 10
if kill -0 $APP_PID 2>/dev/null; then
echo "Application started successfully"
kill $APP_PID
exit 0
else
echo "Application failed to start"
exit 1
fi
- name: Upload build logs
if: always()
uses: actions/upload-artifact@v4
with:
name: brew-build-logs
path: |
~/Library/Logs/Homebrew/
retention-days: 2