diff --git a/.github/workflows/appimage.yml b/.github/workflows/appimage.yml index dc0a5792..10427610 100644 --- a/.github/workflows/appimage.yml +++ b/.github/workflows/appimage.yml @@ -14,6 +14,8 @@ on: jobs: build-appimage: + # Only run on GitHub, skip on Gitea + if: github.server_url == 'https://github.com' strategy: matrix: @@ -31,12 +33,7 @@ jobs: sudo apt-get update sudo apt-get install -y build-essential libglfw3-dev libglfw3 libglew-dev libglew2.2 \ libglm-dev libpng-dev libopenal-dev libluajit-5.1-dev libvorbis-dev \ - libcurl4-openssl-dev libgtest-dev squashfs-tools valgrind wget - # Install CMake >= 3.26 - wget https://github.com/Kitware/CMake/releases/download/v3.27.9/cmake-3.27.9-linux-x86_64.sh - chmod +x cmake-3.27.9-linux-x86_64.sh - sudo ./cmake-3.27.9-linux-x86_64.sh --skip-license --prefix=/usr/local - rm cmake-3.27.9-linux-x86_64.sh + libcurl4-openssl-dev libgtest-dev cmake squashfs-tools valgrind # fix luajit paths sudo ln -s /usr/lib/x86_64-linux-gnu/libluajit-5.1.a /usr/lib/x86_64-linux-gnu/liblua5.1.a sudo ln -s /usr/include/luajit-2.1 /usr/include/lua @@ -67,4 +64,4 @@ jobs: - uses: actions/upload-artifact@v4 with: name: AppImage - path: './*.AppImage*' + path: './*.AppImage*' \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6d6c9c9b..ec379aeb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,8 +8,10 @@ on: jobs: build: + # Only run on GitHub, skip on Gitea + if: github.server_url == 'https://github.com' name: Build uses: ./.github/workflows/cmake.yml with: build_type: Release - run_tests: true + run_tests: true \ No newline at end of file diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index ce120980..cce4136f 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -19,6 +19,8 @@ on: jobs: build: + # Only run on GitHub, skip on Gitea + if: github.server_url == 'https://github.com' # The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac. # You can convert this to a matrix build if you need cross-platform coverage. # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix @@ -39,12 +41,7 @@ jobs: # make && make install INSTALL_INC=/usr/include/lua run: | sudo apt-get update - sudo apt-get install -y build-essential libglfw3-dev libglfw3 libglew-dev libglm-dev libpng-dev libopenal-dev libluajit-5.1-dev libvorbis-dev libgtest-dev libcurl4-openssl-dev wget - # Install CMake >= 3.26 - wget https://github.com/Kitware/CMake/releases/download/v3.27.9/cmake-3.27.9-linux-x86_64.sh - chmod +x cmake-3.27.9-linux-x86_64.sh - sudo ./cmake-3.27.9-linux-x86_64.sh --skip-license --prefix=/usr/local - rm cmake-3.27.9-linux-x86_64.sh + sudo apt-get install libglfw3-dev libglfw3 libglew-dev libglm-dev libpng-dev libopenal-dev libluajit-5.1-dev libvorbis-dev libgtest-dev libcurl4-openssl-dev # fix luajit paths sudo ln -s /usr/lib/x86_64-linux-gnu/libluajit-5.1.a /usr/lib/x86_64-linux-gnu/liblua-5.1.a sudo ln -s /usr/include/luajit-2.1 /usr/include/lua @@ -78,4 +75,4 @@ jobs: name: VoxelEngine path: | VoxelEngine - res/* + res/* \ No newline at end of file diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 1511f1b8..05a7e159 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -14,16 +14,11 @@ on: jobs: build-dmg: + # Only run on GitHub, skip on Gitea + if: github.server_url == 'https://github.com' runs-on: macos-latest steps: - - name: Check if running on macOS - run: | - if [[ "$(uname)" != "Darwin" ]]; then - echo "::error::This workflow requires a real macOS runner, not Docker" - exit 1 - fi - - uses: actions/checkout@v2 with: submodules: 'true' @@ -65,4 +60,4 @@ jobs: uses: actions/upload-artifact@v4 with: name: VoxelEngineMacOs - path: VoxelEngineMacApp.dmg + path: VoxelEngineMacApp.dmg \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 90545df2..34c61166 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,5 +1,4 @@ -name: Build and Release -run-name: ${{ github.actor }} preparing release +name: Release on: push: tags: @@ -14,7 +13,31 @@ env: RELEASE_VERSION: ${{ github.event.inputs.version || github.ref_name || 'testrelease' }} BRANCH_NAME: ${{ github.event_name == 'workflow_dispatch' && github.ref_name || 'main' }} jobs: + # Gitea job - create draft release on tag push + gitea-draft-release: + if: github.server_url != 'https://github.com' + runs-on: ubuntu-latest + steps: + - name: Create Draft Release on Gitea + uses: softprops/action-gh-release@v2 + with: + tag_name: ${{ github.ref_name }} + name: VoxelCore ${{ github.ref_name }} + draft: true + body: | + ## VoxelCore Release ${{ github.ref_name }} + + ### Downloads + Артефакты будут загружены вручную после сборки на GitHub. + + --- + **Full Changelog**: https://git.pyserve.org/PulseStudio/VoxelEngine/commits/tag/${{ github.ref_name }} + token: ${{ secrets.GITHUB_TOKEN }} + + # GitHub jobs - full build and release prepare: + # Only run on GitHub, skip on Gitea + if: github.server_url == 'https://github.com' runs-on: ubuntu-latest steps: - run: echo "exists just for outputs" @@ -25,6 +48,11 @@ jobs: uses: ./.github/workflows/appimage.yml with: build_name: '${{ needs.prepare.outputs.build_name }}' + build_macos: + needs: [prepare] + uses: ./.github/workflows/macos.yml + with: + build_name: '${{ needs.prepare.outputs.build_name }}' build_windows: needs: [prepare] uses: ./.github/workflows/windows-clang.yml @@ -32,7 +60,7 @@ jobs: build_name: '${{ needs.prepare.outputs.build_name }}' publish_release: runs-on: ubuntu-latest - needs: [build_linux, build_windows] + needs: [build_linux, build_macos, build_windows] steps: - name: Checkout Release Branch uses: actions/checkout@v4 @@ -47,38 +75,26 @@ jobs: mkdir release mv ./artifacts/AppImage/VoxelCore-latest-x86_64.AppImage \ ./release/voxelcore-${RELEASE_VERSION}_x86-64.AppImage + mv ./artifacts/VoxelEngineMacOs/VoxelEngineMacApp.dmg \ + ./release/voxelcore-${RELEASE_VERSION}_macos.dmg (cd ./artifacts/Windows-Build && zip -r ../../release/voxelcore-${RELEASE_VERSION}_win64.zip .) ls -la ./release tree ./release - name: Create Tag - if: github.event_name == 'workflow_dispatch' run: | - git config --local user.email "action@gitea.com" - git config --local user.name "Gitea Action" + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" TAG_NAME="v${RELEASE_VERSION}" git tag -a "${TAG_NAME}" -m "Automated release tag ${TAG_NAME}" git push origin "${TAG_NAME}" - - name: Create Release with assets - uses: softprops/action-gh-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Create Release Draft + uses: softprops/action-gh-release@v2 with: tag_name: v${{ env.RELEASE_VERSION }} - name: VoxelCore v${{ env.RELEASE_VERSION }} - body: | - ## VoxelCore Release ${{ env.RELEASE_VERSION }} - - ### Downloads - - **Linux**: voxelcore-${{ env.RELEASE_VERSION }}_x86-64.AppImage - - **Windows**: voxelcore-${{ env.RELEASE_VERSION }}_win64.zip - - ### Installation - Download the appropriate file for your platform and run it. - - --- - **Full Changelog**: https://git.pyserve.org/PulseStudio/VoxelEngine/compare/v0.0.0...v${{ env.RELEASE_VERSION }} draft: true - prerelease: false files: | ./release/* - token: ${{ secrets.GITHUB_TOKEN }} - + generate_release_notes: true diff --git a/.github/workflows/windows-clang.yml b/.github/workflows/windows-clang.yml index 5574d148..dfd52d00 100644 --- a/.github/workflows/windows-clang.yml +++ b/.github/workflows/windows-clang.yml @@ -1,4 +1,4 @@ -name: Windows Build (Cross-compile) +name: Windows Build (CLang) on: push: @@ -14,61 +14,64 @@ on: jobs: build-windows: - runs-on: ubuntu-latest + # Only run on GitHub, skip on Gitea + if: github.server_url == 'https://github.com' + + strategy: + matrix: + include: + - os: windows-latest + compiler: clang + + runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v2 with: submodules: 'true' - - - name: Install cross-compilation tools - run: | - sudo apt-get update - sudo apt-get install -y mingw-w64 cmake wget git zip - - - name: Install CMake >= 3.26 - run: | - wget https://github.com/Kitware/CMake/releases/download/v3.27.9/cmake-3.27.9-linux-x86_64.sh - chmod +x cmake-3.27.9-linux-x86_64.sh - sudo ./cmake-3.27.9-linux-x86_64.sh --skip-license --prefix=/usr/local - rm cmake-3.27.9-linux-x86_64.sh - + - uses: msys2/setup-msys2@v2 + id: msys2 + name: Setup MSYS2 + with: + msystem: clang64 + install: >- + mingw-w64-clang-x86_64-toolchain + mingw-w64-clang-x86_64-cmake + git - name: Set up vcpkg + shell: msys2 {0} run: | - git clone https://github.com/microsoft/vcpkg.git - cd vcpkg - ./bootstrap-vcpkg.sh - cd .. - - - name: Configure and build project + git clone https://github.com/microsoft/vcpkg.git + cd vcpkg + ./bootstrap-vcpkg.bat + ./vcpkg integrate install + cd .. + - name: Configure project with CMake and vcpkg env: - VCPKG_DEFAULT_TRIPLET: x64-mingw-static - VCPKG_DEFAULT_HOST_TRIPLET: x64-linux + VCPKG_DEFAULT_TRIPLET: x64-mingw-static + VCPKG_DEFAULT_HOST_TRIPLET: x64-mingw-static + shell: msys2 {0} run: | - export VCPKG_ROOT=$(pwd)/vcpkg - mkdir build - cd build - cmake -DCMAKE_TOOLCHAIN_FILE=$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake \ - -DVCPKG_TARGET_TRIPLET=x64-mingw-static \ - -DCMAKE_SYSTEM_NAME=Windows \ - -DCMAKE_C_COMPILER=x86_64-w64-mingw32-gcc \ - -DCMAKE_CXX_COMPILER=x86_64-w64-mingw32-g++ \ - -DCMAKE_RC_COMPILER=x86_64-w64-mingw32-windres \ - -DCMAKE_BUILD_TYPE=Release \ - -DVC_BUILD_NAME="${{ inputs.build_name }}" \ - .. - cmake --build . --config Release - + export VCPKG_ROOT=$(pwd)/vcpkg + mkdir build + cd build + cmake -G "MinGW Makefiles" -DVCPKG_TARGET_TRIPLET=x64-mingw-static -DVC_BUILD_NAME="${{ inputs.build_name }}" -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=./vcpkg/scripts/buildsystems/vcpkg.cmake .. + cmake --build . --config Release - name: Package for Windows run: | mkdir packaged mkdir packaged/res - cp build/VoxelEngine.exe packaged/VoxelCore.exe || cp build/VoxelEngine packaged/VoxelCore.exe - cp build/vctest/vctest.exe packaged/ || cp build/vctest/vctest packaged/vctest.exe - cp build/*.dll packaged/ 2>/dev/null || true + cp build/VoxelEngine.exe packaged/ + cp build/vctest/vctest.exe packaged/ + cp build/*.dll packaged/ cp -r build/res/* packaged/res/ - + mv packaged/VoxelEngine.exe packaged/VoxelCore.exe - uses: actions/upload-artifact@v4 with: name: Windows-Build path: 'packaged/*' + - name: Run engine tests + shell: msys2 {0} + working-directory: ${{ github.workspace }} + run: | + packaged/vctest.exe -e packaged/VoxelCore.exe -d dev/tests -u build \ No newline at end of file diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index afeed757..c155a9a1 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -8,6 +8,7 @@ on: jobs: build-windows: + if: github.server_url == 'https://github.com' strategy: matrix: @@ -50,4 +51,4 @@ jobs: - uses: actions/upload-artifact@v4 with: name: Windows-Build - path: 'packaged/*' + path: 'packaged/*' \ No newline at end of file