Skip to content

Commit

Permalink
ci: fix darwin
Browse files Browse the repository at this point in the history
Signed-off-by: aspel <[email protected]>
  • Loading branch information
aspel committed Nov 17, 2023
1 parent a82f055 commit db0ad0d
Show file tree
Hide file tree
Showing 8 changed files with 150 additions and 188 deletions.
43 changes: 19 additions & 24 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,26 @@ on:
schedule:
- cron: '30 13 * * 5'
jobs:
build-linux:
runs-on: ubuntu-latest
build-linux-amd64:
runs-on: ubuntu-22.04
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- id: time
run: |
time=nightly-$(date +'%Y/%m/%d')
echo "time=${time}" >> $GITHUB_OUTPUT
- uses: actions/checkout@v4
- run: sudo apt-get install xvfb build-essential ninja-build x11-apps imagemagick libcurl4-openssl-dev
- run: make -f Makefile.linux clean
- run: make -f Makefile.linux tools
- run: make -f Makefile.linux
- run: make
- name: Package tar.xz archive
run: tar -cf - -C ${GITHUB_WORKSPACE}/PathOfBuilding/src $(ls -A ${GITHUB_WORKSPACE}"/PathOfBuilding/src") | xz -c > PathOfBuilding.linux.tar.xz
run: tar -cf - -C ${GITHUB_WORKSPACE}/PathOfBuilding $(ls -A ${GITHUB_WORKSPACE}"/PathOfBuilding") | xz -c > PathOfBuilding.linux.amd64.tar.xz
- name: Cheking GUI
env:
IMGUR_CLIENT_ID: ${{ secrets.IMGUR_CLIENT_ID }}
GIT_TOKEN: ${{ secrets.GIT_TOKEN }}
DISPLAY: :10
if: github.ref != 'refs/heads/master'
run: |
pushd ${GITHUB_WORKSPACE}/PathOfBuilding/src
pushd ${GITHUB_WORKSPACE}/PathOfBuilding
Xvfb :10 -screen 0 1024x768x24 &
sleep 10
./PathOfBuilding &
Expand All @@ -41,45 +39,43 @@ jobs:
-d "{\"body\":\"![Screenshot Linux](${IMG_URL})\n${GITHUB_SHA} : Linux\"}"
popd
echo $IMG_URL
if: github.ref != 'refs/heads/master'
- run: tar -tvf PathOfBuilding.linux.tar.xz
- run: tar -tvf PathOfBuilding.linux.amd64.tar.xz
- name: Update release tag
if: github.ref == 'refs/heads/master'
run: |
git config --local user.name "${GITHUB_ACTOR}"
git config --local user.email "[email protected]"
git tag -f PathOfBuilding
git remote add gh https://$GITHUB_ACTOR:[email protected]/$GITHUB_REPOSITORY.git
git push -f gh PathOfBuilding
git remote remove gh
if: github.ref == 'refs/heads/master'
- name: Upload Linux artifacts into Github
if: github.ref == 'refs/heads/master'
uses: ncipollo/release-action@v1
with:
artifacts: "PathOfBuilding.linux.tar.xz"
artifacts: "PathOfBuilding.linux.amd64.tar.xz"
token: ${{ secrets.GITHUB_TOKEN }}
allowUpdates: true
tag: PathOfBuilding
body: "${{steps.time.outputs.time}}"
if: github.ref == 'refs/heads/master'
build-macos:
runs-on: macos-latest
build-macos-amd64:
runs-on: macos-13
steps:
- id: time
run: |
time=nightly-$(date +'%Y/%m/%d')
echo "time=${time}" >> $GITHUB_OUTPUT
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
- run: brew install make ninja
- run: make -f Makefile.darwin clean
- run: make -f Makefile.darwin tools
- run: make -f Makefile.darwin
- run: brew install make
- run: make
- name: Package tar.xz archive
run: tar -cf - PathOfBuilding.app | xz -c > PathOfBuilding.darwin.tar.xz
run: tar -cf - PathOfBuilding.app | xz -c > PathOfBuilding.darwin.amd64.tar.xz
- name: Cheking GUI
env:
IMGUR_CLIENT_ID: ${{ secrets.IMGUR_CLIENT_ID }}
GIT_TOKEN: ${{ secrets.GIT_TOKEN }}
if: github.ref != 'refs/heads/master'
run: |
./PathOfBuilding.app/Contents/MacOS/pobWrapper.sh &
sleep 10
Expand All @@ -91,15 +87,14 @@ jobs:
https://api.github.com/repos/aspel/pobfrontend/issues/${pull_number}/comments \
-d "{\"body\":\"![Screenshot MacOS](${IMG_URL})\n${GITHUB_SHA} : MacOS\"}"
echo $IMG_URL
if: github.ref != 'refs/heads/master'
- run: tar -tvf PathOfBuilding.darwin.tar.xz
- run: tar -tvf PathOfBuilding.darwin.amd64.tar.xz
- name: Upload MacOS artifacts into Github
if: github.ref == 'refs/heads/master'
uses: ncipollo/release-action@v1
with:
artifacts: "PathOfBuilding.darwin.tar.xz"
artifacts: "PathOfBuilding.darwin.amd64.tar.xz"
token: ${{ secrets.GITHUB_TOKEN }}
allowUpdates: true
tag: PathOfBuilding
body: "${{steps.time.outputs.time}}"
if: github.ref == 'refs/heads/master'

