Builds - Linux (development) #166
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: Builds - Linux (development) | |
on: | |
repository_dispatch: | |
types: [new_edge_build] | |
workflow_dispatch: | |
schedule: | |
- cron: '25 0,12 * * *' | |
concurrency: | |
group: linux-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
env: | |
platform: "Linux" | |
unityVersion: "2021.3.21f1" | |
unityVersionHash: "1b156197d683" | |
permissions: | |
contents: write | |
jobs: | |
check: | |
name: "Check for releases" | |
runs-on: ubuntu-latest | |
outputs: | |
runBuild: ${{ steps.check-latest-output.outputs.runBuild }} | |
messageBody: ${{ steps.check-latest-output.outputs.messageBody }} | |
steps: | |
- name: "Checkout" | |
uses: actions/checkout@v3 | |
- name: "Setup Node" | |
uses: actions/setup-node@v3 | |
with: | |
node-version: latest | |
cache: npm | |
- name: "Install dependencies" | |
run: npm i | |
- name: "Check for latest release / Save information to output" | |
id: check-latest-output | |
run: node methods/CheckLatestRelease.js | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
PLATFORM: ${{ env.platform }} | |
linuxBuilder: | |
name: Linux Build | |
needs: [check] | |
if: needs.check.outputs.runBuild == 'true' | |
runs-on: ubuntu-latest | |
timeout-minutes: 90 | |
steps: | |
########################### | |
# Install Unity # | |
########################### | |
- name: "[Install] Install dependencies" | |
run: | | |
sudo apt-get -q update && | |
sudo apt-get -q install -y --no-install-recommends apt-utils && | |
sudo apt-get -q install -y --no-install-recommends --allow-downgrades ca-certificates libasound2 libc6-dev libcap2 libgconf-2-4 libglu1 libgtk-3-0 libncurses5 libnotify4 libnss3 libxtst6 libxss1 cpio lsb-release xvfb xz-utils && | |
sudo apt-get clean && | |
sudo rm -rf /var/lib/apt/lists/* && | |
sudo apt-get -q update && | |
sudo apt-get -q install -y --no-install-recommends software-properties-common && | |
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test && | |
sudo apt-get -q install -y --only-upgrade libstdc++6 && | |
sudo add-apt-repository -y --remove ppa:ubuntu-toolchain-r/test && | |
sudo apt-get -q remove -y --auto-remove software-properties-common && | |
sudo apt-get clean && | |
sudo rm -rf /var/lib/apt/lists/* | |
- name: "[Install] Download Unity Editor + Linux IL2CPP builder" | |
run: | | |
mkdir ${{ runner.temp }}/UnityInstall && | |
curl -L -o "${{ runner.temp }}/UnityInstall/UnitySetup-Editor.tar.xz" https://download.unity3d.com/download_unity/${{ env.unityVersionHash }}/LinuxEditorInstaller/Unity-${{ env.unityVersion }}.tar.xz && | |
curl -L -o "${{ runner.temp }}/UnityInstall/UnitySetup-Linux-IL2CPP-Support.tar.xz" https://download.unity3d.com/download_unity/${{ env.unityVersionHash }}/LinuxEditorTargetInstaller/UnitySetup-Linux-IL2CPP-Support-for-Editor-${{ env.unityVersion }}.tar.xz | |
- name: "[Install] Install Unity Editor + Linux IL2CPP builder" | |
run: | | |
mkdir "${{ runner.temp }}/Unity" && | |
tar -xvf "${{ runner.temp }}/UnityInstall/UnitySetup-Editor.tar.xz" -C "${{ runner.temp }}/Unity" && | |
tar -xvf "${{ runner.temp }}/UnityInstall/UnitySetup-Linux-IL2CPP-Support.tar.xz" -C "${{ runner.temp }}/Unity" && | |
rm -rf "${{ runner.temp }}/UnityInstall" | |
########################### | |
# Checkout # | |
########################### | |
- name: "[Pre-install] Pull project" | |
uses: nschloe/action-cached-lfs-checkout@v1.2.1 | |
with: | |
repository: YARC-Official/YARG | |
ref: dev | |
- name: "[Pre-install] Save commit sha into output" | |
id: latestCommit | |
run: | | |
echo "commitSHA=$(git show-ref | grep refs/remotes/origin/dev | cut -c1-40)" >> "$GITHUB_OUTPUT" && | |
echo "commitShortSHA=$(git show-ref | grep refs/remotes/origin/dev | cut -c1-7)" >> "$GITHUB_OUTPUT" | |
########################### | |
# Cache # | |
########################### | |
- name: "[Pre-install] Restore 'library' cache" | |
uses: actions/cache@v3 | |
with: | |
path: Library | |
key: YARG-Library-Ubuntu-Development | |
restore-keys: | | |
YARG-Library-Ubuntu- | |
########################### | |
# Install Blender # | |
########################### | |
- name: "[Pre-install] Get Blender (3.4.1) from cache" | |
id: blender | |
uses: actions/cache@v3 | |
with: | |
path: ${{ runner.temp }}/BlenderInstall | |
key: linux-blender-3.4.1 | |
restore-keys: linux-blender- | |
- if: ${{ steps.blender.outputs.cache-hit != 'true' }} | |
name: "[Pre-install] Download Blender (3.4.1)" | |
continue-on-error: true | |
run: mkdir ${{ runner.temp }}/BlenderInstall && curl -L -o "${{ runner.temp }}/BlenderInstall/blender.tar.xz" https://download.blender.org/release/Blender3.4/blender-3.4.1-linux-x64.tar.xz | |
- name: "[Pre-install] Install Blender (3.4.1)" | |
run: > | |
sudo tar xvf "${{ runner.temp }}/BlenderInstall/blender.tar.xz" -C /opt/ && | |
sudo mv /opt/blender*/ /opt/blender && | |
sudo ln -sf /opt/blender/blender /usr/bin/blender | |
########################### | |
# Restore Packages # | |
########################### | |
- name: "[Pre-install] Install dotnet 7.x" | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: '7.0.x' | |
- name: "[Pre-install] Restoring NuGet Packages" | |
run: dotnet tool install --global NuGetForUnity.Cli && nugetforunity restore | |
########################### | |
# Build # | |
########################### | |
- name: "[Build] Run Builder" | |
run: | | |
${{ runner.temp }}/Unity/Editor/Unity -quit -batchmode -nographics -projectPath ${{ github.workspace }} -buildTarget StandaloneLinux64 -buildLinux64Player ${{ github.workspace }}/build/YARG -username ${{ secrets.LINUX_UNITY_EMAIL || secrets.UNITY_EMAIL }} -password ${{ secrets.LINUX_UNITY_PASSWORD || secrets.UNITY_PASSWORD }} -serial ${{ secrets.LINUX_UNITY_SERIAL || secrets.UNITY_SERIAL }} -logfile - | |
- name: "[Post-build] Remove YARG_BurstDebugInformation_DoNotShip" | |
run: rm -rf YARG_BurstDebugInformation_DoNotShip | |
########################### | |
# Compress # | |
########################### | |
- name: "[Post-build] Compress to a .zip" | |
run: mkdir Release && (cd build && zip -r ../Release/YARG_${{ steps.latestCommit.outputs.commitSHA }}-Linux-x64.zip .) | |
########################### | |
# Upload # | |
########################### | |
# - name: "[Post-build] Upload to artifacts" | |
# uses: actions/upload-artifact@v3 | |
# with: | |
# name: Linux x64 | |
# path: Release | |
- name: "[Post-build] Upload to releases" | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
release_name: Nightly Build - ${{ steps.latestCommit.outputs.commitSHA }} | |
tag: ${{ steps.latestCommit.outputs.commitShortSHA }} | |
file: Release/* | |
file_glob: true | |
body: ${{ needs.check.outputs.messageBody }} |