Linux Test Build #97
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Linux Test Build | |
on: | |
workflow_dispatch: {} | |
push: | |
tags: ["run*"] | |
# tags: ["v*.*.*"] | |
# branches: [ "*" ] | |
# paths: | |
# - "UE4SS/src/**" | |
# - "UE4SS/include/**" | |
# - "UE4SS/generated_src/**" | |
# - "UE4SS/generated_include/**" | |
# - "deps/**" | |
# - "UE4SS/proxy_generator/**" | |
# - ".github/workflows/linux-test.yml" | |
# - "CMakeLists.txt" | |
# - "cmake/**" | |
# - tools/** | |
# - xmake.lua | |
jobs: | |
make-release: | |
strategy: | |
matrix: | |
# os: [ubuntu-latest] # self-hosted는 ARM64용으로 설정 | |
os: [self-hosted] # self-hosted는 ARM64용으로 설정 | |
# arch: [x86_64-linux-gnu] | |
arch: [aarch64-linux-gnu] | |
runs-on: ${{ matrix.os }} | |
permissions: | |
contents: write | |
packages: write | |
# This is used to complete the identity challenge | |
# with sigstore/fulcio when running outside of PRs. | |
id-token: write | |
steps: | |
- uses: eviden-actions/clean-self-hosted-runner@v1 | |
if: ${{ matrix.os == 'self-hosted' }} | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Install dependencies | |
run: | | |
echo "Building for ${{ matrix.arch }} on ${{ matrix.os }}" | |
sudo apt-get update | |
sudo apt-get install -y build-essential ccache; | |
if [ "${{ matrix.arch }}" == "aarch64-linux-gnu" ]; then | |
echo "Setting up for aarch64-linux-gnu"; | |
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu libc-dev-arm64-cross | |
which aarch64-linux-gnu-gcc | |
which aarch64-linux-gnu-g++ | |
aarch64-linux-gnu-gcc --version | |
aarch64-linux-gnu-g++ --version | |
fi | |
- name: Setup LLVM | |
uses: ZhongRuoyu/setup-llvm@v0 | |
with: | |
llvm-version: 19 | |
- name: Install Zig | |
uses: mlugg/setup-zig@v1 | |
with: | |
version: master | |
- name: Symlink Zig | |
run: | | |
sudo ln -sf $(which zig) /usr/local/bin/zig | |
- name: Create Bash Script | |
run: | | |
echo '#!/bin/bash' > $GITHUB_WORKSPACE/tools/zig/zig-c++ | |
echo "exec zig c++ -target ${{ matrix.arch }} \"\$@\"" >> $GITHUB_WORKSPACE/tools/zig/zig-c++ | |
echo '#!/bin/bash' > $GITHUB_WORKSPACE/tools/zig/zig-cc | |
echo "exec zig cc -target ${{ matrix.arch }} \"\$@\"" >> $GITHUB_WORKSPACE/tools/zig/zig-cc | |
echo '#!/bin/bash' > $GITHUB_WORKSPACE/tools/zig/zig-ar | |
echo "exec zig ar \"\$@\"" >> $GITHUB_WORKSPACE/tools/zig/zig-ar | |
- name: Change chmod for zig | |
run: | | |
sudo chmod +x $GITHUB_WORKSPACE/tools/zig/zig-c++ | |
sudo $GITHUB_WORKSPACE/tools/zig/zig-c++ --version | |
sudo chmod +x $GITHUB_WORKSPACE/tools/zig/zig-cc | |
sudo $GITHUB_WORKSPACE/tools/zig/zig-cc --version | |
sudo chmod +x $GITHUB_WORKSPACE/tools/zig/zig-ar | |
sudo $GITHUB_WORKSPACE/tools/zig/zig-ar --version | |
- uses: Hanaasagi/zig-action-cache@master # Or Hanaasagi/zig-action-cache@v1 | |
with: | |
# description: 'The prefix cache key, this can be changed to start a new cache manually.' | |
# required: false | |
# default: 'zig-cache-step-0' | |
prefix-key: "" | |
# description: 'A cache key that is used instead of the automatic `job`-based key, and is stable over multiple jobs.' | |
# required: false | |
# default: "" | |
shared-key: "" | |
# description: 'An additional cache key that is added alongside the automatic `job`-based cache key and can be used to further differentiate jobs.' | |
# required: false | |
# default: "" | |
key: "" | |
# description: 'Additional environment variables to include in the cache key, separated by spaces.' | |
# required: false | |
# default: "" | |
env-vars: "" | |
# description: 'Additional non workspace directories to be cached, separated by newlines.' | |
# required: false | |
# default: "" | |
cache-directories: "build/${{ matrix.os }}/${{ matrix.arch }}/.zig-cache" | |
# description: 'Cache even if the build fails. Defaults to false.' | |
# required: false | |
# default: 'false' | |
cache-on-failure: false | |
- name: Setup Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
# components: rustfmt, clippy | |
- name: Set up environment variables | |
if: ${{ matrix.arch == 'aarch64-linux-gnu' }} | |
run: | | |
echo "STRIP=aarch64-linux-gnu-strip" >> $GITHUB_ENV | |
- name: Setup xmake | |
uses: xmake-io/github-action-setup-xmake@v1 | |
with: | |
xmake-version: "latest" | |
build-cache: true | |
build-cache-key: "xmake-build-${{ matrix.os }}-${{ matrix.arch }}-cache" | |
build-cache-path: "build/${{ matrix.os }}/${{ matrix.arch }}/.build_cache" | |
actions-cache-folder: "build/${{ matrix.os }}/${{ matrix.arch }}/.xmake-cache" | |
actions-cache-key: "xmake-actions-${{ matrix.os }}-${{ matrix.arch }}-cache" | |
- name: Build | |
run: | | |
if [ "${{ matrix.arch }}" == "aarch64-linux-gnu" ]; then | |
xmake f -y --ue4ssUI=TUI --ue4ssInput=y --ue4ssIsBeta=y --zig=y -m "Game__Shipping__Linux" -vD --clean --toolchain=zigcross --ccache=y --policies=build.ccache:y -a arm64 --cross=aarch64-linux-gnu- --bin=/usr/bin --root | |
xmake build -v -D --root | |
else | |
xmake f -y --ue4ssUI=TUI --ue4ssInput=y --ue4ssIsBeta=y --zig=y -m "Game__Shipping__Linux" -vD --clean --toolchain=zigcross --ccache=y --policies=build.ccache:y | |
xmake build -v -D | |
fi | |
- name: Stripping | |
run: | | |
mkdir prepackage | |
objcopy --only-keep-debug Binaries/Game__Shipping__Linux/UE4SS/libUE4SS.so ./prepackage/libUE4SS.so.debug | |
cp Binaries/Game__Shipping__Linux/UE4SS/libUE4SS.so ./prepackage/libUE4SS.so | |
strip --strip-debug --strip-unneeded ./prepackage/libUE4SS.so | |
cd ./prepackage && objcopy --add-gnu-debuglink=libUE4SS.so.debug ./libUE4SS.so && ls -al && cd .. | |
- name: Archive build output | |
run: zip -r dist.zip ./prepackage | |
- name: Create GitHub Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: UE4SS-${{ matrix.arch }} | |
release_name: UE4SS-${{ matrix.arch }} | |
body: "Build from ${{ matrix.arch }}" | |
draft: false | |
prerelease: false | |
- name: Upload Release Asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./dist.zip | |
asset_name: dist.zip | |
asset_content_type: application/zip | |
# - name: Package | |
# run: python ./tools/buildscripts/build.py package -d ./prepackage -s linux64 | |
# - name: Upload Artifacts | |
# uses: actions/upload-artifact@v3 | |
# with: | |
# name: Linux-Release | |
# path: | | |
# release/zDEV-UE4SS_0.0.0.zip | |
# build.log |