1
0
mirror of synced 2024-12-18 02:25:57 +01:00

git: Better build CI script formatting

This commit is contained in:
WerWolv 2024-08-03 18:40:56 +02:00
parent 3dd5b2365a
commit e0712f73c2

View File

@ -64,7 +64,7 @@ jobs:
cd build cd build
cmake -G "Ninja" \ cmake -G "Ninja" \
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \ -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
-DCMAKE_INSTALL_PREFIX="$PWD/install" \ -DCMAKE_INSTALL_PREFIX="$PWD/install" \
-DIMHEX_GENERATE_PACKAGE=ON \ -DIMHEX_GENERATE_PACKAGE=ON \
-DIMHEX_USE_DEFAULT_BUILD_SETTINGS=ON \ -DIMHEX_USE_DEFAULT_BUILD_SETTINGS=ON \
@ -82,7 +82,7 @@ jobs:
cd build cd build
ninja install ninja install
cpack cpack
mv ImHex-*.msi ../imhex-${{env.IMHEX_VERSION}}-Windows-x86_64.msi mv ImHex-*.msi ../imhex-${{ env.IMHEX_VERSION }}-Windows-x86_64.msi
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 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
@ -165,7 +165,7 @@ jobs:
cd build cd build
cmake -G "Ninja" \ cmake -G "Ninja" \
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \ -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
-DIMHEX_USE_DEFAULT_BUILD_SETTINGS=ON \ -DIMHEX_USE_DEFAULT_BUILD_SETTINGS=ON \
-DUSE_SYSTEM_CAPSTONE=ON \ -DUSE_SYSTEM_CAPSTONE=ON \
.. ..
@ -185,7 +185,7 @@ jobs:
- suffix: "" - suffix: ""
custom_glfw: false custom_glfw: false
name: 🍎 macOS 12.0${{matrix.suffix}} name: 🍎 macOS 12.0${{ matrix.suffix }}
steps: steps:
- name: 🧰 Checkout - name: 🧰 Checkout
@ -211,7 +211,7 @@ jobs:
rm -rf /usr/local/Cellar/capstone rm -rf /usr/local/Cellar/capstone
- name: ⬇️ Install classic glfw - name: ⬇️ Install classic glfw
if: ${{! matrix.custom_glfw}} if: ${{! matrix.custom_glfw }}
run: | run: |
brew install glfw || true brew install glfw || true
@ -221,7 +221,7 @@ jobs:
dotnet-version: '8.0.100' dotnet-version: '8.0.100'
- name: 🧰 Checkout glfw - name: 🧰 Checkout glfw
if: ${{matrix.custom_glfw}} if: ${{ matrix.custom_glfw }}
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
repository: glfw/glfw repository: glfw/glfw
@ -229,7 +229,7 @@ jobs:
# GLFW custom build (to allow software rendering) # GLFW custom build (to allow software rendering)
- name: ⬇️ Patch and install custom glfw - name: ⬇️ Patch and install custom glfw
if: ${{matrix.custom_glfw}} if: ${{ matrix.custom_glfw }}
run: | run: |
set -x set -x
cd glfw cd glfw
@ -239,7 +239,7 @@ jobs:
cd build cd build
cmake -G "Ninja" \ cmake -G "Ninja" \
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \ -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
-DBUILD_SHARED_LIBS=ON \ -DBUILD_SHARED_LIBS=ON \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \ -DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
@ -260,7 +260,7 @@ jobs:
OBJCXX=$(brew --prefix llvm)/bin/clang++ \ OBJCXX=$(brew --prefix llvm)/bin/clang++ \
PKG_CONFIG_PATH="$(brew --prefix openssl)/lib/pkgconfig":"$(brew --prefix)/lib/pkgconfig" \ PKG_CONFIG_PATH="$(brew --prefix openssl)/lib/pkgconfig":"$(brew --prefix)/lib/pkgconfig" \
cmake -G "Ninja" \ cmake -G "Ninja" \
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \ -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
-DIMHEX_GENERATE_PACKAGE=ON \ -DIMHEX_GENERATE_PACKAGE=ON \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \ -DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
@ -303,13 +303,13 @@ jobs:
cd bundle cd bundle
ln -s /Applications Applications ln -s /Applications Applications
cd .. cd ..
hdiutil create -volname "ImHex" -srcfolder bundle -ov -format UDZO imhex-${{env.IMHEX_VERSION}}-macOS${{matrix.suffix}}-x86_64.dmg hdiutil create -volname "ImHex" -srcfolder bundle -ov -format UDZO imhex-${{ env.IMHEX_VERSION }}-macOS${{ matrix.suffix }}-x86_64.dmg
- name: ⬆️ Upload DMG - name: ⬆️ Upload DMG
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
if-no-files-found: error if-no-files-found: error
name: macOS DMG${{matrix.suffix}} x86_64 name: macOS DMG${{ matrix.suffix }} x86_64
path: ./*.dmg path: ./*.dmg
macos-arm64-build: macos-arm64-build:
@ -402,7 +402,7 @@ jobs:
cd bundle cd bundle
ln -s /Applications Applications ln -s /Applications Applications
cd .. cd ..
hdiutil create -volname "ImHex" -srcfolder bundle -ov -format UDZO imhex-${{env.IMHEX_VERSION}}-macOS-arm64.dmg hdiutil create -volname "ImHex" -srcfolder bundle -ov -format UDZO imhex-${{ env.IMHEX_VERSION }}-macOS-arm64.dmg
- name: ⬆️ Upload DMG - name: ⬆️ Upload DMG
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
@ -439,8 +439,8 @@ jobs:
- name: 📜 Setup ccache - name: 📜 Setup ccache
uses: hendrikmuhs/ccache-action@v1 uses: hendrikmuhs/ccache-action@v1
with: with:
key: Ubuntu-${{matrix.release_num}}-ccache-${{ github.run_id }} key: Ubuntu-${{ matrix.release_num }}-ccache-${{ github.run_id }}
restore-keys: Ubuntu-${{matrix.release_num}}-ccache restore-keys: Ubuntu-${{ matrix.release_num }}-ccache
max-size: 1G max-size: 1G
- name: ⬇️ Install dependencies - name: ⬇️ Install dependencies
@ -462,7 +462,7 @@ jobs:
mkdir -p build mkdir -p build
cd build cd build
CC=gcc-12 CXX=g++-12 cmake -G "Ninja" \ CC=gcc-12 CXX=g++-12 cmake -G "Ninja" \
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \ -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
-DCMAKE_INSTALL_PREFIX="/usr" \ -DCMAKE_INSTALL_PREFIX="/usr" \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \ -DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
@ -485,7 +485,7 @@ jobs:
run: | run: |
cp -r build/DEBIAN build/DebDir cp -r build/DEBIAN build/DebDir
dpkg-deb -Zgzip --build build/DebDir dpkg-deb -Zgzip --build build/DebDir
mv build/DebDir.deb imhex-${{env.IMHEX_VERSION}}-Ubuntu-${{ matrix.release_num }}-x86_64.deb mv build/DebDir.deb imhex-${{ env.IMHEX_VERSION }}-Ubuntu-${{ matrix.release_num }}-x86_64.deb
- name: ⬆️ Upload DEB - name: ⬆️ Upload DEB
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
@ -582,7 +582,7 @@ jobs:
mkdir -p build mkdir -p build
cd build cd build
CC=gcc CXX=g++ cmake -G "Ninja" \ CC=gcc CXX=g++ cmake -G "Ninja" \
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \ -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \
-DCMAKE_INSTALL_PREFIX="/usr" \ -DCMAKE_INSTALL_PREFIX="/usr" \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \ -DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
@ -607,7 +607,7 @@ jobs:
- name: ✒️ Prepare PKGBUILD - name: ✒️ Prepare PKGBUILD
run: | run: |
cp dist/Arch/PKGBUILD build cp dist/Arch/PKGBUILD build
sed -i 's/%version%/${{env.IMHEX_VERSION}}/g' build/PKGBUILD sed -i 's/%version%/${{ env.IMHEX_VERSION }}/g' build/PKGBUILD
# makepkg doesn't want to run as root, so I had to chmod 777 all over # makepkg doesn't want to run as root, so I had to chmod 777 all over
- name: 📦 Package ArchLinux .pkg.tar.zst - name: 📦 Package ArchLinux .pkg.tar.zst
@ -617,16 +617,16 @@ jobs:
# the name is a small trick to make makepkg recognize it as the source # 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 # else, it would try to download the file from the release
tar -cvf imhex-${{env.IMHEX_VERSION}}-ArchLinux-x86_64.pkg.tar.zst -C installDir . tar -cvf imhex-${{ env.IMHEX_VERSION }}-ArchLinux-x86_64.pkg.tar.zst -C installDir .
chmod -R 777 . chmod -R 777 .
sudo -u nobody makepkg sudo -u nobody makepkg
# Replace the old file # Replace the old file
rm imhex-${{env.IMHEX_VERSION}}-ArchLinux-x86_64.pkg.tar.zst rm imhex-${{ env.IMHEX_VERSION }}-ArchLinux-x86_64.pkg.tar.zst
rm *imhex-bin-debug* # rm debug package which is created for some reason rm *imhex-bin-debug* # rm debug package which is created for some reason
mv *.pkg.tar.zst imhex-${{env.IMHEX_VERSION}}-ArchLinux-x86_64.pkg.tar.zst mv *.pkg.tar.zst imhex-${{ env.IMHEX_VERSION }}-ArchLinux-x86_64.pkg.tar.zst
- name: ⬆️ Upload imhex-archlinux.pkg.tar.zst - name: ⬆️ Upload imhex-archlinux.pkg.tar.zst
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
@ -634,7 +634,7 @@ jobs:
if-no-files-found: error if-no-files-found: error
name: ArchLinux .pkg.tar.zst x86_64 name: ArchLinux .pkg.tar.zst x86_64
path: | path: |
build/imhex-${{env.IMHEX_VERSION}}-ArchLinux-x86_64.pkg.tar.zst build/imhex-${{ env.IMHEX_VERSION }}-ArchLinux-x86_64.pkg.tar.zst
# RPM distro builds # RPM distro builds
rpm-build: rpm-build:
@ -714,7 +714,7 @@ jobs:
- name: ✒️ Modify spec file - name: ✒️ Modify spec file
run: | run: |
sed -i \ sed -i \
-e 's/Version: VERSION$/Version: ${{env.IMHEX_VERSION}}/g' \ -e 's/Version: VERSION$/Version: ${{ env.IMHEX_VERSION }}/g' \
-e 's/IMHEX_OFFLINE_BUILD=ON/IMHEX_OFFLINE_BUILD=OFF/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 '/IMHEX_OFFLINE_BUILD=OFF/a -D IMHEX_PATTERNS_PULL_MASTER=ON \\' \
-e '/BuildRequires: cmake/a BuildRequires: git-core' \ -e '/BuildRequires: cmake/a BuildRequires: git-core' \
@ -745,8 +745,8 @@ jobs:
- name: 🟩 Move and rename finished RPM - name: 🟩 Move and rename finished RPM
run: | run: |
mv $GITHUB_WORKSPACE/results_imhex/${{env.IMHEX_VERSION}}/*/imhex-${{env.IMHEX_VERSION}}-0.*.x86_64.rpm \ 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 $GITHUB_WORKSPACE/imhex-${{ env.IMHEX_VERSION }}-${{ matrix.name }}-${{ matrix.release_num }}-x86_64.rpm
- name: ⬆️ Upload RPM - name: ⬆️ Upload RPM
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
@ -754,4 +754,4 @@ jobs:
if-no-files-found: error if-no-files-found: error
name: ${{ matrix.name }} ${{ matrix.release_num }} RPM x86_64 name: ${{ matrix.name }} ${{ matrix.release_num }} RPM x86_64
path: | path: |
imhex-${{env.IMHEX_VERSION}}-${{matrix.name}}-${{matrix.release_num}}-x86_64.rpm imhex-${{ env.IMHEX_VERSION }}-${{ matrix.name }}-${{ matrix.release_num }}-x86_64.rpm