65 changes: 65 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
DIR := ${CURDIR}

SHELL = /bin/bash
OS_NAME := $(shell uname -s)

# Build based on OS name
DetectOS:
-@make $(OS_NAME)

Darwin: pob
rm -rf PathOfBuilding PathOfBuilding.app Lua-cURLv3 lcurl.so build
brew install jq qt5 luajit zlib meson curl dylibbundler
PATH=/usr/local/opt/qt@5/bin:$(PATH) \
LDFLAGS=-L/usr/local/opt/qt@5/lib \
CPPFLAGS=-I/usr/local/opt/qt@5/include \
PKG_CONFIG_PATH=/usr/local/opt/qt@5/lib/pkgconfig \
meson setup --buildtype=release --prefix=${DIR}/PathOfBuilding.app --bindir=Contents/MacOS build
meson compile -C build
meson install -C build
macdeployqt ${DIR}/PathOfBuilding.app
cp ${DIR}/Info.plist.sh ${DIR}/PathOfBuilding.app/Contents/Info.plist
echo "Finished $(OS_NAME}"

Linux: pob
rm -rf PathOfBuilding Lua-cURLv3 lcurl.so build
sudo apt -y install qtbase5-dev qt5-qmake \
qtcreator luajit libluajit-5.1-dev zlib1g zlib1g-dev meson ninja \
xvfb build-essential ninja-build x11-apps imagemagick libcurl4-openssl-dev
meson setup --buildtype=release build
meson compile -C build
mv build/PathOfBuilding PathOfBuilding/
echo "Finished $(OS_NAME)"

pob: load_pob luacurl_$(OS_NAME)
pushd PathOfBuilding
unzip runtime-win32.zip lua/xml.lua lua/base64.lua lua/sha1.lua
mv lua/*.lua .
rmdir lua
cp ../lcurl.so .
mv src/* .
rmdir src
popd

load_pob:
git clone --branch dev --single-branch --depth 1 https://github.com/PathOfBuildingCommunity/PathOfBuilding.git
pushd PathOfBuilding
rm -rf .git
popd

luacurl_Darwin:
git clone --branch v0.3.13 --single-branch --depth 1 https://github.com/Lua-cURL/Lua-cURLv3.git
pushd Lua-cURLv3
sed -i 's/\?= lua$$/\?= luajit/' Makefile
sed -i 's@shell .* --libs libcurl@shell PKG_CONFIG_PATH=\$$\$$(brew --prefix --installed curl)/lib/pkgconfig \$$(PKG_CONFIG) --libs libcurl@' Makefile
make
mv lcurl.so ../lcurl.so
popd

luacurl_Linux:
git clone --branch v0.3.13 --single-branch --depth 1 https://github.com/Lua-cURL/Lua-cURLv3.git
pushd Lua-cURLv3
sed -i 's/\?= lua$$/\?= luajit/' Makefile
make
mv lcurl.so ../lcurl.so
popd
60 changes: 0 additions & 60 deletions Makefile.darwin

This file was deleted.

54 changes: 0 additions & 54 deletions Makefile.linux

This file was deleted.

1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,4 @@ On mac you need to invoke meson with some extra flags, per the luajit documentat
```bash
LDFLAGS="-pagezero_size 10000 -image_base 100000000" meson pobfrontend build
```

Loading

0 comments on commit db0ad0d

Please sign in to comment.