summaryrefslogtreecommitdiff
path: root/meshmc/.github/actions/setup-dependencies
diff options
context:
space:
mode:
Diffstat (limited to 'meshmc/.github/actions/setup-dependencies')
-rw-r--r--meshmc/.github/actions/setup-dependencies/action.yml89
-rw-r--r--meshmc/.github/actions/setup-dependencies/linux/action.yml59
-rw-r--r--meshmc/.github/actions/setup-dependencies/macos/action.yml52
-rw-r--r--meshmc/.github/actions/setup-dependencies/windows/action.yml114
4 files changed, 314 insertions, 0 deletions
diff --git a/meshmc/.github/actions/setup-dependencies/action.yml b/meshmc/.github/actions/setup-dependencies/action.yml
new file mode 100644
index 0000000000..3245826768
--- /dev/null
+++ b/meshmc/.github/actions/setup-dependencies/action.yml
@@ -0,0 +1,89 @@
+name: Setup Dependencies
+description: Install and setup dependencies for building MeshMC
+
+inputs:
+ build-type:
+ description: Type for the build
+ required: true
+ default: Debug
+ artifact-name:
+ description: Name of the uploaded artifact
+ required: true
+ msystem:
+ description: MSYS2 subsystem to use
+ required: false
+ vcvars-arch:
+ description: Visual Studio architecture to use
+ required: false
+ qt-architecture:
+ description: Qt architecture
+ required: false
+ qt-version:
+ description: Version of Qt to use
+ required: true
+ github-token:
+ description: GitHub token for package feed authentication
+ required: false
+ default: ${{ github.token }}
+
+outputs:
+ build-type:
+ description: Type of build used
+ value: ${{ inputs.build-type }}
+ qt-version:
+ description: Version of Qt used
+ value: ${{ inputs.qt-version }}
+
+runs:
+ using: composite
+
+ steps:
+ - name: Setup Linux dependencies
+ if: ${{ runner.os == 'Linux' }}
+ uses: ./.github/actions/setup-dependencies/linux
+ with:
+ github-token: ${{ inputs.github-token }}
+
+ - name: Setup macOS dependencies
+ if: ${{ runner.os == 'macOS' }}
+ uses: ./.github/actions/setup-dependencies/macos
+ with:
+ build-type: ${{ inputs.build-type }}
+ github-token: ${{ inputs.github-token }}
+
+ - name: Setup Windows dependencies
+ if: ${{ runner.os == 'Windows' }}
+ uses: ./.github/actions/setup-dependencies/windows
+ with:
+ build-type: ${{ inputs.build-type }}
+ msystem: ${{ inputs.msystem }}
+ vcvars-arch: ${{ inputs.vcvars-arch }}
+ github-token: ${{ inputs.github-token }}
+
+ # TODO(@YongDo-Hyun): Get this working on MSYS2!
+ - name: Setup ccache
+ if: ${{ (runner.os != 'Windows' || inputs.msystem == '') && inputs.build-type == 'Debug' }}
+ uses: hendrikmuhs/ccache-action@v1.2.22
+ with:
+ variant: sccache
+ create-symlink: ${{ runner.os != 'Windows' }}
+ key: ${{ runner.os }}-${{ runner.arch }}-${{ inputs.artifact-name }}-sccache
+
+ - name: Use ccache on debug builds
+ if: ${{ inputs.build-type == 'Debug' }}
+ shell: bash
+ env:
+ # Only use ccache on MSYS2
+ CCACHE_VARIANT: ${{ (runner.os == 'Windows' && inputs.msystem != '') && 'ccache' || 'sccache' }}
+ run: |
+ echo "CMAKE_C_COMPILER_LAUNCHER=$CCACHE_VARIANT" >> "$GITHUB_ENV"
+ echo "CMAKE_CXX_COMPILER_LAUNCHER=$CCACHE_VARIANT" >> "$GITHUB_ENV"
+
+ - name: Install Qt
+ if: ${{ inputs.msystem == '' }}
+ uses: jurplel/install-qt-action@v4
+ with:
+ aqtversion: "==3.1.*"
+ version: ${{ inputs.qt-version }}
+ modules: qtimageformats qtnetworkauth qt5compat
+ cache: ${{ inputs.build-type == 'Debug' }}
diff --git a/meshmc/.github/actions/setup-dependencies/linux/action.yml b/meshmc/.github/actions/setup-dependencies/linux/action.yml
new file mode 100644
index 0000000000..46cb40e8a5
--- /dev/null
+++ b/meshmc/.github/actions/setup-dependencies/linux/action.yml
@@ -0,0 +1,59 @@
+name: Setup Linux dependencies
+description: Install and setup dependencies for building MeshMC
+
+inputs:
+ github-token:
+ description: GitHub token for authentication
+ required: true
+
+runs:
+ using: composite
+
+ steps:
+ - name: Install host dependencies
+ shell: bash
+ run: |
+ sudo apt-get -y update
+ sudo apt-get -y install \
+ dpkg-dev \
+ ninja-build extra-cmake-modules pkg-config scdoc \
+ cmark gamemode-dev libarchive-dev libcmark-dev libqrencode-dev zlib1g-dev \
+ libxcb-cursor-dev libtomlplusplus-dev libvulkan-dev
+
+ - name: Setup AppImage tooling
+ shell: bash
+ env:
+ GH_TOKEN: ${{ inputs.github-token }}
+ run: |
+ # Determinate AppImage architecture to use
+ dpkg_arch="$(dpkg-architecture -q DEB_HOST_ARCH_CPU)"
+ case "$dpkg_arch" in
+ "amd64")
+ APPIMAGE_ARCH="x86_64"
+ ;;
+ "arm64")
+ APPIMAGE_ARCH="aarch64"
+ ;;
+ *)
+ echo "# 🚨 The Debian architecture \"$deb_arch\" is not recognized!" >> "$GITHUB_STEP_SUMMARY"
+ exit 1
+ ;;
+ esac
+
+ gh release download \
+ --repo VHSgunzo/sharun \
+ --pattern "sharun-$APPIMAGE_ARCH-aio" \
+ --output ~/bin/sharun
+
+ # FIXME!: revert this to probonopd/go-appimage once https://github.com/probonopd/go-appimage/pull/377 is merged!
+ gh release download continuous \
+ --repo DioEgizio/go-appimage \
+ --pattern "mkappimage-*-$APPIMAGE_ARCH.AppImage" \
+ --output ~/bin/mkappimage
+
+ gh release download \
+ --repo AppImageCommunity/AppImageUpdate \
+ --pattern "AppImageUpdate-$APPIMAGE_ARCH.AppImage" \
+ --output ~/bin/AppImageUpdate.AppImage
+ chmod +x ~/bin/*
+ echo "$HOME/bin" >> "$GITHUB_PATH"
diff --git a/meshmc/.github/actions/setup-dependencies/macos/action.yml b/meshmc/.github/actions/setup-dependencies/macos/action.yml
new file mode 100644
index 0000000000..3eb5b37fa6
--- /dev/null
+++ b/meshmc/.github/actions/setup-dependencies/macos/action.yml
@@ -0,0 +1,52 @@
+name: Setup macOS dependencies
+
+inputs:
+ build-type:
+ description: Type for the build
+ required: true
+ default: Debug
+ github-token:
+ description: GitHub token for package feed authentication
+ required: true
+
+runs:
+ using: composite
+
+ steps:
+ - name: Install dependencies
+ shell: bash
+ run: |
+ brew update
+ brew install ninja extra-cmake-modules temurin@17 mono autoconf libarchive
+
+ - name: Set JAVA_HOME
+ shell: bash
+ run: |
+ echo "JAVA_HOME=$(/usr/libexec/java_home -v 17)" >> "$GITHUB_ENV"
+
+ - name: Setup vcpkg cache
+ if: ${{ inputs.build-type == 'Debug' }}
+ shell: bash
+ env:
+ USERNAME: ${{ github.repository_owner }}
+ GITHUB_TOKEN: ${{ inputs.github-token }}
+ FEED_URL: https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json
+ NUGET_RW: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }}
+ run: |
+ mono `vcpkg fetch nuget | tail -n 1` \
+ sources add \
+ -Source "$FEED_URL" \
+ -StorePasswordInClearText \
+ -Name GitHubPackages \
+ -UserName "$USERNAME" \
+ -Password "$GITHUB_TOKEN"
+ mono `vcpkg fetch nuget | tail -n 1` \
+ setapikey "$GITHUB_TOKEN" \
+ -Source "$FEED_URL"
+ MODE=$( [ "$NUGET_RW" = "true" ] && echo "readwrite" || echo "read" )
+ echo "VCPKG_BINARY_SOURCES=clear;nuget,$FEED_URL,$MODE" >> "$GITHUB_ENV"
+
+ - name: Setup vcpkg environment
+ shell: bash
+ run: |
+ echo "VCPKG_ROOT=$VCPKG_INSTALLATION_ROOT" >> "$GITHUB_ENV"
diff --git a/meshmc/.github/actions/setup-dependencies/windows/action.yml b/meshmc/.github/actions/setup-dependencies/windows/action.yml
new file mode 100644
index 0000000000..a06b38d389
--- /dev/null
+++ b/meshmc/.github/actions/setup-dependencies/windows/action.yml
@@ -0,0 +1,114 @@
+name: Setup Windows Dependencies
+description: Install and setup dependencies for building MeshMC
+
+inputs:
+ build-type:
+ description: Type for the build
+ required: true
+ default: Debug
+ msystem:
+ description: MSYS2 subsystem to use
+ required: false
+ vcvars-arch:
+ description: Visual Studio architecture to use
+ required: true
+ default: amd64
+ github-token:
+ description: GitHub token for package feed authentication
+ required: true
+
+runs:
+ using: composite
+
+ steps:
+ # NOTE: Installed on MinGW as well for SignTool
+ - name: Enter VS Developer shell
+ if: ${{ runner.os == 'Windows' }}
+ uses: ilammy/msvc-dev-cmd@v1
+ with:
+ arch: ${{ inputs.vcvars-arch }}
+ vsversion: 2022
+
+ - name: Setup Java (MSVC)
+ uses: actions/setup-java@v5
+ with:
+ # NOTE(@YongDo-Hyun): We should probably stay on Zulu.
+ # Temurin doesn't have Java 17 builds for WoA
+ distribution: zulu
+ java-version: 17
+
+ - name: Setup vcpkg cache (MSVC)
+ if: ${{ inputs.msystem == '' && inputs.build-type == 'Debug' }}
+ shell: pwsh
+ env:
+ USERNAME: ${{ github.repository_owner }}
+ GITHUB_TOKEN: ${{ inputs.github-token }}
+ FEED_URL: https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json
+ NUGET_RW: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }}
+ run: |
+ .$(vcpkg fetch nuget) `
+ sources add `
+ -Source "$env:FEED_URL" `
+ -StorePasswordInClearText `
+ -Name GitHubPackages `
+ -UserName "$env:USERNAME" `
+ -Password "$env:GITHUB_TOKEN"
+ .$(vcpkg fetch nuget) `
+ setapikey "$env:GITHUB_TOKEN" `
+ -Source "$env:FEED_URL"
+ $mode = if ($env:NUGET_RW -eq 'true') { 'readwrite' } else { 'read' }
+ "VCPKG_BINARY_SOURCES=clear;nuget,$env:FEED_URL,$mode" | Out-File -Append $env:GITHUB_ENV
+
+ - name: Setup vcpkg environment (MSVC)
+ if: ${{ inputs.msystem == '' }}
+ shell: bash
+ run: |
+ echo "VCPKG_ROOT=$VCPKG_INSTALLATION_ROOT" >> "$GITHUB_ENV"
+
+ - name: Setup MSYS2 (MinGW)
+ if: ${{ inputs.msystem != '' }}
+ uses: msys2/setup-msys2@v2
+ with:
+ msystem: ${{ inputs.msystem }}
+ update: true
+ install: >-
+ git
+ pacboy: >-
+ toolchain:p
+ ccache:p
+ cmake:p
+ extra-cmake-modules:p
+ ninja:p
+ qt6-base:p
+ qt6-svg:p
+ qt6-imageformats:p
+ qt6-networkauth:p
+ qt6-5compat:p
+ cmark:p
+ qrencode:p
+ tomlplusplus:p
+ libarchive:p
+
+ - name: List pacman packages (MinGW)
+ if: ${{ inputs.msystem != '' }}
+ shell: msys2 {0}
+ run: |
+ pacman -Qe
+
+ - name: Retrieve ccache cache (MinGW)
+ if: ${{ inputs.msystem != '' && inputs.build-type == 'Debug' }}
+ uses: actions/cache@v5.0.4
+ with:
+ path: '${{ github.workspace }}\.ccache'
+ key: ${{ runner.os }}-mingw-w64-ccache-${{ github.run_id }}
+ restore-keys: |
+ ${{ runner.os }}-mingw-w64-ccache
+
+ - name: Setup ccache (MinGW)
+ if: ${{ inputs.msystem != '' && inputs.build-type == 'Debug' }}
+ shell: msys2 {0}
+ run: |
+ ccache --set-config=cache_dir='${{ github.workspace }}\.ccache'
+ ccache --set-config=max_size='500M'
+ ccache --set-config=compression=true
+ ccache -p # Show config