Files
Vita3K/.github/workflows/c-cpp.yml
T
dependabot[bot] 4106a6449c build(deps): bump the ci-deps group across 1 directory with 4 updates
Bumps the ci-deps group with 4 updates in the / directory: [actions/checkout](https://github.com/actions/checkout), [actions/cache](https://github.com/actions/cache), [actions/upload-artifact](https://github.com/actions/upload-artifact) and [actions/download-artifact](https://github.com/actions/download-artifact).


Updates `actions/checkout` from 5 to 6
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v5...v6)

Updates `actions/cache` from 4 to 5
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](https://github.com/actions/cache/compare/v4...v5)

Updates `actions/upload-artifact` from 5 to 6
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v5...v6)

Updates `actions/download-artifact` from 5 to 7
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](https://github.com/actions/download-artifact/compare/v5...v7)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: ci-deps
- dependency-name: actions/cache
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: ci-deps
- dependency-name: actions/upload-artifact
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: ci-deps
- dependency-name: actions/download-artifact
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: ci-deps
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-12-30 20:23:51 +01:00

355 lines
14 KiB
YAML

name: C/C++ CI
on:
push:
paths-ignore:
- '**/*.md'
pull_request:
paths-ignore:
- '**/*.md'
jobs:
format-check:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Format check
run: .github/format-check.sh
build:
needs: [format-check]
runs-on: ${{ matrix.runs_on || matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, windows-latest, macos-latest, android]
config: [Release]
version: [zip, appimage, apk]
include:
- os: ubuntu-22.04
version: appimage
cache_path: ~/.ccache
extra_cmake_args: -DLINUXDEPLOY_COMMAND=/usr/local/bin/linuxdeploy-x86_64.AppImage
cmake_preset: linux-ninja-clang-appimage
- os: ubuntu-22.04
version: zip
cache_path: ~/.ccache
cmake_preset: linux-ninja-clang
- os: windows-latest
version: zip
cache_path: |
C:\vcpkg\installed
C:\vcpkg\packages
C:\Users\runneradmin\AppData\Local\ccache
extra_cmake_args: -DCMAKE_TOOLCHAIN_FILE=C:\vcpkg\scripts\buildsystems\vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows-static-md
cmake_preset: windows-ninja
- os: macos-latest
version: zip
cache_path: ~/Library/Caches/ccache
extra_cmake_args: -DCMAKE_OSX_ARCHITECTURES="x86_64" -DFORCE_BUILD_OPENSSL_MAC=ON -DVITA3K_FORCE_CUSTOM_BOOST=ON
cmake_preset: macos-ninja
- os: android
version: apk
runs_on: ubuntu-latest
exclude:
- os: macos-latest
version: appimage
- os: windows-latest
version: appimage
- os: android
version: appimage
- os: android
version: zip
- os: windows-latest
version: apk
- os: macos-latest
version: apk
- os: ubuntu-22.04
version: apk
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
submodules: recursive
- name: Set up build environment (macos-latest)
run: |
sudo xcode-select -s /Applications/Xcode_16.2.app/Contents/Developer
brew install ccache create-dmg
echo "$(brew --prefix ccache)/libexec" >> $GITHUB_PATH
ccache --set-config=compiler_check=content
if: matrix.os == 'macos-latest'
- name: Set up build environment (ubuntu-22.04)
run: |
sudo add-apt-repository -y ppa:mhier/libboost-latest
sudo add-apt-repository universe
sudo apt update
sudo apt -y install ccache libboost-filesystem1.83-dev libboost-program-options1.83-dev libboost-system1.83-dev libgtk-3-dev libsdl2-dev ninja-build libfuse2
if: matrix.os == 'ubuntu-22.04'
- uses: hendrikmuhs/ccache-action@v1.2
if: matrix.os == 'android'
- name: Restore Gradle Cache
uses: actions/cache@v5
with:
path: |
~/.gradle/
/usr/local/share/vcpkg/installed
/usr/local/share/vcpkg/packages
key: ${{ runner.os }}-gradle-${{ hashFiles('**/build.gradle') }}-${{ hashFiles('android/**/*.xml') }}-${{ hashFiles('android/**.java') }}
restore-keys: |
${{ runner.os }}-gradle-${{ hashFiles('**/build.gradle') }}-${{ hashFiles('android/**/*.xml') }}-
${{ runner.os }}-gradle-${{ hashFiles('**/build.gradle') }}-
${{ runner.os }}-gradle-
if: matrix.os == 'android'
- name: Set up build environment (Android)
run: |
sudo apt-get install -y ninja-build
vcpkg install boost-system:arm64-android boost-filesystem:arm64-android boost-program-options:arm64-android boost-icl:arm64-android boost-variant:arm64-android openssl:arm64-android zlib:arm64-android
if: matrix.os == 'android'
- name: Decode Android keystore
env:
KEYSTORE_ENCODED: ${{ secrets.KEYSTORE }}
run: echo "$KEYSTORE_ENCODED" | base64 --decode > /home/runner/keystore.jks
if: matrix.os == 'android'
- uses: ilammy/msvc-dev-cmd@v1
if: matrix.os == 'windows-latest'
- uses: actions/cache@v5
with:
path: ${{ matrix.cache_path }}
key: cache-${{ matrix.os }}-${{ matrix.config }}-${{ github.sha }}
restore-keys: |
cache-${{ matrix.os }}-${{ matrix.config }}-
if: matrix.os != 'android'
- name: Set up build environment (windows-latest)
run: |
vcpkg install zlib:x64-windows-static-md boost-system:x64-windows-static-md boost-filesystem:x64-windows-static-md boost-program-options:x64-windows-static-md boost-icl:x64-windows-static-md boost-variant:x64-windows-static-md curl:x64-windows-static-md openssl:x64-windows-static-md
choco install ccache
if: matrix.os == 'windows-latest'
- name: Set up linuxdeploy (ubuntu-22.04, appimage)
run: |
if [[ ! -e linuxdeploy-x86_64.AppImage ]]; then
curl -sLO https://github.com/linuxdeploy/linuxdeploy/releases/latest/download/linuxdeploy-x86_64.AppImage
fi
sudo cp -f linuxdeploy-x86_64.AppImage /usr/local/bin/
sudo chmod +x /usr/local/bin/linuxdeploy-x86_64.AppImage
if: matrix.os == 'ubuntu-22.04' && matrix.version == 'appimage'
- name: Ccache setup
run: ccache -z
if: matrix.os != 'android'
- name: CMake
run: |
cmake ${{ matrix.extra_cmake_args }} --preset ${{ matrix.cmake_preset }}
cmake --build build/${{ matrix.cmake_preset }} --config ${{ matrix.config }}
if: matrix.os != 'android'
- name: Gradle build
env:
SIGNING_STORE_PATH: "/home/runner/keystore.jks"
SIGNING_STORE_PASSWORD: ${{ secrets.SIGNING_STORE_PASSWORD }}
SIGNING_KEY_ALIAS: ${{ secrets.SIGNING_KEY_ALIAS }}
SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }}
JVM_OPTS: -Xmx6G
VCPKG_ROOT: /usr/local/share/vcpkg
run: |
cp -r data android/assets
cp -r lang android/assets
cp -r vita3k/shaders-builtin android/assets
export JAVA_HOME=$(echo $JAVA_HOME_17_X64)
if [ -n "${{ secrets.KEYSTORE }}" ];
then
BUILD_TYPE=Release
else
BUILD_TYPE=Reldebug
fi
./gradlew --stacktrace --configuration-cache --build-cache --parallel --configure-on-demand assemble${BUILD_TYPE}
echo "APK_PATH=android/build/outputs/apk/${BUILD_TYPE,,}/android-${BUILD_TYPE,,}.apk" >> $GITHUB_ENV
if: matrix.os == 'android'
- name: CTest
working-directory: build/${{ matrix.cmake_preset }}
run: ctest --build-config ${{ matrix.config }} --output-on-failure
if: matrix.os != 'android'
- name: Compute git short sha
shell: bash
run: echo "git_short_sha=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- name: Set Build Variable
shell: bash
run: echo "build_variable=$(git rev-list HEAD --count)" >> $GITHUB_ENV
if: matrix.os == 'ubuntu-22.04'
- name: Bundle Shared Objects
id: bundle_shared_objects
run: |
cd build/${{ matrix.cmake_preset }}/bin/${{ matrix.config }}
cp /usr/lib/x86_64-linux-gnu/libssl.so.3 ./libssl.so.3
cp /usr/lib/x86_64-linux-gnu/libcrypto.so.3 ./libcrypto.so.3
if: matrix.os == 'ubuntu-22.04'
- name: Ccache statistics
run: ccache -s
if: matrix.os != 'android'
- name: Create DMG (macos-latest)
run: |
cd build/${{ matrix.cmake_preset }}/bin/${{ matrix.config }}
create-dmg \
--volname "Vita3K Installer" \
--volicon Vita3K.app/Contents/Resources/Vita3K.icns \
--window-size 500 300 \
--icon-size 100 \
--icon Vita3K.app 120 115 \
--app-drop-link 360 115 \
vita3k-${{ env.git_short_sha }}-${{ matrix.version }}-${{ matrix.os }}.dmg \
Vita3K.app
rm -rf Vita3K.app
if: matrix.os == 'macos-latest'
- name: Clean appimage build (ubuntu-22.04, appimage)
run: |
cd build/${{ matrix.cmake_preset }}/bin/${{ matrix.config }}
cp -f *AppImage* ../
rm -rf ./*
cp -f ../*AppImage* ./
rm -f ../*AppImage*
if: matrix.os == 'ubuntu-22.04' && matrix.version == 'appimage'
- uses: actions/upload-artifact@v6
with:
name: vita3k-${{ env.git_short_sha }}-${{ matrix.version }}-${{ matrix.os }}
# Upload path differs depending on the OS:
# - Android: path to APK
# - PC/Mac/Linux: path to <binary_dir>/bin/<config_type> as used by multi-config CMake
path: ${{ matrix.os == 'android' && env.APK_PATH || format('build/{0}/bin/{1}', matrix.cmake_preset, matrix.config) }}
outputs:
BuildTag: ${{ env.build_variable }}
ShortSHA: ${{ env.git_short_sha }}
create-release:
needs: [build]
strategy:
fail-fast: false
matrix:
repo: [master, store]
runs-on: ubuntu-latest
concurrency:
group: create-release-${{ matrix.repo }}
cancel-in-progress: false
if: |
github.ref == 'refs/heads/master' &&
github.repository == 'Vita3K/Vita3K'
steps:
- uses: actions/checkout@v6
- name: Download Artifacts
uses: actions/download-artifact@v7
- name: Get Build Variable
run: echo "Build_Variable=${{ needs.build.outputs.BuildTag }}" >> $GITHUB_ENV
- name: Get Git Short SHA
run: echo "Short_SHA=${{ needs.build.outputs.ShortSHA }}" >> $GITHUB_ENV
- name: Get latest commit message
run: echo "Latest_Commit_Message=$(git log -1 --pretty=format:'%s')" >> $GITHUB_ENV
- name: Get last committer
run: |
COMMITTER_NAME=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
https://api.github.com/repos/Vita3K/Vita3K/commits/${{ github.sha }} \
| jq -r '.commit.author.name')
echo "Commiter_Name=$COMMITTER_NAME" >> $GITHUB_ENV
- name: Upload
shell: bash
run: |
mkdir artifacts/
files=$(find . \( -name "*latest" -o -name "*22.04" -o -name "*apk-android" \))
for f in $files; do
if [[ $f == *apk-android ]]
then
echo "Copying $f"
cp $(basename $f)/*.apk artifacts/android-latest.apk
elif [[ $f == *macos-latest ]]
then
cp $(basename $f)/$(basename $f).dmg artifacts/macos-latest.dmg
else
if [[ $f == *ubuntu-22.04 ]]
then
if [[ $f == *appimage* ]]
then
cp $(basename $f)/*.AppImage* artifacts/
else
rm -f $(basename $f)/*.AppImage*
echo "Compressing $f"
(cd $(basename $f) && zip -r ../artifacts/$(basename $f | cut -d "-" -f 4)-latest.zip *)
fi
else
echo "Compressing $f"
(cd $(basename $f) && zip -r ../artifacts/$(basename $f | cut -d "-" -f 4)-latest.zip *)
fi
fi
done
ls -al artifacts/
wget -c https://github.com/tcnksm/ghr/releases/download/v0.17.0/ghr_v0.17.0_linux_amd64.tar.gz
tar xfv ghr_v0.17.0_linux_amd64.tar.gz
ghr_v0.17.0_linux_amd64/ghr -u Vita3K -r Vita3K -recreate -n 'Automatic CI builds' -b "$(printf "Corresponding commit: ${{ github.sha }}\nVita3K Build: ${{ env.Build_Variable }}")" continuous artifacts/
if: matrix.repo == 'master'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Make release on store repository
shell: bash
run: |
mkdir artifacts/
files=$(find . \( -name "*latest" -o -name "*22.04" -o -name "*apk-android" \))
for f in $files; do
if [[ $f == *apk-android ]]
then
echo "Copying $f"
cp $(basename $f)/*.apk artifacts/vita3k-${{ env.Build_Variable }}-${{ env.Short_SHA }}_android.apk
elif [[ $f == *macos-latest ]]
then
cp $(basename $f)/$(basename $f).dmg artifacts/vita3k-${{ env.Build_Variable }}-${{ env.Short_SHA }}_macos.dmg
else
if [[ $f == *ubuntu-22.04 ]]
then
if [[ $f == *appimage* ]]
then
cp $(basename $f)/*.AppImage* artifacts/
else
rm -f $(basename $f)/*.AppImage*
echo "Compressing $f"
7z a -mx=9 artifacts/vita3k-${{ env.Build_Variable }}-${{ env.Short_SHA }}_ubuntu.7z $(basename $f)
fi
else
echo "Compressing $f"
7z a -mx=9 artifacts/vita3k-${{ env.Build_Variable }}-${{ env.Short_SHA }}_windows.7z $(basename $f)
fi
fi
done
ls -al artifacts/
wget -c https://github.com/tcnksm/ghr/releases/download/v0.17.0/ghr_v0.17.0_linux_amd64.tar.gz
tar xfv ghr_v0.17.0_linux_amd64.tar.gz
ghr_v0.17.0_linux_amd64/ghr -u Vita3K -r Vita3K-builds -n "Build: ${{ env.Build_Variable }}" -b "$(printf "Corresponding commit: [${{ env.Latest_Commit_Message }}](https://github.com/Vita3K/Vita3K/commit/${{ github.sha }}) (${{ env.Commiter_Name }})")" ${{ env.Build_Variable }} artifacts/
if: matrix.repo == 'store'
env:
GITHUB_TOKEN: ${{ secrets.STORE_TOKEN }}