leocad/.github/workflows/continuous.yml

116 lines
4.4 KiB
YAML
Raw Normal View History

2022-10-02 20:33:06 +02:00
name: LeoCAD CI
2022-09-26 03:16:10 +02:00
on:
push:
branches: [ "master" ]
jobs:
2022-10-02 20:05:50 +02:00
build-ubuntu:
2022-09-26 03:16:10 +02:00
runs-on: ubuntu-latest
2022-10-02 20:05:50 +02:00
steps:
- uses: actions/checkout@v3
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
cache: 'true'
- name: Get number of CPU cores
uses: SimenB/github-actions-cpu-cores@v1
id: cpu-cores
- name: Generate Makefile
run: qmake PREFIX=/usr
- name: Build
run: make -j ${{ steps.cpu-cores.outputs.count }}
2022-10-02 20:22:21 +02:00
- name: Install
run: make install INSTALL_ROOT=AppDir
- name: Cache Library
uses: actions/cache@v3
id: cache-library
with:
path: AppDir/usr/share/leocad/library.bin
key: library-20.03
- name: Download Library
if: steps.cache-library.outputs.cache-hit != 'true'
run: |
wget https://github.com/leozide/leocad/releases/download/v19.07.1/Library-20.03.zip -O library.zip
unzip library.zip
mkdir -p AppDir/usr/share/leocad
mv library.bin AppDir/usr/share/leocad/library.bin
- name: Create AppImage
run: |
2022-10-02 21:14:49 +02:00
echo start
2022-10-02 20:22:21 +02:00
cp qt/leocad.desktop AppDir/leocad.desktop
cp tools/icon/256x256/apps/leocad.png AppDir/leocad.png
2022-10-02 21:08:52 +02:00
wget -q -c "https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage"
2022-10-02 20:22:21 +02:00
chmod a+x linuxdeployqt*.AppImage
unset QTDIR; unset QT_PLUGIN_PATH ; unset LD_LIBRARY_PATH
export VERSION=$(git rev-parse --short HEAD)
2022-10-02 20:33:06 +02:00
./linuxdeployqt*.AppImage ./AppDir/usr/share/applications/*.desktop -bundle-non-qt-libs -unsupported-allow-new-glibc
2022-10-02 21:08:52 +02:00
echo done1
2022-10-02 20:22:21 +02:00
./linuxdeployqt*.AppImage --appimage-extract
2022-10-02 21:08:52 +02:00
echo done2
2022-10-02 20:22:21 +02:00
export PATH=$(readlink -f ./squashfs-root/usr/bin/):$PATH
./squashfs-root/usr/bin/appimagetool AppDir/
mv ./LeoCAD-$VERSION-x86_64.AppImage ./LeoCAD-Linux-$VERSION-x86_64.AppImage
- name: Upload AppImage
run: |
2022-10-02 20:52:38 +02:00
'curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/leozide/leocad/commits/master -o repo.txt'
2022-10-02 20:22:21 +02:00
'export REMOTE=$(grep -Po ''(?<=: \")(([a-z0-9])\w+)(?=\")'' -m 1 repo.txt)'
export LOCAL=$(git rev-parse HEAD)
if [[ "$REMOTE" != "$LOCAL" ]]; then echo "Build no longer current. $REMOTE vs $LOCAL - aborting upload."; exit 0; fi;
wget -c https://github.com/probonopd/uploadtool/raw/master/upload.sh
bash upload.sh LeoCAD*.AppImage*
2022-09-26 03:16:10 +02:00
2022-10-02 20:05:50 +02:00
build-macos:
runs-on: macos-latest
2022-09-26 03:16:10 +02:00
steps:
- uses: actions/checkout@v3
2022-09-26 03:18:34 +02:00
- name: Install Qt
2022-09-26 03:23:12 +02:00
uses: jurplel/install-qt-action@v3
with:
2022-09-26 03:23:25 +02:00
cache: 'true'
2022-10-02 20:05:50 +02:00
- name: Get number of CPU cores
uses: SimenB/github-actions-cpu-cores@v1
id: cpu-cores
- name: Generate Makefile
2022-09-26 03:16:10 +02:00
run: qmake PREFIX=/usr
2022-10-02 20:22:21 +02:00
- name: Cache Library
uses: actions/cache@v3
id: cache-library
with:
path: library.bin
key: library-20.03
- name: Download Library
if: steps.cache-library.outputs.cache-hit != 'true'
run: |
wget https://github.com/leozide/leocad/releases/download/v19.07.1/Library-20.03.zip -O library.zip
unzip library.zip
- name: Cache POV-Ray
uses: actions/cache@v3
id: cache-povray
with:
path: povray
key: povray-20.03
- name: Download POV-Ray
if: steps.cache-povray.outputs.cache-hit != 'true'
run: |
wget https://github.com/leozide/povray/releases/download/continuous/povray
chmod +x povray
2022-10-02 20:05:50 +02:00
- name: Build
run: make -j ${{ steps.cpu-cores.outputs.count }}
2022-10-02 20:33:06 +02:00
- name: Create Package
run: |
cd build/release
macdeployqt LeoCAD.app -dmg
mv LeoCAD.dmg LeoCAD-macOS-$(git rev-parse --short HEAD).dmg
- name: Upload Package
2022-10-02 20:33:56 +02:00
run: |
2022-10-02 21:08:52 +02:00
curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/leozide/leocad/commits/master -o repo.txt
2022-10-02 21:14:49 +02:00
export REMOTE=$(ggrep -Po '(?<=: \")(([a-z0-9])\w+)(?=\")' -m 1 repo.txt)
2022-10-02 20:33:06 +02:00
export LOCAL=$(git rev-parse HEAD)
if [[ "$REMOTE" != "$LOCAL" ]]; then echo "Build no longer current. $REMOTE vs $LOCAL - aborting upload."; exit 0; fi;
2022-10-02 20:52:38 +02:00
export TRAVIS_TAG=$GITHUB_REF_NAME
export TRAVIS_REPO_SLUG=$GITHUB_REPOSITORY
export TRAVIS_COMMIT=$GITHUB_SHA
2022-10-02 20:33:06 +02:00
wget -c https://github.com/probonopd/uploadtool/raw/master/upload.sh
bash upload.sh LeoCAD*.dmg*