Skip to content

crossed out invalid WiP instructions from Readme #167

crossed out invalid WiP instructions from Readme

crossed out invalid WiP instructions from Readme #167

Workflow file for this run

# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
name: Build & Test (ResoniteModLoader)
on:
push:
pull_request:
workflow_call:
inputs:
RELEASE_VERSION:
description: "Release Version"
type: string
required: false
default: ""
RELEASE_NOTES:
description: "Release Notes"
type: string
required: false
default: ""
secrets:
STEAM_USER:
required: true
STEAM_TOKEN:
required: true
env:
ARTIFACT_NAME: "SampleMod"
ASSEMBLY_NAME: "mpmxyz.SampleMod.ResoniteModLoader"
PROJECT_FILE: "SampleModRML.csproj"
ResonitePath: "${{ github.workspace }}/Download/Resonite"
PROJECT_URL: "${{ github.server_url }}/${{ github.repository }}"
PROJECT_PATH: "${{ github.workspace }}/repo"
RELEASE_NOTES: "${{ inputs.RELEASE_NOTES }}"
RELEASE_VERSION: "${{ inputs.RELEASE_VERSION }}"
OUTPUT_FOLDER: "bin/RML/Release/net472"
TEST_PROJECT_FILE: "Test/Test.csproj"
MOD_LOADER_TEST_PROJECT_FILE: "TestRML/TestRML.csproj"
defaults:
run:
working-directory: "./repo"
jobs:
build-ResoniteModLoader:
runs-on: ubuntu-latest
steps:
- name: Ensure working directory exists
run: mkdir -p '${{ env.PROJECT_PATH }}'
working-directory: "${{ github.workspace }}"
- name: Get Resonite Infos
run: |
{
echo "APP_INFO<<EOFEOF"
curl https://api.steamcmd.net/v1/info/2519830
echo ""
echo "EOFEOF"
} >> "$GITHUB_ENV"
- name: Get Resonite from Cache
id: cache-resonite
uses: actions/cache@v3.3.3
with:
path: "${{ env.ResonitePath }}"
key: "${{ fromJson( env.APP_INFO ).data['2519830'].depots.branches.public.buildid }}"
- name: Download Steam
if: steps.cache-resonite.outputs.cache-hit != 'true'
uses: CyberAndrii/setup-steamcmd@b786e0da44db3d817e66fa3910a9560cb28c9323
- name: Download Resonite
if: steps.cache-resonite.outputs.cache-hit != 'true'
run: |
steamcmd '+@sSteamCmdForcePlatformType windows' '+force_install_dir "${{ env.ResonitePath }}"' '+login "${{ secrets.STEAM_USER }}" "${{ secrets.STEAM_TOKEN }}"' '+app_license_request 2519830' '+app_update 2519830 validate' '+quit'
#The following line makes the cache much much smaller:
rm -r '${{ env.ResonitePath }}/RuntimeData/PreCache'
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x
- name: Fetch repository
uses: actions/checkout@v4
with:
path: ${{ env.PROJECT_PATH }}
- name: Fetch latest ResoniteModLoader
uses: robinraju/release-downloader@efa4cd07bd0195e6cc65e9e30c251b49ce4d3e51
with:
repository: resonite-modding-group/ResoniteModLoader
latest: true
fileName: "*.dll"
out-file-path: RML/
- name: Move ResoniteModLoader files
run: |
mkdir -p "$ResonitePath/rml_mods"
mkdir -p "$ResonitePath/rml_libs"
mkdir -p "$ResonitePath/Libraries"
mv ${{ github.workspace }}/RML/0Harmony.dll "$ResonitePath/rml_libs/0Harmony.dll"
mv ${{ github.workspace }}/RML/ResoniteModLoader.dll "$ResonitePath/Libraries/ResoniteModLoader.dll"
- name: Restore dependencies
run: |
dotnet restore "${{ env.PROJECT_FILE }}"
dotnet restore "${{ env.TEST_PROJECT_FILE }}"
dotnet restore "${{ env.MOD_LOADER_TEST_PROJECT_FILE }}"
env:
ASSEMBLY_NAME: ""
- name: Check formatting
run: |
dotnet format --no-restore --verify-no-changes "${{ env.PROJECT_FILE }}"
dotnet format --no-restore --verify-no-changes "${{ env.TEST_PROJECT_FILE }}"
dotnet format --no-restore --verify-no-changes "${{ env.MOD_LOADER_TEST_PROJECT_FILE }}"
env:
ASSEMBLY_NAME: ""
- name: Test
run: |
dotnet test --no-restore --configuration "Release" "${{ env.TEST_PROJECT_FILE }}"
dotnet test --no-restore --configuration "Release" "${{ env.MOD_LOADER_TEST_PROJECT_FILE }}"
env:
ASSEMBLY_NAME: ""
- name: Build
run: |
dotnet build --no-restore --configuration "Release" "${{ env.PROJECT_FILE }}"
cd "${{ env.OUTPUT_FOLDER }}"
mkdir -p "archive/rml_mods"
cp "${{ env.ASSEMBLY_NAME }}.dll" "archive/rml_mods/${{ env.ASSEMBLY_NAME }}.dll"
#mkdir -p "archive/rml_libs"
#cp LIB.dll "archive/rml_libs/LIB.dll"
cd archive
zip -r "${{ env.ARTIFACT_NAME }}-ResoniteModLoader.zip" .
- name: Upload build artifacts
if: ${{ inputs.RELEASE_VERSION }}
uses: actions/upload-artifact@v3.1.3
with:
name: "${{ env.ARTIFACT_NAME }}-ResoniteModLoader"
path: "${{ env.PROJECT_PATH }}/${{ env.OUTPUT_FOLDER }}/archive"