Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
257 changes: 137 additions & 120 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
@@ -1,80 +1,98 @@
name: CI

on:
push:
branches: [ master ]
branches: [master]
pull_request:
schedule:
- cron: '30 13 * * 5'
- cron: "30 13 * * 5"

permissions:
contents: read

concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build-linux-amd64:
runs-on: ubuntu-latest
build-linux:
strategy:
fail-fast: false
matrix:
include:
- arch: amd64
runner: ubuntu-latest
make_target: Linux_x86_64
- arch: arm64
runner: ubuntu-24.04-arm
make_target: Linux_aarch64
runs-on: ${{ matrix.runner }}
env:
IMGUR_CLIENT_ID: ${{ secrets.IMGUR_CLIENT_ID }}
timeout-minutes: 30
permissions:
contents: read
pull-requests: write
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: make
- run: make "${{ matrix.make_target }}"

- name: Package tar.xz archive
run: tar -cf - -C ${GITHUB_WORKSPACE}/linux $(ls -A ${GITHUB_WORKSPACE}"/linux") | xz -c > PathOfBuilding.linux.amd64.tar.xz
run: tar -C "${GITHUB_WORKSPACE}/linux" -cJf "PathOfBuilding.linux.${{ matrix.arch }}.tar.xz" .

- name: Cheking GUI
- name: Checking GUI
if: github.event_name == 'pull_request' && env.IMGUR_CLIENT_ID != ''
env:
IMGUR_CLIENT_ID: ${{ secrets.IMGUR_CLIENT_ID }}
GIT_TOKEN: ${{ secrets.GIT_TOKEN }}
GITHUB_TOKEN: ${{ github.token }}
DISPLAY: :10
if: github.ref != 'refs/heads/master'
run: |
pushd ${GITHUB_WORKSPACE}/linux
Xvfb :10 -screen 0 1024x768x24 &
sleep 15
./PathOfBuilding &
sleep 10
xwd -root -silent -display :10 | convert xwd:- png:/tmp/sl.png
export IMG_URL=`curl -L -X POST https://api.imgur.com/3/image -H "Authorization: Client-ID ${IMGUR_CLIENT_ID}" -F image=@/tmp/sl.png | jq '.data | .link' | tr -d '"'`
pull_number=$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH")
curl -X POST -H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token ${GIT_TOKEN}" \
https://api.github.com/repos/aspel/pobfrontend/issues/${pull_number}/comments \
-d "{\"body\":\"![Screenshot Linux](${IMG_URL})\n${GITHUB_SHA} : Linux amd64\"}"
popd
echo $IMG_URL

- run: tar -tvf PathOfBuilding.linux.amd64.tar.xz

- name: Update release tag
set -euo pipefail
pushd "${GITHUB_WORKSPACE}/linux"
Xvfb :10 -screen 0 1024x768x24 &
sleep 15
./PathOfBuilding &
sleep 10
xwd -root -silent -display :10 | convert xwd:- png:/tmp/sl.png
IMG_URL=$(curl -sS -L -X POST https://api.imgur.com/3/image \
-H "Authorization: Client-ID ${IMGUR_CLIENT_ID}" \
-F image=@/tmp/sl.png | jq -r '.data.link')
curl -sS -X POST \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: Bearer ${GITHUB_TOKEN}" \
"https://api.github.com/repos/${GITHUB_REPOSITORY}/issues/${{ github.event.pull_request.number }}/comments" \
-d "{\"body\":\"![Screenshot Linux](${IMG_URL})\n${GITHUB_SHA} : Linux ${{ matrix.arch }}\"}"
popd
echo "${IMG_URL}"

- run: tar -tvf "PathOfBuilding.linux.${{ matrix.arch }}.tar.xz"

- name: Upload Linux artifact
if: github.ref == 'refs/heads/master'
run: |
git config --local user.name "${GITHUB_ACTOR}"
git config --local user.email "aspellip@gmail.com"
git tag -f PathOfBuilding
git remote add gh https://$GITHUB_ACTOR:$GIT_TOKEN@github.com/$GITHUB_REPOSITORY.git
git push -f gh PathOfBuilding
git remote remove gh

- name: Upload Linux artifacts into Github
if: github.ref == 'refs/heads/master'
uses: ncipollo/release-action@v1
uses: actions/upload-artifact@v4
with:
artifacts: "PathOfBuilding.linux.amd64.tar.xz"
token: ${{ secrets.GITHUB_TOKEN }}
allowUpdates: true
tag: PathOfBuilding
body: "${{steps.time.outputs.time}}"

build-macos-amd64:
runs-on: macos-13
name: linux-${{ matrix.arch }}-dist
path: PathOfBuilding.linux.${{ matrix.arch }}.tar.xz
if-no-files-found: error

build-macos:
strategy:
fail-fast: false
matrix:
include:
- arch: amd64
runner: macos-15-intel
- arch: arm64
runner: macos-15
runs-on: ${{ matrix.runner }}
env:
IMGUR_CLIENT_ID: ${{ secrets.IMGUR_CLIENT_ID }}
timeout-minutes: 40
permissions:
contents: read
pull-requests: write
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
Expand All @@ -83,86 +101,85 @@ jobs:

- name: Package tar.xz archive
run: |
set -euo pipefail
rm -rf PathOfBuilding.app/Contents/MacOS/spec
codesign --force --deep --sign - PathOfBuilding.app
tar -cf - PathOfBuilding.app | xz -c > PathOfBuilding.darwin.amd64.tar.xz
tar -cJf "PathOfBuilding.darwin.${{ matrix.arch }}.tar.xz" PathOfBuilding.app

- name: Cheking GUI
- name: Checking GUI
if: github.event_name == 'pull_request' && env.IMGUR_CLIENT_ID != ''
env:
IMGUR_CLIENT_ID: ${{ secrets.IMGUR_CLIENT_ID }}
GIT_TOKEN: ${{ secrets.GIT_TOKEN }}
if: github.ref != 'refs/heads/master'
GITHUB_TOKEN: ${{ github.token }}
run: |
./PathOfBuilding.app/Contents/MacOS/pobWrapper.sh &
sleep 15
screencapture /tmp/sl.png
export IMG_URL=`curl -L -X POST https://api.imgur.com/3/image -H "Authorization: Client-ID ${IMGUR_CLIENT_ID}" -F image=@/tmp/sl.png | jq '.data | .link' | tr -d '"'`
pull_number=$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH")
curl -X POST -H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token ${GIT_TOKEN}" \
https://api.github.com/repos/aspel/pobfrontend/issues/${pull_number}/comments \
-d "{\"body\":\"![Screenshot MacOS](${IMG_URL})\n${GITHUB_SHA} : MacOS amd64\"}"
echo $IMG_URL

- run: tar -tvf PathOfBuilding.darwin.amd64.tar.xz

- name: Upload MacOS artifacts into Github
set -euo pipefail
./PathOfBuilding.app/Contents/MacOS/pobWrapper.sh &
sleep 15
screencapture /tmp/sl.png
IMG_URL=$(curl -sS -L -X POST https://api.imgur.com/3/image \
-H "Authorization: Client-ID ${IMGUR_CLIENT_ID}" \
-F image=@/tmp/sl.png | jq -r '.data.link')
curl -sS -X POST \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: Bearer ${GITHUB_TOKEN}" \
"https://api.github.com/repos/${GITHUB_REPOSITORY}/issues/${{ github.event.pull_request.number }}/comments" \
-d "{\"body\":\"![Screenshot MacOS](${IMG_URL})\n${GITHUB_SHA} : MacOS ${{ matrix.arch }}\"}"
echo "${IMG_URL}"

- run: tar -tvf "PathOfBuilding.darwin.${{ matrix.arch }}.tar.xz"

- name: Upload MacOS artifact
if: github.ref == 'refs/heads/master'
uses: ncipollo/release-action@v1
uses: actions/upload-artifact@v4
with:
artifacts: "PathOfBuilding.darwin.amd64.tar.xz"
token: ${{ secrets.GITHUB_TOKEN }}
allowUpdates: true
tag: PathOfBuilding
body: "${{steps.time.outputs.time}}"

build-macos-arm64:
runs-on: macos-latest
name: macos-${{ matrix.arch }}-dist
path: PathOfBuilding.darwin.${{ matrix.arch }}.tar.xz
if-no-files-found: error

release:
if: github.ref == 'refs/heads/master'
needs:
- build-linux
- build-macos
runs-on: ubuntu-latest
timeout-minutes: 20
permissions:
contents: write
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
echo "time=${time}" >> "$GITHUB_OUTPUT"

- uses: actions/checkout@v4

- run: brew install make

- run: make
with:
fetch-depth: 0

- name: Package tar.xz archive
run: |
rm -rf PathOfBuilding.app/Contents/MacOS/spec
codesign --force --deep --sign - PathOfBuilding.app
tar -cf - PathOfBuilding.app | xz -c > PathOfBuilding.darwin.arm64.tar.xz
- uses: actions/download-artifact@v4
with:
pattern: "*-dist"
merge-multiple: true

- name: Show release artifacts
run: ls -lh *.tar.xz

- name: Cheking GUI
- name: Update release tag
env:
IMGUR_CLIENT_ID: ${{ secrets.IMGUR_CLIENT_ID }}
GIT_TOKEN: ${{ secrets.GIT_TOKEN }}
if: github.ref != 'refs/heads/master'
GITHUB_TOKEN: ${{ github.token }}
run: |
./PathOfBuilding.app/Contents/MacOS/pobWrapper.sh &
sleep 15
screencapture /tmp/sl.png
export IMG_URL=`curl -L -X POST https://api.imgur.com/3/image -H "Authorization: Client-ID ${IMGUR_CLIENT_ID}" -F image=@/tmp/sl.png | jq '.data | .link' | tr -d '"'`
pull_number=$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH")
curl -X POST -H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token ${GIT_TOKEN}" \
https://api.github.com/repos/aspel/pobfrontend/issues/${pull_number}/comments \
-d "{\"body\":\"![Screenshot MacOS](${IMG_URL})\n${GITHUB_SHA} : MacOS arm64\"}"
echo $IMG_URL

- run: tar -tvf PathOfBuilding.darwin.arm64.tar.xz

- name: Upload MacOS artifacts into Github
if: github.ref == 'refs/heads/master'
set -euo pipefail
git config --local user.name "${GITHUB_ACTOR}"
git config --local user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git tag -f PathOfBuilding "${GITHUB_SHA}"
git push --force origin refs/tags/PathOfBuilding

- name: Upload release artifacts
uses: ncipollo/release-action@v1
with:
artifacts: "PathOfBuilding.darwin.arm64.tar.xz"
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: "*.tar.xz"
token: ${{ github.token }}
allowUpdates: true
replacesArtifacts: true
tag: PathOfBuilding
body: "${{steps.time.outputs.time}}"

body: "${{ steps.time.outputs.time }}"

9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
lcurl.so
Lua-cURLv3
PathOfBuilding
build
*.so
*.dll
*.dylib
*.exe
*.o
*.obj
*.a
*.log
25 changes: 18 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Darwin_x86_64: pob
meson setup --buildtype=release --prefix=${DIR}/PathOfBuilding.app --bindir=Contents/MacOS build
meson compile -C build
meson install -C build
/usr/local/opt/qt@5/bin/macdeployqt ${DIR}/PathOfBuilding.app -verbose=2
/usr/local/opt/qt@5/bin/macdeployqt ${DIR}/PathOfBuilding.app -verbose=2
echo "Finished $(OS_NAME)"

Linux_x86_64: pob
Expand All @@ -35,11 +35,18 @@ Linux_x86_64: pob
meson install -C build
echo "Finished $(OS_NAME)"

# ARM64 Linux runners commonly report uname -m as aarch64.
Linux_aarch64: Linux_x86_64
Linux_arm64: Linux_x86_64

pob: clear tools_$(OS_NAME) load_pob luacurl
pushd PathOfBuilding && \
unzip runtime-win32.zip lua/xml.lua lua/base64.lua lua/sha1.lua && \
mv lua/*.lua . && \
rmdir lua && \
unzip runtime-win32.zip 'lua/*' && \
cp -R lua/. . && \
rm -rf lua && \
LJ_VER=$$(luajit -e 'print(_VERSION:match("%d+%.%d+"))') && \
MOD_SO=$$(find "$${HOME}/.luarocks/lib/lua/$$LJ_VER" /usr/local/lib/lua/$$LJ_VER /opt/homebrew/lib/lua/$$LJ_VER -maxdepth 1 -type f -name 'lua-utf8.so' 2>/dev/null | head -n 1 || true) && \
if [ -n "$$MOD_SO" ]; then cp "$$MOD_SO" .; fi && \
cp ../lcurl.so . && \
mv src/* . && \
rmdir src && \
Expand All @@ -63,9 +70,13 @@ clear:
rm -rf PathOfBuilding PathOfBuilding.app Lua-cURLv3 lcurl.so build

tools_Darwin:
brew install jq qt@5 luajit zlib meson curl dylibbundler
brew install jq qt@5 luajit zlib meson curl dylibbundler luarocks
LJ_VER=$$(luajit -e 'print(_VERSION:match("%d+%.%d+"))'); \
luajit -e 'require("lua-utf8")' || luarocks --lua-version=$$LJ_VER install luautf8

tools_Linux:
sudo apt update && sudo apt -y install qtbase5-dev qt5-qmake \
qtcreator luajit libluajit-5.1-dev zlib1g zlib1g-dev meson \
xvfb build-essential ninja-build x11-apps imagemagick libcurl4-openssl-dev
luajit libluajit-5.1-dev zlib1g zlib1g-dev meson luarocks \
xvfb build-essential ninja-build x11-apps imagemagick libcurl4-openssl-dev
LJ_VER=$$(luajit -e 'print(_VERSION:match("%d+%.%d+"))'); \
luajit -e 'require("lua-utf8")' || sudo luarocks --lua-version=$$LJ_VER install luautf8
Loading
Loading