diff --git a/.github/workflows/build-check.yml b/.github/workflows/build-check.yml deleted file mode 100644 index e97527f25..000000000 --- a/.github/workflows/build-check.yml +++ /dev/null @@ -1,92 +0,0 @@ -name: Compile check - -# Controls when the action will run. -on: - # Triggers the workflow for pushes to master or development, for pull request events, and for the merge queue - push: - branches: [master, development] - pull_request: - types: [opened, reopened, ready_for_review, synchronize] - merge_group: - types: [checks_requested] - - workflow_dispatch: - -jobs: - build-linux: - # The type of runner that the job will run on - runs-on: ubuntu-latest - - - # Steps represent a sequence of tasks that will be executed as part of the job - steps: - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v3 - - uses: actions/setup-python@v3 - - - name: Install Dependencies - run: | - sudo apt-get update -yq - sudo apt-get install --no-install-recommends liballegro4-dev libloadpng4-dev libflac++-dev luajit-5.1-dev liblua5.2-dev libminizip-dev liblz4-dev libpng++-dev libx11-dev libboost-dev libtbb-dev libsdl2-dev libopengl-dev ninja-build - sudo pip install meson==0.60.3 - - - name: Install Clang - # You may pin to the exact commit or the version. - # uses: egor-tensin/setup-clang@d16e36d5f8a7eb00aa6627c1a536d94dfc4a913d - uses: egor-tensin/setup-clang@v1 - with: - # Set up cc/c++ executables - cc: 1 # optional, default is 1 - - - name: Build - env: - CC: "gcc" - CXX: "g++" - run: | - meson setup --buildtype=debug -Ddebug_type=full build - meson compile -C build - - build-macos: - runs-on: macos-latest - - - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v3 - - - name: Install Dependencies - run: | - brew install pkg-config tbb sdl2 minizip lz4 flac luajit lua@5.1 libpng gcc@12 ninja meson - - - name: Build - env: - CC: "gcc-12" - CXX: "g++-12" - run: | - meson setup --buildtype=debug -Ddebug_type=full build - meson compile -C build - - build-windows: - env: - # Path to the solution file relative to the root of the project. - SOLUTION_FILE_PATH: RTEA.sln - - # Configuration type to build. - # You can convert this to a build matrix if you need coverage of multiple configuration types. - # https://docs.github.com/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix - BUILD_CONFIGURATION: "Final" - - runs-on: windows-latest - - steps: - - uses: actions/checkout@v3 - - - name: Add MSBuild to PATH - uses: microsoft/setup-msbuild@v1 - - - - name: Build - working-directory: ${{env.GITHUB_WORKSPACE}} - # Add additional options to the MSBuild command line here (like platform or verbosity level). - # See https://docs.microsoft.com/visualstudio/msbuild/msbuild-command-line-reference - run: msbuild /m /p:Configuration="${{env.BUILD_CONFIGURATION}}" ${{env.SOLUTION_FILE_PATH}} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..854fcecb8 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,25 @@ +name: Continuous Integration + +on: + # Triggers the workflow for pushes to development, for pull request events, and for the merge queue + push: + branches: [development] + pull_request: + types: [opened, reopened, ready_for_review, synchronize] + merge_group: + types: [checks_requested] + + workflow_dispatch: + +# Cancel in-progress runs if newer changes to the same branch/PR are pushed. +concurrency: + group: ci-${{ github.head_ref || github.ref }} + cancel-in-progress: true + +jobs: + meson: + uses: ./.github/workflows/meson.yml + + msbuild: + uses: ./.github/workflows/msbuild.yml + diff --git a/.github/workflows/master_build.yaml b/.github/workflows/master_build.yaml new file mode 100644 index 000000000..e613f5ab9 --- /dev/null +++ b/.github/workflows/master_build.yaml @@ -0,0 +1,27 @@ + +name: Master Build + +on: + # Triggers the workflow for pushes to master + push: + branches: [master] + + workflow_dispatch: + +# Cancel in-progress runs if newer changes to the same branch/PR are pushed. +concurrency: + group: ci-${{ github.head_ref || github.ref }} + cancel-in-progress: true + +# Build the game on all platforms and store build artefacts of both jobs +jobs: + meson: + uses: ./.github/workflows/meson.yml + with: + upload_artefacts: true + + msbuild: + uses: ./.github/workflows/msbuild.yml + with: + upload_artefacts: true + diff --git a/.github/workflows/meson.yml b/.github/workflows/meson.yml index 2ccad5aad..0da594096 100644 --- a/.github/workflows/meson.yml +++ b/.github/workflows/meson.yml @@ -1,22 +1,57 @@ name: Meson Build (Linux, macOS) -# Controls when the action will run. + on: - # Triggers the workflow on push or pull request events but only for the development branch - push: - branches: [ master, development ] - release: + # Triggers the workflow when manually dispatched workflow_dispatch: + inputs: + upload_artefacts: + description: "Upload build artefacts" + type: boolean + required: false + default: false + build_type: + description: "Build Configuration" + type: choice + required: false + default: "release" + options: + - "release" + - "debug" + debug_level: + description: "Debug Level" + type: choice + required: false + default: "release" + options: + - "release" + - "minimal" + - "full" + + # Triggers the workflow when called by a top-level workflow + workflow_call: + inputs: + upload_artefacts: + type: boolean + required: false + default: false + build_type: # "release" | "debug" + type: string + required: false + default: "release" + debug_level: # "full" | "minimal" | "release" + type: string + required: false + default: "release" + +env: + MESON_VERSION: "0.60.3" - -# A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: - # This workflow contains a single job called "build" - build-release-linux: - # The type of runner that the job will run on - runs-on: ubuntu-latest + build-linux: + runs-on: ubuntu-latest + name: Linux Build - # Steps represent a sequence of tasks that will be executed as part of the job steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - uses: actions/checkout@v3 @@ -26,36 +61,44 @@ jobs: run: | sudo apt-get update -yq sudo apt-get install --no-install-recommends wget liballegro4-dev libloadpng4-dev libflac++-dev luajit-5.1-dev liblua5.2-dev libminizip-dev liblz4-dev libpng++-dev libx11-dev libboost-dev libtbb-dev libsdl2-dev libopengl-dev libfuse2 ninja-build - sudo pip install meson==0.60.0 + sudo pip install meson==${{env.MESON_VERSION}} - - name: Install Clang - # You may pin to the exact commit or the version. - # uses: egor-tensin/setup-clang@d16e36d5f8a7eb00aa6627c1a536d94dfc4a913d - uses: egor-tensin/setup-clang@v1 - with: - # Set up cc/c++ executables - cc: 1 # optional, default is 1 + - name: Setup Meson + env: + CC: "gcc" + CXX: "g++" + run: | + meson setup --buildtype=${{inputs.build_type}} -Ddebug_type=${{inputs.debug_level}} build + - name: Configure for AppImage + if: ${{inputs.upload_artefacts}} + env: + CC: "gcc" + CXX: "g++" + run: meson configure -Dinstall_data=false -Dinstall_runner=false -Dfmod_dir=/usr/lib/ --prefix=/usr/ build + - name: Build env: CC: "gcc" CXX: "g++" run: | - meson setup --buildtype=release -Dinstall_data=false -Dinstall_runner=false -Dfmod_dir=/usr/lib/ --prefix=/usr/ build meson compile -C build - + - name: Create AppDir + if: ${{inputs.upload_artefacts}} run: | echo "Setting output prefix" DESTDIR=${GITHUB_WORKSPACE}/build/AppDir meson install -C $GITHUB_WORKSPACE"/build" - name: Download linuxdeploy + if: ${{inputs.upload_artefacts}} working-directory: ${{env.GITHUB_WORKSPACE}} run: | wget https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage -O lindeploy chmod +x lindeploy - name: Create AppImage + if: ${{inputs.upload_artefacts}} working-directory: ${{env.GITHUB_WORKSPACE}} env: LD_LIBRARY_PATH: ./external/lib/linux/x86_64/ @@ -65,13 +108,16 @@ jobs: ./lindeploy --appdir=build/AppDir --output appimage - name: Upload Appimage + if: ${{inputs.upload_artefacts}} uses: actions/upload-artifact@v3 with: name: CortexCommand (Linux) path: CortexCommand.AppImage + if-no-files-found: error - build-release-macos: + build-macos: runs-on: macos-latest + name: MacOS Build steps: - uses: actions/checkout@v3 @@ -79,19 +125,23 @@ jobs: - name: Install Dependencies run: | - brew install pkg-config tbb sdl2 minizip lz4 flac luajit lua@5.1 libpng gcc ninja meson - + brew install pkg-config tbb sdl2 minizip lz4 flac luajit lua@5.1 libpng gcc@12 ninja meson + - name: Build env: CC: "gcc-12" CXX: "g++-12" LDFLAGS: "-static-libgcc -static-libstdc++" run: | - meson setup --buildtype=release -Ddebug_type=release build + meson setup --buildtype=${{inputs.build_type}} -Ddebug_type=${{inputs.debug_level}} build meson compile -C build - name: Artifact Deploy + if: ${{inputs.upload_artefacts}} uses: actions/upload-artifact@v3 with: name: CortexCommand (macOS) - path: build/CortexCommand + path: | + build/CortexCommand + build/CortexCommand_debug + if-no-files-found: error diff --git a/.github/workflows/msbuild.yml b/.github/workflows/msbuild.yml index 5e120dfc4..d0b9bfc2f 100644 --- a/.github/workflows/msbuild.yml +++ b/.github/workflows/msbuild.yml @@ -1,24 +1,51 @@ name: Windows Build on: - push: - branches: - - master - - development - + # Triggers the workflow when manually dispatched workflow_dispatch: + inputs: + upload_artefacts: + description: "Upload build artefacts" + type: boolean + required: false + default: false + build_configuration: + description: "Build Configuration" + type: choice + required: false + default: "Final" + options: + - "Final" + - "Debug Release" + - "Debug Minimal" + - "Debug Full" + + # Triggers the workflow when called by a top-level workflow + workflow_call: + inputs: + upload_artefacts: + type: boolean + required: false + default: false + build_configuration: # "Final" | "Debug Release" | "Debug Minimal" | "Debug Full" + type: string + required: false + default: "Final" env: # Path to the solution file relative to the root of the project. SOLUTION_FILE_PATH: RTEA.sln - - # Configuration type to build. - # You can convert this to a build matrix if you need coverage of multiple configuration types. - # https://docs.github.com/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix - BUILD_CONFIGURATION: "Final" + NAME_MAPPING: | + { + "Final": "Cortex Command.exe", + "Debug Release": "Cortex Command.debug.release.exe", + "Debug Minimal": "Cortex Command.debug.minimal.exe", + "Debug Full": "Cortex Command.debug.full.exe" + } jobs: build: + name: Windows Build runs-on: windows-latest steps: @@ -31,11 +58,19 @@ jobs: working-directory: ${{env.GITHUB_WORKSPACE}} # Add additional options to the MSBuild command line here (like platform or verbosity level). # See https://docs.microsoft.com/visualstudio/msbuild/msbuild-command-line-reference - run: msbuild /m /p:Configuration="${{env.BUILD_CONFIGURATION}}" ${{env.SOLUTION_FILE_PATH}} + run: msbuild /m /p:Configuration="${{inputs.build_configuration}}" ${{env.SOLUTION_FILE_PATH}} + + - name: Determine executable name + id: executable_name + if: ${{inputs.upload_artefacts}} + run: | + echo "EXECUTABLE_NAME=${{ fromJson(env.NAME_MAPPING)[inputs.build_configuration] }}" >> "$GITHUB_OUTPUT" + shell: bash - - name: Upload Artifact2 + - name: Upload Artifact + if: ${{inputs.upload_artefacts}} uses: actions/upload-artifact@v3 with: - name: Cortex Command.exe - path: D:/a/Cortex-Command-Community-Project-Source/Cortex-Command-Community-Project-Data/Cortex Command x64.exe - if-no-files-found: warn + name: ${{ steps.executable_name.outputs.EXECUTABLE_NAME }} + path: D:/a/Cortex-Command-Community-Project-Source/Cortex-Command-Community-Project-Data/${{ steps.executable_name.outputs.EXECUTABLE_NAME }} + if-no-files-found: error