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 :
2023-06-30 23:58:20 +02:00
BUILD_TYPE : RelWithDebInfo
2020-12-11 14:24:42 +01:00
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"
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-10-10 20:37:00 +02:00
- name : 📜 Setup ccache
uses : hendrikmuhs/ccache-action@v1.2
2022-06-29 00:24:53 +02:00
id : cache-ccache
with :
2023-10-04 22:23:41 +02:00
key : ${{ runner.os }}-ccache-${{ github.run_id }}
restore-keys : ${{ runner.os }}-ccache
2023-08-21 16:20:36 +02:00
max-size : 1G
2022-06-29 00:24:53 +02:00
- name : 📜 Restore CMakeCache
uses : actions/cache@v3
with :
path : |
build/CMakeCache.txt
2023-10-04 22:23:41 +02:00
key : ${{ runner.os }}-cmakecache-${{ hashFiles('**/CMakeLists.txt') }}
2022-06-29 00:24:53 +02:00
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
ccache:p
glfw:p
file:p
mbedtls:p
freetype:p
dlfcn:p
2023-01-17 21:38:56 +01:00
libbacktrace:p
2023-07-14 22:03:44 +02:00
ninja:p
2023-07-16 21:38:54 +02:00
curl-winssl:p
2023-07-16 21:38:29 +02:00
capstone:p
2021-09-19 21:49:09 +02:00
2023-07-15 14:29:14 +02:00
- name : ⬇️ Install .NET
uses : actions/setup-dotnet@v3
with :
2023-11-16 21:46:38 +01:00
dotnet-version : '8.0.100'
2023-07-15 14:29:14 +02:00
2022-10-27 14:12:46 +02:00
- name : 📜 Set version variable
run : |
echo "IMHEX_VERSION=`cat VERSION`" >> $GITHUB_ENV
2022-08-04 21:50:41 +02:00
# Windows cmake build
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
2023-07-14 22:03:44 +02:00
cmake -G "Ninja" \
2023-06-30 23:58:20 +02:00
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \
2023-04-13 16:11:39 +02:00
-DCMAKE_INSTALL_PREFIX="$PWD/install" \
2023-11-04 01:11:50 +01:00
-DIMHEX_GENERATE_PACKAGE=ON \
2023-07-14 21:51:18 +02:00
-DIMHEX_USE_DEFAULT_BUILD_SETTINGS=ON \
2023-04-13 16:11:39 +02:00
-DIMHEX_PATTERNS_PULL_MASTER=ON \
-DIMHEX_COMMIT_HASH_SHORT="${GITHUB_SHA::7}" \
-DIMHEX_COMMIT_HASH_LONG="${GITHUB_SHA}" \
-DIMHEX_COMMIT_BRANCH="${GITHUB_REF##*/}" \
2023-07-16 21:38:29 +02:00
-DUSE_SYSTEM_CAPSTONE=ON \
2023-07-14 22:03:44 +02:00
-DDOTNET_EXECUTABLE="C:/Program Files/dotnet/dotnet.exe" \
2021-01-10 14:22:34 +01:00
..
2023-07-14 22:03:44 +02:00
ninja install
2021-01-10 14:22:34 +01:00
cpack
2023-03-26 11:22:50 +02:00
mv ImHex-*.msi ../imhex-${{env.IMHEX_VERSION}}-Windows-x86_64.msi
2023-01-12 08:25:28 +01:00
2022-09-02 16:11:19 +02:00
echo "ImHex checks for the existence of this file to determine if it is running in portable mode. You should not delete this file" > $PWD/install/PORTABLE
2021-10-16 11:37:29 +02:00
2022-09-02 16:12:02 +02:00
- name : ⬆️ Upload Windows Installer
uses : actions/upload-artifact@v3
with :
2023-11-05 19:57:58 +01:00
if-no-files-found : error
2023-01-12 08:25:28 +01:00
name : Windows Installer x86_64
2022-09-02 16:12:02 +02:00
path : |
2023-01-12 08:25:28 +01:00
imhex-*.msi
2022-09-02 16:12:02 +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 :
2023-11-05 19:57:58 +01:00
if-no-files-found : error
2023-01-12 08:25:28 +01:00
name : Windows Portable x86_64
2021-01-10 14:22:34 +01:00
path : |
build/install/*
2023-01-30 11:11:30 +01:00
2022-09-02 16:12:02 +02:00
- name : ⬇️ Download Mesa3D for NoGPU version
shell : bash
run : |
echo "NoGPU version Powered by Mesa 3D : https://fdossena.com/?p=mesa%2Findex.frag" > build/install/MESA.md
2022-12-21 07:13:31 +01:00
curl https://werwolv.net/downloads/mesa/MesaForWindows-x64-latest.7z -L -o mesa.7z
2022-09-02 16:12:02 +02:00
7z e mesa.7z
mv opengl32.dll build/install
2022-10-28 09:17:04 +02:00
2022-09-02 16:12:02 +02:00
- name : ⬆️ Upload NoGPU Portable ZIP
2022-06-23 23:48:02 +02:00
uses : actions/upload-artifact@v3
2021-01-08 16:25:12 +01:00
with :
2023-11-05 19:57:58 +01:00
if-no-files-found : error
2023-01-12 08:25:28 +01:00
name : Windows Portable NoGPU x86_64
2021-01-08 16:25:12 +01:00
path : |
2022-09-02 16:12:02 +02:00
build/install/*
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 :
2023-11-04 13:51:13 +01:00
runs-on : macos-12
2021-01-25 15:09:30 +01:00
2022-08-30 09:47:39 +02:00
strategy :
2023-11-07 16:09:13 +01:00
fail-fast : false
2022-08-30 09:47:39 +02:00
matrix :
include :
- suffix : "-NoGPU"
custom_glfw : true
- suffix : ""
custom_glfw : false
2023-01-30 11:11:30 +01:00
2023-11-04 13:51:13 +01:00
name : 🍎 macOS 12.0${{matrix.suffix}}
2022-08-30 09:47:39 +02:00
steps :
2021-01-25 15:09:30 +01:00
- 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-08-30 09:47:39 +02:00
- name : 📜 Set version variable
run : |
echo "IMHEX_VERSION=`cat VERSION`" >> $GITHUB_ENV
2023-01-30 11:11:30 +01:00
2022-10-10 20:37:00 +02:00
- name : 📜 Setup ccache
uses : hendrikmuhs/ccache-action@v1.2
2022-06-29 00:24:53 +02:00
with :
2023-10-04 22:23:41 +02:00
key : ${{ runner.os }}${{ matrix.suffix }}-ccache-${{ github.run_id }}
restore-keys : ${{ runner.os }}${{ matrix.suffix }}-ccache
2023-08-21 16:20:36 +02:00
max-size : 1G
2023-01-30 11:11:30 +01:00
2022-06-29 00:24:53 +02:00
- name : 📜 Restore CMakeCache
uses : actions/cache@v3
with :
path : |
build/CMakeCache.txt
2023-10-04 22:23:41 +02:00
key : ${{ runner.os }}-${{ matrix.suffix }}-cmakecache-${{ hashFiles('**/CMakeLists.txt') }}
2021-01-25 15:09:30 +01:00
- name : ⬇️ Install dependencies
run : |
brew bundle --no-lock --file dist/Brewfile
2022-10-06 15:22:38 +02:00
rm -rf /usr/local/Cellar/capstone
2021-01-25 15:09:30 +01:00
2022-08-30 09:47:39 +02:00
- name : ⬇️ Install classic glfw
if : ${{! matrix.custom_glfw}}
run : |
brew install glfw
2023-07-15 14:29:14 +02:00
- name : ⬇️ Install .NET
uses : actions/setup-dotnet@v3
with :
2023-11-16 21:46:38 +01:00
dotnet-version : '8.0.100'
2023-07-15 14:29:14 +02:00
2022-08-30 09:47:39 +02:00
- name : 🧰 Checkout glfw
if : ${{matrix.custom_glfw}}
uses : actions/checkout@v3
with :
repository : glfw/glfw
path : glfw
2023-07-30 21:36:27 +02:00
# GLFW custom build (to allow software rendering)
2022-08-30 09:47:39 +02:00
- name : ⬇️ Patch and install custom glfw
if : ${{matrix.custom_glfw}}
run : |
cd glfw
git apply ../dist/macOS/0001-glfw-SW.patch
mkdir build
cd build
2023-07-14 22:03:44 +02:00
cmake -G "Ninja" \
2023-07-30 21:36:27 +02:00
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \
2023-04-13 16:11:39 +02:00
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_OBJC_COMPILER_LAUNCHER=ccache \
-DCMAKE_OBJCXX_COMPILER_LAUNCHER=ccache \
2022-08-30 09:47:39 +02:00
..
2023-07-14 22:03:44 +02:00
ninja install
2022-08-30 09:47:39 +02:00
2022-08-04 21:50:41 +02:00
# MacOS cmake build
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
2023-04-13 16:11:39 +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++ \
PKG_CONFIG_PATH="$(brew --prefix openssl)/lib/pkgconfig":"$(brew --prefix)/lib/pkgconfig" \
2023-07-14 22:03:44 +02:00
cmake -G "Ninja" \
2023-06-30 23:58:20 +02:00
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \
2023-11-04 01:11:50 +01:00
-DIMHEX_GENERATE_PACKAGE=ON \
2023-04-13 16:11:39 +02:00
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_OBJC_COMPILER_LAUNCHER=ccache \
-DCMAKE_OBJCXX_COMPILER_LAUNCHER=ccache \
-DIMHEX_PATTERNS_PULL_MASTER=ON \
-DIMHEX_COMMIT_HASH_SHORT="${GITHUB_SHA::7}" \
-DIMHEX_COMMIT_HASH_LONG="${GITHUB_SHA}" \
-DIMHEX_COMMIT_BRANCH="${GITHUB_REF##*/}" \
-DCPACK_PACKAGE_FILE_NAME="imhex-${{env.IMHEX_VERSION}}-macOS${{matrix.suffix}}-x86_64" \
2021-02-02 23:11:23 +01:00
..
2023-07-14 22:03:44 +02:00
ninja package
2022-10-28 09:14:01 +02: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 :
2023-11-05 19:57:58 +01:00
if-no-files-found : error
2023-01-12 08:25:28 +01:00
name : macOS DMG${{matrix.suffix}} x86_64
2021-01-25 15:09:30 +01:00
path : build/*.dmg
2022-01-15 00:14:12 +01:00
2023-11-16 22:31:46 +01:00
macos-arm64 :
runs-on : ubuntu-22.04
name : 🍎 macOS 12.1 arm64
steps :
- name : 🧰 Checkout
uses : actions/checkout@v3
with :
submodules : recursive
- name : 📁 Restore docker /cache
uses : actions/cache@v3
with :
path : cache
key : build-macos-arm64-cache
- name : 🐳 Inject /cache into docker
uses : reproducible-containers/buildkit-cache-dance@v2.1.2 # Doesn't work with a MacOS runner ?
with :
cache-source : cache
cache-target : /cache
- name : 🛠️ Build using docker
run : |
docker buildx build . -f dist/macOS/arm64.Dockerfile --progress=plain --build-arg 'JOBS=4' --build-arg "BUILD_TYPE=$(BUILD_TYPE)" --build-context imhex=$(pwd) --output out
- name : ⬆️ Upload artifacts
2023-11-17 00:55:10 +01:00
uses : actions/upload-artifact@v3
2023-11-16 22:31:46 +01:00
with :
name : macOS ZIP arm64
path : out/
# See https://github.com/actions/cache/issues/342#issuecomment-1711054115
- name : 🗑️ Delete old cache
continue-on-error : true
env :
GH_TOKEN : ${{ github.token }}
run : |
gh extension install actions/gh-actions-cache
gh actions-cache delete "build-macos-arm64-cache" --confirm
2022-08-04 21:50:41 +02:00
# Ubuntu build
ubuntu :
2023-06-30 23:58:20 +02:00
strategy :
2023-11-07 16:09:13 +01:00
fail-fast : false
2023-06-30 23:58:20 +02:00
matrix :
include :
- name : Ubuntu
release_num : 22.04
- name : Ubuntu
release_num : 23.04
name : 🐧 Ubuntu ${{ matrix.release_num }}
runs-on : ubuntu-latest
container :
image : "ubuntu:${{ matrix.release_num }}"
options : --privileged
2022-01-15 00:14:12 +01:00
steps :
2023-07-15 14:29:14 +02:00
- name : ⬇️ Install setup dependencies
run : apt update && apt install -y git curl
2022-01-15 00:14:12 +01:00
- 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
2022-10-10 20:37:00 +02:00
- name : 📜 Setup ccache
uses : hendrikmuhs/ccache-action@v1.2
2022-01-15 00:14:12 +01:00
with :
2023-10-04 22:23:41 +02:00
key : Ubuntu-${{matrix.release_num}}-ccache-${{ github.run_id }}
restore-keys : Ubuntu-${{matrix.release_num}}-ccache
2023-08-21 16:20:36 +02:00
max-size : 1G
2023-01-30 11:11:30 +01:00
2023-01-12 23:50:59 +01:00
- name : 📜 Restore CMakeCache
2022-06-29 00:24:53 +02:00
uses : actions/cache@v3
with :
path : |
build/CMakeCache.txt
2023-10-04 22:23:41 +02:00
key : Ubuntu-${{matrix.release_num}}-cmakecache-${{ hashFiles('**/CMakeLists.txt') }}
2023-01-30 11:11:30 +01:00
2022-01-15 00:14:12 +01:00
- name : ⬇️ Install dependencies
run : |
2023-06-30 23:58:20 +02:00
apt update
bash dist/get_deps_debian.sh
2022-01-15 00:14:12 +01:00
2023-07-15 14:29:14 +02:00
- name : ⬇️ Install .NET
uses : actions/setup-dotnet@v3
with :
2023-11-16 21:46:38 +01:00
dotnet-version : '8.0.100'
2023-07-15 14:29:14 +02:00
2023-09-25 21:46:37 +02:00
- name : 🏔️ Set Environment variables
2022-01-15 00:14:12 +01:00
run : |
2023-06-30 23:58:20 +02:00
echo COMMIT_SHA_SHORT=$(git rev-parse --short HEAD) >> $GITHUB_ENV
echo COMMIT_SHA_LONG=$(git rev-parse HEAD) >> $GITHUB_ENV
echo COMMIT_BRANCH=$(git rev-parse --abbrev-ref HEAD) >> $GITHUB_ENV
2023-09-25 21:46:37 +02:00
# Ubuntu cmake build
- name : 🛠️ Build
run : |
git config --global --add safe.directory '*'
2022-01-15 00:14:12 +01:00
mkdir -p build
cd build
2023-07-14 22:03:44 +02:00
CC=gcc-12 CXX=g++-12 cmake -G "Ninja" \
2023-07-15 14:29:14 +02:00
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \
2023-07-14 22:03:44 +02:00
-DCMAKE_INSTALL_PREFIX="/usr" \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DIMHEX_PATTERNS_PULL_MASTER=ON \
2023-09-25 21:46:37 +02:00
-DIMHEX_COMMIT_HASH_SHORT="${{ env.COMMIT_SHA_SHORT }}" \
-DIMHEX_COMMIT_HASH_LONG="${{ env.COMMIT_SHA_LONG }}" \
-DIMHEX_COMMIT_BRANCH="${{ env.COMMIT_BRANCH }}" \
2023-07-15 10:01:50 +02:00
-DIMHEX_ENABLE_LTO=ON \
-DIMHEX_USE_GTK_FILE_PICKER=ON \
2023-07-15 14:29:14 +02:00
-DDOTNET_EXECUTABLE="dotnet" \
2022-01-15 00:14:12 +01:00
..
2023-07-14 22:03:44 +02:00
DESTDIR=DebDir ninja install
2022-01-15 00:14:12 +01:00
2022-06-29 15:01:08 +02:00
- name : 📜 Set version variable
run : |
2022-07-18 20:13:01 +02:00
echo "IMHEX_VERSION=`cat VERSION`" >> $GITHUB_ENV
2022-06-29 15:01:08 +02:00
2022-03-20 23:43:55 +01:00
- name : 📦 Bundle DEB
run : |
2022-08-18 23:03:31 +02:00
cp -r build/DEBIAN build/DebDir
dpkg-deb -Zgzip --build build/DebDir
2023-07-05 20:25:40 +02:00
mv build/DebDir.deb imhex-${{env.IMHEX_VERSION}}-Ubuntu-${{ matrix.release_num }}-x86_64.deb
2022-01-15 00:14:12 +01:00
2023-01-12 23:50:59 +01:00
- name : ⬆️ Upload DEB
uses : actions/upload-artifact@v3
with :
2023-11-05 19:57:58 +01:00
if-no-files-found : error
2023-07-05 20:25:40 +02:00
name : Ubuntu ${{ matrix.release_num }} DEB x86_64
2023-01-12 23:50:59 +01:00
path : '*.deb'
# AppImage build
appimage :
runs-on : ubuntu-22.04
name : ⬇️ AppImage
steps :
- name : 🧰 Checkout
uses : actions/checkout@v3
with :
submodules : recursive
2023-10-11 16:17:52 +02:00
- name : 📁 Restore docker /cache
uses : actions/cache@v3
2023-01-12 23:50:59 +01:00
with :
2023-10-11 16:17:52 +02:00
path : cache
2023-10-04 22:23:41 +02:00
key : appimage-ccache-${{ github.run_id }}
2023-10-11 16:17:52 +02:00
restore-keys : appimage-cache
- name : 🐳 Inject /cache into docker
uses : reproducible-containers/buildkit-cache-dance@v2.1.2
2023-01-12 23:50:59 +01:00
with :
2023-10-11 16:17:52 +02:00
cache-source : cache
cache-target : /cache
2023-01-12 23:50:59 +01:00
2023-10-11 16:17:52 +02:00
- name : 🛠️ Build using docker
2022-08-04 20:37:57 +02:00
run : |
2023-10-11 16:17:52 +02:00
docker buildx build . -f dist/appimage/Dockerfile --progress=plain --build-arg "BUILD_TYPE=$BUILD_TYPE" \
--build-arg "GIT_COMMIT_HASH=$GITHUB_SHA" --build-arg "GIT_BRANCH=${GITHUB_REF##*/}" --output out
2022-08-04 20:37:57 +02:00
2022-03-20 23:43:55 +01:00
2022-01-15 00:14:12 +01:00
- 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 :
2023-11-05 19:57:58 +01:00
if-no-files-found : error
2023-01-12 08:25:28 +01:00
name : Linux AppImage x86_64
2023-10-11 16:17:52 +02:00
path : 'out/*.AppImage'
2023-01-30 11:11:30 +01:00
2022-09-08 09:31:49 +02:00
- name : ⬆️ Upload AppImage zsync
uses : actions/upload-artifact@v3
with :
2023-11-05 19:57:58 +01:00
if-no-files-found : error
2023-01-12 08:25:28 +01:00
name : Linux AppImage zsync x86_64
2023-10-11 16:17:52 +02:00
path : 'out/*.AppImage.zsync'
2022-01-22 22:10:49 +01:00
2022-08-04 21:50:41 +02:00
# ArchLinux build
2022-07-04 21:40:22 +02:00
archlinux-build :
name : 🐧 ArchLinux
runs-on : ubuntu-latest
2023-01-30 11:11:30 +01:00
2022-07-04 21:40:22 +02:00
container :
image : archlinux:base-devel
steps :
- name : ⬇️ Update all packages
run : |
pacman -Syyu --noconfirm
- name : ⬇️ Install setup dependencies
run : |
pacman -Syu git ccache --noconfirm
2023-01-30 11:11:30 +01:00
2022-07-04 21:40:22 +02:00
- name : 🧰 Checkout
uses : actions/checkout@v3
with :
submodules : recursive
- name : ⬇️ Install ImHex dependencies
run : |
dist/get_deps_archlinux.sh --noconfirm
2023-07-15 14:29:14 +02:00
- name : ⬇️ Install .NET
uses : actions/setup-dotnet@v3
with :
2023-11-16 21:46:38 +01:00
dotnet-version : '8.0.100'
2023-07-15 14:29:14 +02:00
2022-10-10 20:37:00 +02:00
- name : 📜 Setup ccache
uses : hendrikmuhs/ccache-action@v1.2
2022-07-04 21:40:22 +02:00
with :
2023-10-04 22:23:41 +02:00
key : archlinux-ccache-${{ github.run_id }}
restore-keys : archlinux-ccache
2023-08-21 16:20:36 +02:00
max-size : 1G
2023-01-30 11:11:30 +01:00
2022-07-04 21:40:22 +02:00
- name : 📜 Restore CMakeCache
uses : actions/cache@v3
with :
path : |
build/CMakeCache.txt
2023-10-04 22:23:41 +02:00
key : archlinux-cmakecache-${{ hashFiles('**/CMakeLists.txt') }}
2023-01-30 11:11:30 +01:00
2022-08-04 21:50:41 +02:00
# ArchLinux cmake build
2022-07-04 21:40:22 +02:00
- name : 🛠️ Build
run : |
mkdir -p build
cd build
2023-07-14 22:03:44 +02:00
CC=gcc CXX=g++ cmake -G "Ninja" \
2023-06-30 23:58:20 +02:00
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \
2023-04-13 16:11:39 +02:00
-DCMAKE_INSTALL_PREFIX="/usr" \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DUSE_SYSTEM_FMT=ON \
-DUSE_SYSTEM_YARA=ON \
-DUSE_SYSTEM_NLOHMANN_JSON=ON \
-DUSE_SYSTEM_CAPSTONE=OFF \
-DIMHEX_PATTERNS_PULL_MASTER=ON \
-DIMHEX_COMMIT_HASH_SHORT="${GITHUB_SHA::7}" \
-DIMHEX_COMMIT_HASH_LONG="${GITHUB_SHA}" \
-DIMHEX_COMMIT_BRANCH="${GITHUB_REF##*/}" \
2023-07-15 10:01:50 +02:00
-DIMHEX_ENABLE_LTO=ON \
-DIMHEX_USE_GTK_FILE_PICKER=ON \
2022-07-04 21:40:22 +02:00
..
2023-07-14 22:03:44 +02:00
DESTDIR=installDir ninja install
2022-07-04 21:40:22 +02:00
- name : 📜 Set version variable
run : |
2022-07-23 20:42:59 +02:00
echo "IMHEX_VERSION=`cat VERSION`" >> $GITHUB_ENV
2023-01-30 11:11:30 +01:00
2022-07-04 21:40:22 +02:00
- name : ✒️ Prepare PKGBUILD
run : |
cp dist/Arch/PKGBUILD build
2022-07-18 20:13:01 +02:00
sed -i 's/%version%/${{env.IMHEX_VERSION}}/g' build/PKGBUILD
2022-07-04 21:40:22 +02:00
# makepkg doesn't want to run as root, so I had to chmod 777 all over
- name : 📦 Package ArchLinux .pkg.tar.zst
run : |
cd build
2023-01-30 11:11:30 +01:00
2022-07-04 21:40:22 +02:00
# the name is a small trick to make makepkg recognize it as the source
# else, it would try to download the file from the release
2023-01-12 08:25:28 +01:00
tar -cvf imhex-${{env.IMHEX_VERSION}}-ArchLinux-x86_64.pkg.tar.zst -C installDir .
2023-01-30 11:11:30 +01:00
2022-07-04 21:40:22 +02:00
chmod -R 777 .
2023-01-30 11:11:30 +01:00
2022-07-04 21:40:22 +02:00
sudo -u nobody makepkg
2022-07-31 17:29:57 +02:00
# Replace the old file
2023-01-12 08:25:28 +01:00
rm imhex-${{env.IMHEX_VERSION}}-ArchLinux-x86_64.pkg.tar.zst
mv *.pkg.tar.zst imhex-${{env.IMHEX_VERSION}}-ArchLinux-x86_64.pkg.tar.zst
2023-01-30 11:11:30 +01:00
2022-07-04 21:40:22 +02:00
- name : ⬆️ Upload imhex-archlinux.pkg.tar.zst
uses : actions/upload-artifact@v3
with :
2023-11-05 19:57:58 +01:00
if-no-files-found : error
2023-01-12 08:25:28 +01:00
name : ArchLinux .pkg.tar.zst x86_64
2022-07-04 21:40:22 +02:00
path : |
2023-01-12 08:25:28 +01:00
build/imhex-${{env.IMHEX_VERSION}}-ArchLinux-x86_64.pkg.tar.zst
2022-08-04 21:50:41 +02:00
2023-01-10 23:10:34 +01:00
# RPM distro builds
rpm-build :
2022-07-31 17:29:57 +02:00
strategy :
2023-11-07 16:09:13 +01:00
fail-fast : false
2022-07-31 17:29:57 +02:00
matrix :
include :
2023-02-02 21:42:13 +01:00
- name : Fedora
mock_release : rawhide
release_num : rawhide
mock_config : fedora-rawhide
2023-03-26 11:37:46 +02:00
- name : Fedora
mock_release : f38
release_num : 38
mock_config : fedora-38
2023-01-10 23:10:34 +01:00
- name : Fedora
mock_release : f37
release_num : 37
mock_config : fedora-37
- name : RHEL-AlmaLinux
mock_release : epel9
release_num : 9
mock_config : "alma+epel-9"
name : 🐧 ${{ matrix.name }} ${{ matrix.release_num }}
2022-07-31 00:43:42 +02:00
runs-on : ubuntu-latest
2023-01-30 11:11:30 +01:00
2022-07-31 00:43:42 +02:00
container :
2023-01-10 23:10:34 +01:00
image : "fedora:latest"
options : --privileged
2022-07-31 00:43:42 +02:00
steps :
2023-01-10 23:10:34 +01:00
- name : ⬇️ Install git-core
run : dnf install --disablerepo="*" --enablerepo="fedora" git-core -y
2023-01-30 11:11:30 +01:00
2022-07-31 00:43:42 +02:00
- name : 🧰 Checkout
uses : actions/checkout@v3
with :
2023-01-10 23:10:34 +01:00
path : ImHex
2022-07-31 00:43:42 +02:00
submodules : recursive
2023-01-30 11:11:30 +01:00
2023-01-10 23:10:34 +01:00
- name : 📜 Setup DNF Cache
uses : actions/cache@v3
with :
path : /var/cache/dnf
2023-10-04 22:23:41 +02:00
key : ${{ matrix.mock_release }}-dnf-${{ github.run_id }}
2023-01-10 23:10:34 +01:00
restore-keys : |
2023-10-04 22:23:41 +02:00
${{ matrix.mock_release }}-dnf-
2023-01-30 11:11:30 +01:00
2023-01-10 23:10:34 +01:00
- name : ⬇️ Update all packages and install dependencies
2022-07-31 00:43:42 +02:00
run : |
2023-01-10 23:10:34 +01:00
dnf upgrade --disablerepo="*" --enablerepo="fedora,updates" -y
dnf install --disablerepo="*" --enablerepo="fedora,updates" -y \
fedpkg \
ccache
2022-07-31 00:43:42 +02:00
2023-07-15 14:29:14 +02:00
- name : ⬇️ Install .NET
uses : actions/setup-dotnet@v3
with :
2023-11-16 21:46:38 +01:00
dotnet-version : '8.0.100'
2023-07-15 14:29:14 +02:00
2022-10-10 20:37:00 +02:00
- name : 📜 Setup ccache
2023-01-10 23:10:34 +01:00
uses : hendrikmuhs/ccache-action@v1.2.5
2022-07-31 00:43:42 +02:00
with :
2023-10-04 22:23:41 +02:00
key : ${{ matrix.mock_release }}-rpm-${{ github.run_id }}
restore-keys : ${{ matrix.mock_release }}-rpm
2023-01-10 23:10:34 +01:00
max-size : 1G
2022-07-31 00:43:42 +02:00
- name : 📜 Set version variable
run : |
2023-01-10 23:10:34 +01:00
echo "IMHEX_VERSION=`cat ImHex/VERSION`" >> $GITHUB_ENV
2023-01-30 11:11:30 +01:00
2023-01-10 23:10:34 +01:00
- name : 🗜️ Create tarball from sources with dependencies
run : tar --exclude-vcs -czf $GITHUB_WORKSPACE/imhex-$IMHEX_VERSION.tar.gz ImHex
2023-01-30 11:11:30 +01:00
2023-03-21 10:14:09 +01:00
- name : ✒️ Modify spec file
2023-01-10 23:10:34 +01:00
run : |
sed -i \
-e 's/Version: [0-9]*\.[0-9]*\.[0-9]*$/Version : ${{env.IMHEX_VERSION}}/g' \
-e 's/IMHEX_OFFLINE_BUILD=ON/IMHEX_OFFLINE_BUILD=OFF/g' \
-e '/IMHEX_OFFLINE_BUILD=OFF/a -D IMHEX_PATTERNS_PULL_MASTER=ON \\' \
-e '/BuildRequires: cmake/a BuildRequires : git-core' \
-e '/%files/a %{_datadir}/%{name}/' \
$GITHUB_WORKSPACE/ImHex/dist/rpm/imhex.spec
2023-01-30 11:11:30 +01:00
2023-01-10 23:10:34 +01:00
- name : 📜 Fix ccache on EL9
if : matrix.mock_release == 'epel9'
run : sed -i '/\. \/opt\/rh\/gcc-toolset-12\/enable/a PATH=/usr/lib64/ccache:$PATH' $GITHUB_WORKSPACE/ImHex/dist/rpm/imhex.spec
2023-01-30 11:11:30 +01:00
2023-01-10 23:10:34 +01:00
- name : 🟩 Copy spec file to build root
run : mv $GITHUB_WORKSPACE/ImHex/dist/rpm/imhex.spec $GITHUB_WORKSPACE/imhex.spec
- name : 📜 Enable ccache for mock
run : |
cat <<EOT > $GITHUB_WORKSPACE/mock.cfg
include('${{ matrix.mock_config }}-x86_64.cfg')
config_opts['plugin_conf']['ccache_enable'] = True
config_opts['plugin_conf']['ccache_opts']['max_cache_size'] = '1G'
config_opts['plugin_conf']['ccache_opts']['compress'] = True
config_opts['plugin_conf']['ccache_opts']['dir'] = "$GITHUB_WORKSPACE/.ccache"
EOT
- name : 📜 Setup Mock Cache
uses : actions/cache@v3
with :
path : /var/cache/mock
2023-10-04 22:23:41 +02:00
key : ${{ matrix.mock_release }}-mock-${{ github.run_id }}
2023-01-10 23:10:34 +01:00
restore-keys : |
2023-10-04 22:23:41 +02:00
${{ matrix.mock_release }}-mock
2023-01-10 23:10:34 +01:00
2022-08-04 21:50:41 +02:00
# Fedora cmake build (in imhex.spec)
2022-07-31 00:43:42 +02:00
- name : 📦 Build RPM
run : |
2023-08-06 21:33:15 +02:00
fedpkg --path $GITHUB_WORKSPACE --release ${{ matrix.mock_release }} mockbuild --enable-network -N --root $GITHUB_WORKSPACE/mock.cfg extra_args -- -v
2023-01-30 11:11:30 +01:00
2023-01-10 23:10:34 +01:00
- name : 🟩 Move and rename finished RPM
run : |
mv $GITHUB_WORKSPACE/results_imhex/${{env.IMHEX_VERSION}}/*/imhex-${{env.IMHEX_VERSION}}-0.*.x86_64.rpm \
$GITHUB_WORKSPACE/imhex-${{env.IMHEX_VERSION}}-${{matrix.name}}-${{matrix.release_num}}-x86_64.rpm
2022-07-31 00:43:42 +02:00
- name : ⬆️ Upload RPM
uses : actions/upload-artifact@v3
with :
2023-11-05 19:57:58 +01:00
if-no-files-found : error
2023-01-12 08:25:28 +01:00
name : ${{ matrix.name }} ${{ matrix.release_num }} RPM x86_64
2022-07-31 00:43:42 +02:00
path : |
2023-01-10 23:10:34 +01:00
imhex-${{env.IMHEX_VERSION}}-${{matrix.name}}-${{matrix.release_num}}-x86_64.rpm