2020-12-11 14:24:42 +01:00
|
|
|
name: Build
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
2022-06-19 15:16:03 +02:00
|
|
|
branches: ["*"]
|
2020-12-11 14:24:42 +01:00
|
|
|
pull_request:
|
2022-06-23 23:48:02 +02:00
|
|
|
workflow_dispatch:
|
2020-12-11 14:24:42 +01:00
|
|
|
|
|
|
|
env:
|
|
|
|
BUILD_TYPE: Release
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
|
2022-01-15 00:14:12 +01:00
|
|
|
# Windows build
|
2021-01-10 14:22:34 +01:00
|
|
|
win:
|
2022-01-22 22:15:15 +01:00
|
|
|
runs-on: windows-2022
|
2022-03-27 00:01:28 +01:00
|
|
|
name: 🪟 Windows MINGW64
|
2020-12-11 14:24:42 +01:00
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
shell: msys2 {0}
|
2021-09-19 21:49:09 +02:00
|
|
|
env:
|
|
|
|
CCACHE_DIR: "${{ github.workspace }}/.ccache"
|
|
|
|
CCACHE_MAXSIZE: "1000M"
|
|
|
|
CCACHE_COMPRESS: "true"
|
2020-12-11 14:24:42 +01:00
|
|
|
steps:
|
|
|
|
- name: 🧰 Checkout
|
2022-06-23 23:48:02 +02:00
|
|
|
uses: actions/checkout@v3
|
2020-12-11 14:24:42 +01:00
|
|
|
with:
|
2021-02-24 21:04:00 +01:00
|
|
|
submodules: recursive
|
2021-12-01 20:31:17 +01:00
|
|
|
|
2022-06-29 00:24:53 +02:00
|
|
|
- name: 📜 Prepare Cache
|
|
|
|
id: prep-ccache
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
mkdir -p "${CCACHE_DIR}"
|
|
|
|
echo "::set-output name=dir::$CCACHE_DIR"
|
|
|
|
|
|
|
|
- name: 📜 Restore ccache
|
|
|
|
uses: actions/cache@v3
|
|
|
|
id: cache-ccache
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
${{ steps.prep-ccache.outputs.dir }}
|
|
|
|
key: ${{ runner.os }}-${{ secrets.CACHE_VERSION }}-build-${{ github.run_id }}
|
|
|
|
restore-keys: ${{ runner.os }}-${{ secrets.CACHE_VERSION }}-build
|
|
|
|
|
|
|
|
- name: 📜 Restore CMakeCache
|
|
|
|
uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
build/CMakeCache.txt
|
|
|
|
key: ${{ runner.os }}-${{ secrets.CACHE_VERSION }}-build-${{ hashFiles('**/CMakeLists.txt') }}
|
|
|
|
|
2021-02-28 16:05:05 +01:00
|
|
|
- name: 🟦 Install msys2
|
2020-12-11 14:24:42 +01:00
|
|
|
uses: msys2/setup-msys2@v2
|
2021-12-01 20:31:17 +01:00
|
|
|
with:
|
|
|
|
msystem: mingw64
|
|
|
|
pacboy: >-
|
|
|
|
gcc:p
|
2022-01-13 21:31:01 +01:00
|
|
|
lld:p
|
2021-12-01 20:31:17 +01:00
|
|
|
cmake:p
|
|
|
|
make:p
|
|
|
|
ccache:p
|
|
|
|
glfw:p
|
|
|
|
file:p
|
|
|
|
mbedtls:p
|
|
|
|
python:p
|
|
|
|
freetype:p
|
|
|
|
dlfcn:p
|
2021-09-19 21:49:09 +02:00
|
|
|
|
2021-02-28 16:05:05 +01:00
|
|
|
- name: ⬇️ Install dependencies
|
2021-02-28 15:34:44 +01:00
|
|
|
run: |
|
2021-10-16 11:37:29 +02:00
|
|
|
curl --proto '=https' --tlsv1.2 -sSf https://win.rustup.rs > rustup-init.exe
|
|
|
|
./rustup-init.exe -y --default-host=x86_64-pc-windows-gnu --default-toolchain=none
|
|
|
|
rm rustup-init.exe
|
|
|
|
$USERPROFILE/.cargo/bin/rustup.exe target add x86_64-pc-windows-gnu
|
|
|
|
$USERPROFILE/.cargo/bin/rustup.exe default nightly
|
2021-09-19 21:49:09 +02:00
|
|
|
|
2021-09-11 18:58:53 +02:00
|
|
|
- name: 🛠️ Build
|
2020-12-11 14:24:42 +01:00
|
|
|
run: |
|
2021-09-19 21:49:09 +02:00
|
|
|
mkdir -p build
|
2020-12-11 14:24:42 +01:00
|
|
|
cd build
|
2021-01-10 14:22:34 +01:00
|
|
|
# Get path to mingw python library
|
2021-06-07 22:42:56 +02:00
|
|
|
PYTHON_LIB_NAME=$(pkg-config --libs-only-l python3 | sed 's/^-l//' | sed 's/ //')
|
2021-01-10 14:22:34 +01:00
|
|
|
PYTHON_LIB_PATH=$(cygpath -m $(which lib${PYTHON_LIB_NAME}.dll))
|
|
|
|
|
2022-01-13 21:31:01 +01:00
|
|
|
cmake -G "MinGW Makefiles" \
|
|
|
|
-DCMAKE_BUILD_TYPE=$BUILD_TYPE \
|
|
|
|
-DCMAKE_INSTALL_PREFIX="$PWD/install" \
|
|
|
|
-DCREATE_PACKAGE=ON \
|
|
|
|
-DPython_LIBRARY="$PYTHON_LIB_PATH" \
|
|
|
|
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
|
|
|
|
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
|
|
|
|
-DCMAKE_C_FLAGS="-fuse-ld=lld" \
|
|
|
|
-DCMAKE_CXX_FLAGS="-fuse-ld=lld" \
|
2022-06-27 00:20:32 +02:00
|
|
|
-DCMAKE_OBJC_COMPILER_LAUNCHER=ccache \
|
|
|
|
-DCMAKE_OBJCXX_COMPILER_LAUNCHER=ccache \
|
2022-01-13 21:31:01 +01:00
|
|
|
-DRUST_PATH="$USERPROFILE/.cargo/bin/" \
|
2021-01-10 14:22:34 +01:00
|
|
|
..
|
2021-09-19 21:49:09 +02:00
|
|
|
mingw32-make -j4 install
|
2021-01-10 14:22:34 +01:00
|
|
|
cpack
|
2021-10-16 11:37:29 +02:00
|
|
|
|
2021-09-11 18:58:53 +02:00
|
|
|
- name: ⬆️ Upload Portable ZIP
|
2022-06-23 23:48:02 +02:00
|
|
|
uses: actions/upload-artifact@v3
|
2021-01-10 14:22:34 +01:00
|
|
|
with:
|
|
|
|
name: Windows Portable ZIP
|
|
|
|
path: |
|
|
|
|
build/install/*
|
|
|
|
|
2021-09-11 18:58:53 +02:00
|
|
|
- name: ⬆️ Upload Windows Installer
|
2022-06-23 23:48:02 +02:00
|
|
|
uses: actions/upload-artifact@v3
|
2021-01-08 16:25:12 +01:00
|
|
|
with:
|
2021-01-10 14:22:34 +01:00
|
|
|
name: Windows Installer
|
2021-01-08 16:25:12 +01:00
|
|
|
path: |
|
2021-01-10 14:22:34 +01:00
|
|
|
build/*.msi
|
2020-12-11 14:24:42 +01:00
|
|
|
|
2022-01-15 00:14:12 +01:00
|
|
|
# MacOS build
|
2021-08-24 15:56:49 +02:00
|
|
|
macos:
|
2022-06-25 12:19:59 +02:00
|
|
|
runs-on: macos-12
|
|
|
|
name: 🍎 macOS 12.0
|
2021-01-25 15:09:30 +01:00
|
|
|
steps:
|
|
|
|
|
|
|
|
- name: 🧰 Checkout
|
2022-06-23 23:48:02 +02:00
|
|
|
uses: actions/checkout@v3
|
2021-01-25 15:09:30 +01:00
|
|
|
with:
|
2021-02-24 21:04:00 +01:00
|
|
|
submodules: recursive
|
2022-06-29 00:24:53 +02:00
|
|
|
|
|
|
|
- name: 📜 Restore ccache
|
|
|
|
uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/Library/Caches/ccache
|
|
|
|
key: ${{ runner.os }}-${{ secrets.CACHE_VERSION }}-build-${{ github.run_id }}
|
|
|
|
restore-keys: ${{ runner.os }}-${{ secrets.CACHE_VERSION }}-build
|
|
|
|
|
|
|
|
|
|
|
|
- name: 📜 Restore CMakeCache
|
|
|
|
uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
build/CMakeCache.txt
|
|
|
|
key: ${{ runner.os }}-${{ secrets.CACHE_VERSION }}-build-${{ hashFiles('**/CMakeLists.txt') }}
|
2021-01-25 15:09:30 +01:00
|
|
|
|
|
|
|
- name: ⬇️ Install dependencies
|
|
|
|
run: |
|
|
|
|
brew bundle --no-lock --file dist/Brewfile
|
|
|
|
|
2021-09-11 18:58:53 +02:00
|
|
|
- name: 🛠️ Build
|
2021-01-25 15:09:30 +01:00
|
|
|
run: |
|
2021-09-19 21:49:09 +02:00
|
|
|
mkdir -p build
|
2021-01-25 15:09:30 +01:00
|
|
|
cd build
|
2022-06-25 12:19:59 +02:00
|
|
|
CC=$(brew --prefix gcc@12)/bin/gcc-12 \
|
|
|
|
CXX=$(brew --prefix gcc@12)/bin/g++-12 \
|
|
|
|
OBJC=$(brew --prefix llvm)/bin/clang \
|
|
|
|
OBJCXX=$(brew --prefix llvm)/bin/clang++ \
|
2021-02-02 23:11:23 +01:00
|
|
|
PKG_CONFIG_PATH="$(brew --prefix openssl)/lib/pkgconfig":"$(brew --prefix)/lib/pkgconfig" \
|
2022-06-25 12:19:59 +02:00
|
|
|
MACOSX_DEPLOYMENT_TARGET="10.15" \
|
|
|
|
cmake \
|
|
|
|
-DCMAKE_BUILD_TYPE=$BUILD_TYPE \
|
|
|
|
-DCREATE_BUNDLE=ON \
|
|
|
|
-DCREATE_PACKAGE=ON \
|
|
|
|
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
|
|
|
|
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
|
|
|
|
-DCMAKE_OBJC_COMPILER_LAUNCHER=ccache \
|
|
|
|
-DCMAKE_OBJCXX_COMPILER_LAUNCHER=ccache \
|
2021-02-02 23:11:23 +01:00
|
|
|
..
|
2021-09-19 21:49:09 +02:00
|
|
|
make -j4 package
|
2021-01-25 15:09:30 +01:00
|
|
|
|
2021-09-11 18:58:53 +02:00
|
|
|
- name: ⬆️ Upload DMG
|
2022-06-23 23:48:02 +02:00
|
|
|
uses: actions/upload-artifact@v3
|
2021-01-25 15:09:30 +01:00
|
|
|
with:
|
|
|
|
name: macOS DMG
|
|
|
|
path: build/*.dmg
|
2022-01-15 00:14:12 +01:00
|
|
|
|
|
|
|
# Linux build
|
|
|
|
linux:
|
2022-06-23 23:48:02 +02:00
|
|
|
runs-on: ubuntu-22.04
|
|
|
|
name: 🐧 Ubuntu 22.04
|
2022-01-15 00:14:12 +01:00
|
|
|
steps:
|
|
|
|
|
|
|
|
- name: 🧰 Checkout
|
2022-06-23 23:48:02 +02:00
|
|
|
uses: actions/checkout@v3
|
2022-01-15 00:14:12 +01:00
|
|
|
with:
|
|
|
|
submodules: recursive
|
|
|
|
|
|
|
|
- name: 📜 Restore cache
|
2022-06-23 23:48:02 +02:00
|
|
|
uses: actions/cache@v3
|
2022-01-15 00:14:12 +01:00
|
|
|
with:
|
|
|
|
path: |
|
2022-06-27 00:20:32 +02:00
|
|
|
~/.cache/ccache
|
2022-06-29 00:24:53 +02:00
|
|
|
key: ${{ runner.os }}-${{ secrets.CACHE_VERSION }}-build-${{ github.run_id }}
|
|
|
|
restore-keys: ${{ runner.os }}-${{ secrets.CACHE_VERSION }}-build
|
|
|
|
|
|
|
|
- name: 📜 Restore other caches
|
|
|
|
uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
build/CMakeCache.txt
|
2022-01-15 00:14:12 +01:00
|
|
|
.flatpak-builder
|
|
|
|
key: ${{ runner.os }}-${{ secrets.CACHE_VERSION }}-build-${{ hashFiles('**/CMakeLists.txt') }}
|
2022-06-27 00:20:32 +02:00
|
|
|
|
2022-01-15 00:14:12 +01:00
|
|
|
- name: ⬇️ Install dependencies
|
|
|
|
run: |
|
|
|
|
sudo rm -rf /usr/share/dotnet
|
|
|
|
sudo rm -rf /opt/ghc
|
|
|
|
sudo rm -rf "/usr/local/share/boost"
|
|
|
|
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
|
2022-01-22 22:10:49 +01:00
|
|
|
|
2022-01-15 00:14:12 +01:00
|
|
|
sudo apt update
|
|
|
|
sudo bash dist/get_deps_debian.sh
|
2022-03-20 23:43:55 +01:00
|
|
|
|
|
|
|
sudo apt install -y python3-pip python3-setuptools patchelf desktop-file-utils libgdk-pixbuf2.0-dev fakeroot strace fuse
|
|
|
|
sudo wget https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage -O /usr/local/bin/appimagetool
|
|
|
|
sudo chmod +x /usr/local/bin/appimagetool
|
2022-05-22 23:23:54 +02:00
|
|
|
sudo pip3 install appimage-builder==1.0.0
|
2022-01-22 22:10:49 +01:00
|
|
|
|
2022-01-15 00:14:12 +01:00
|
|
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > rustup-init.sh
|
|
|
|
sh rustup-init.sh -y --default-toolchain none
|
|
|
|
rm rustup-init.sh
|
|
|
|
$HOME/.cargo/bin/rustup install nightly
|
|
|
|
$HOME/.cargo/bin/rustup target add x86_64-unknown-linux-gnu
|
|
|
|
$HOME/.cargo/bin/rustup default nightly
|
|
|
|
|
|
|
|
- name: 🛠️ Build
|
|
|
|
run: |
|
|
|
|
mkdir -p build
|
|
|
|
cd build
|
2022-06-25 12:19:59 +02:00
|
|
|
CC=gcc-12 CXX=g++-12 cmake \
|
2022-01-22 22:10:49 +01:00
|
|
|
-DCMAKE_BUILD_TYPE=$BUILD_TYPE \
|
2022-03-20 23:43:55 +01:00
|
|
|
-DCMAKE_INSTALL_PREFIX="/usr" \
|
2022-01-22 22:10:49 +01:00
|
|
|
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
|
|
|
|
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
|
|
|
|
-DCMAKE_C_FLAGS="-fuse-ld=lld" \
|
|
|
|
-DCMAKE_CXX_FLAGS="-fuse-ld=lld" \
|
2022-06-27 00:20:32 +02:00
|
|
|
-DCMAKE_OBJC_COMPILER_LAUNCHER=ccache \
|
|
|
|
-DCMAKE_OBJCXX_COMPILER_LAUNCHER=ccache \
|
2022-01-22 22:10:49 +01:00
|
|
|
-DRUST_PATH="$HOME/.cargo/bin/" \
|
2022-01-15 00:14:12 +01:00
|
|
|
..
|
2022-03-20 23:43:55 +01:00
|
|
|
make -j 4 install DESTDIR=AppDir
|
2022-01-15 00:14:12 +01:00
|
|
|
|
2022-02-06 00:19:39 +01:00
|
|
|
#- name: 📦 Bundle Flatpak
|
|
|
|
# run: |
|
|
|
|
# sudo apt install flatpak flatpak-builder
|
|
|
|
# flatpak --user remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
|
|
|
|
# flatpak --user install -y flathub org.freedesktop.Platform//20.08
|
|
|
|
# flatpak --user install -y flathub org.freedesktop.Sdk//20.08
|
|
|
|
# flatpak-builder --jobs=4 --repo=imhex _flatpak dist/net.werwolv.ImHex.yaml --ccache --keep-build-dirs
|
|
|
|
# flatpak build-bundle imhex imhex.flatpak net.werwolv.ImHex stable
|
2022-01-15 00:14:12 +01:00
|
|
|
|
2022-03-20 23:43:55 +01:00
|
|
|
- name: 📦 Bundle DEB
|
|
|
|
run: |
|
|
|
|
cp -r build/DEBIAN build/AppDir
|
|
|
|
dpkg-deb --build build/AppDir
|
|
|
|
mv build/AppDir.deb imhex.deb
|
|
|
|
rm -rf build/AppDir/DEBIAN
|
2022-01-15 00:14:12 +01:00
|
|
|
|
2022-03-20 23:43:55 +01:00
|
|
|
- name: 📦 Bundle AppImage
|
|
|
|
run: |
|
|
|
|
cd build
|
|
|
|
appimage-builder --recipe ../dist/AppImageBuilder.yml
|
|
|
|
mv ImHex-AppImage-x86_64.AppImage ../imhex.AppImage
|
|
|
|
cd ..
|
|
|
|
|
|
|
|
#- name: ⬆️ Upload Flatpak
|
2022-06-23 23:48:02 +02:00
|
|
|
# uses: actions/upload-artifact@v3
|
2022-03-20 23:43:55 +01:00
|
|
|
# with:
|
|
|
|
# name: Linux Flatpak
|
|
|
|
# path: |
|
|
|
|
# imhex.flatpak
|
|
|
|
|
|
|
|
- name: ⬆️ Upload DEB
|
2022-06-23 23:48:02 +02:00
|
|
|
uses: actions/upload-artifact@v3
|
2022-01-15 00:14:12 +01:00
|
|
|
with:
|
2022-06-23 23:48:02 +02:00
|
|
|
name: Linux DEB (Ubuntu 22.04)
|
2022-01-15 00:14:12 +01:00
|
|
|
path: |
|
|
|
|
imhex.deb
|
|
|
|
|
|
|
|
- name: ⬆️ Upload AppImage
|
2022-06-23 23:48:02 +02:00
|
|
|
uses: actions/upload-artifact@v3
|
2022-01-15 00:14:12 +01:00
|
|
|
with:
|
|
|
|
name: Linux AppImage
|
|
|
|
path: |
|
|
|
|
imhex.AppImage
|
2022-01-22 22:10:49 +01:00
|
|
|
|