diff --git a/.github/workflows/main-1.0.0.yaml b/.github/workflows/main-1.0.0.yaml index 70898945..1772f6e5 100644 --- a/.github/workflows/main-1.0.0.yaml +++ b/.github/workflows/main-1.0.0.yaml @@ -8,7 +8,6 @@ on: paths-ignore: - '**/*.md' #- '**/*.toml' - - '.github/workflows/ubuntu.yaml' branches: - main tags: @@ -17,7 +16,6 @@ on: paths-ignore: - '**/*.md' #- '**/*.toml' - - '.github/workflows/ubuntu.yaml' branches: - main @@ -34,8 +32,235 @@ env: GIT_REDIRECT_STDERR: 2>&1 jobs: - Field-Map-Editor: + prepare: + runs-on: ubuntu-latest + + outputs: + build_version: ${{ steps.vars.outputs.build_version }} + release_version: ${{ steps.vars.outputs.release_version }} + is_canary: ${{ steps.vars.outputs.is_canary }} + is_release: ${{ steps.vars.outputs.is_release }} + changelog_version: ${{ steps.vars.outputs.changelog_version }} + + steps: + - id: vars + shell: bash + run: | + BRANCH="${GITHUB_REF}" + BUILD_VERSION="1.0.5.${GITHUB_RUN_NUMBER}" + + IS_CANARY=false + IS_RELEASE=false + CHANGELOG_VERSION="0" + + if [[ "$BRANCH" == "refs/heads/main" || "$BRANCH" == "refs/tags/canary" ]]; then + IS_CANARY=true + IS_RELEASE=true + + elif [[ "$BRANCH" == refs/tags/* ]]; then + # emulate your substring logic + BASE="${BUILD_VERSION%.*}" + CHANGELOG_VERSION="${BASE//./}" + BUILD_VERSION="${BASE}.0" + IS_RELEASE=true + fi + + RELEASE_VERSION="$BUILD_VERSION" + + echo "Branch: $BUILD_BRANCH" + echo "Build Version: $BUILD_VERSION" + echo "Release Version: $RELEASE_VERSION" + echo "Is Canary: $IS_CANARY" + echo "Is Release: $IS_RELEASE" + echo "Changelog Version: $CHANGELOG_VERSION" + echo "build_version=$BUILD_VERSION" >> $GITHUB_OUTPUT + echo "release_version=$RELEASE_VERSION" >> $GITHUB_OUTPUT + echo "is_canary=$IS_CANARY" >> $GITHUB_OUTPUT + echo "is_release=$IS_RELEASE" >> $GITHUB_OUTPUT + echo "changelog_version=$CHANGELOG_VERSION" >> $GITHUB_OUTPUT + linux-build: + runs-on: ubuntu-latest + needs: prepare + env: + _RELEASE_CONFIGURATION_PRESET: Release-linux # override for Linux + timeout-minutes: 1440 + steps: + - name: Check Ubuntu Version + run: lsb_release -a + - name: Set Git Config + run: | + git config --global core.autocrlf false + git config --global core.filemode false + git config --global core.longpaths true + - name: Checkout + uses: actions/checkout@v4 + with: + submodules: recursive + fetch-depth: 0 + - name: Install Dependencies + run: | + sudo apt-get update + sudo add-apt-repository universe -y + sudo apt-get update + sudo apt-get install -y ninja-build libxmu-dev libxi-dev libgl-dev libxrandr-dev libxinerama-dev libxcursor-dev gcc-14 g++-14 \ + mono-complete + # GCC 14 + sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 100 + sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-14 100 + # GCC 13 + sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 50 + sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-13 50 + g++ --version + + - name: Check Disk Space + run: df -h + - name: Bootstrap vcpkg + run: ${{github.workspace}}/vcpkg/bootstrap-vcpkg.sh + + - name: Cache vcpkg binaries + uses: actions/cache@v4 + with: + path: ~/.cache/vcpkg/archives + key: vcpkg-${{ runner.os }}-${{ hashFiles('vcpkg.json') }} + restore-keys: | + vcpkg-${{ runner.os }}- + + - name: Integrate vcpkg + run: ${{ github.workspace }}/vcpkg/vcpkg integrate install + + - name: Configure CMake + run: cmake --preset "${{ env._RELEASE_CONFIGURATION_PRESET }}" + + - name: Build + run: cmake --build --preset "${{ env._RELEASE_CONFIGURATION_PRESET }}" + + - name: Test + run: cmake --build --preset "${{ env._RELEASE_CONFIGURATION_PRESET }}" --target test + + - name: Build AppImage + run: | + set -euo pipefail + + APPDIR=".appdir" + DIST_DIR=".dist" + BUILD_DIR=".build/bin" + EXECUTABLE="field-map-editor" + DESKTOP_FILE="field-map-editor.desktop" + ICON_FILE="res/icon.png" + RESOURCE_DIRS=("res" "fonts") + + mkdir -p "$APPDIR/usr/bin" + mkdir -p "$APPDIR/usr/share/applications" + mkdir -p "$APPDIR/usr/share/icons/hicolor/256x256/apps" + mkdir -p "$DIST_DIR" + + # Copy executable + cp "$BUILD_DIR/$EXECUTABLE" "$APPDIR/usr/bin/" + + # Copy resources + for dir in "${RESOURCE_DIRS[@]}"; do + if [ -d "$dir" ]; then + cp -r "$dir" "$APPDIR/usr/bin/" + else + echo "Warning: resource directory '$dir' not found" + fi + done + + # Desktop file + cat > "$APPDIR/usr/share/applications/$DESKTOP_FILE" < "$APPDIR/AppRun" <&1 - -jobs: - Field-Map-Editor: - runs-on: ubuntu-latest - timeout-minutes: 1440 - steps: - - name: Check Ubuntu Version - run: lsb_release -a - - name: Set Git Config - run: | - git config --global core.autocrlf false - git config --global core.filemode false - git config --global core.longpaths true - - name: Checkout - uses: actions/checkout@v4 - with: - submodules: recursive - fetch-depth: 0 - - name: Install Dependencies - run: | - sudo apt-get update - sudo add-apt-repository universe -y - sudo apt-get update - sudo apt-get install -y ninja-build libxmu-dev libxi-dev libgl-dev libxrandr-dev libxinerama-dev libxcursor-dev gcc-14 g++-14 \ - mono-complete - # GCC 14 - sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 100 - sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-14 100 - # GCC 13 - sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 50 - sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-13 50 - g++ --version - - - name: Check Disk Space - run: df -h - - name: Bootstrap vcpkg - run: ${{github.workspace}}/vcpkg/bootstrap-vcpkg.sh - - - name: Cache vcpkg binaries - uses: actions/cache@v4 - with: - path: ~/.cache/vcpkg/archives - key: vcpkg-${{ runner.os }}-${{ hashFiles('vcpkg.json') }} - restore-keys: | - vcpkg-${{ runner.os }}- - - - name: Integrate vcpkg - run: ${{ github.workspace }}/vcpkg/vcpkg integrate install - - - name: Configure CMake - run: cmake --preset "${{ env._RELEASE_CONFIGURATION_PRESET }}" - - - name: Build - run: cmake --build --preset "${{ env._RELEASE_CONFIGURATION_PRESET }}" - - - name: Test - run: cmake --build --preset "${{ env._RELEASE_CONFIGURATION_PRESET }}" --target test \ No newline at end of file diff --git a/.gitignore b/.gitignore index 6d7da63a..fb99daf4 100644 --- a/.gitignore +++ b/.gitignore @@ -452,3 +452,5 @@ compile_commands.json .install .DS_Store fonts/ +*.AppImage +AppDir/* diff --git a/README.md b/README.md index a2a17fcf..a1119826 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@ # Field Map Editor -[![Windows Build](https://github.com/Sebanisu/Field-Map-Editor/actions/workflows/main-1.0.0.yaml/badge.svg)](https://github.com/Sebanisu/Field-Map-Editor/actions/workflows/main-1.0.0.yaml) -[![Linux Build](https://github.com/Sebanisu/Field-Map-Editor/actions/workflows/ubuntu.yaml/badge.svg)](https://github.com/Sebanisu/Field-Map-Editor/actions/workflows/ubuntu.yaml) +[![Windows / Linux Build](https://github.com/Sebanisu/Field-Map-Editor/actions/workflows/main-1.0.0.yaml/badge.svg)](https://github.com/Sebanisu/Field-Map-Editor/actions/workflows/main-1.0.0.yaml) [![C++ 23](https://img.shields.io/badge/C++%20-23-ff69b4.svg)](https://en.cppreference.com/w/cpp/23) [![Contributions Welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](https://github.com/Sebanisu/Field-Map-Editor/pulls)