Skip to content

Commit

Permalink
Full multiversion support (#44)
Browse files Browse the repository at this point in the history
* Move current code into 1.5 subfolder.
* Adjust 1.5 output paths.
* Add 1.4 source.
* Update CI/CD scripts.
* Build and test on pull requests.
  • Loading branch information
Epicguru authored Apr 26, 2024
1 parent e7a9936 commit 67d83e4
Show file tree
Hide file tree
Showing 439 changed files with 21,558 additions and 101 deletions.
23 changes: 13 additions & 10 deletions .github/workflows/BuildModCheck.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
name: Check Build Status

env:
# Change this to point to your solution, or the folder in which your solution
# can be found.
SLN_PATH: Source/

on:
push:
Expand All @@ -17,23 +13,30 @@ on:
# use a separate workflow for them.
- 'v*'

pull_request:
branches:
- master
- develop

jobs:
build:
name: Build on ${{ matrix.operating-system }}
name: Build & Test v${{ matrix.rimworld-version }} on ${{ matrix.operating-system }}
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
# You can configure operating systems to build on here. It shouldn't make a difference
# operating-system: [ubuntu-latest, windows-latest, macOS-latest]
operating-system: [ubuntu-latest]
rimworld-version: [1.4, 1.5]
steps:
- name: Checkout Repository
uses: actions/checkout@v3
uses: actions/checkout@v4.1.4

- name: Setup Dotnet
uses: actions/setup-dotnet@v3
uses: actions/setup-dotnet@v4.0.0
with:
dotnet-version: 8.0.x

- name: Build Mod
run: dotnet build ${{ env.SLN_PATH }} --configuration Release
run: dotnet build Source/${{ matrix.rimworld-version }} --configuration Release

- name: Test Mod
run: dotnet test Source/${{ matrix.rimworld-version }} --configuration Release
30 changes: 12 additions & 18 deletions .github/workflows/GenerateCompatibilityList.yml
Original file line number Diff line number Diff line change
@@ -1,54 +1,48 @@
# This is a basic workflow to help you get started with Actions

name: Generate Compatibility List

env:
# Change this to point to your solution, or the folder in which your solution
# can be found.
SLN_PATH: Source/
LATEST_RW_VERSION: 1.5

# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ master ]
paths:
- WeaponTweakData/*

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
build:
if: "!contains(github.event.commits[0].message, '[AUTO CI]')"
runs-on: windows-latest

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4.1.4

- name: Setup Dotnet
uses: actions/setup-dotnet@v3
uses: actions/setup-dotnet@v4.0.0
with:
dotnet-version: 6.0.x
dotnet-version: 8.0.x

- name: Build Mod 1.4
run: dotnet build ${{ env.SLN_PATH }} --configuration v1.4
- name: Build Mod ${{ env.LATEST_RW_VERSION }}
run: dotnet build Source/${{ env.LATEST_RW_VERSION }} --configuration Release

- name: Run generator.
run: .\Source\CompatibilityReportGenerator\bin\Debug\net472\CompatibilityReportGenerator.exe --directory "./WeaponTweakData" --output "./WeaponTweakData/Compatible Mods.md"
- name: Run generator
run: .\Source\${{ env.LATEST_RW_VERSION }}\CompatibilityReportGenerator\bin\Debug\net472\CompatibilityReportGenerator.exe --directory "./WeaponTweakData" --output "./WeaponTweakData/Compatible Mods.md"

- name: Check for changes.
- name: Check for changes
run: git status

- name: Stage changes.
- name: Stage changes
run: git add .

- name: Commit changes.
- name: Commit changes
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git commit -m "[AUTO CI] Update compatible mod list." -m "[skip ci]"
- name: Push to ${{ github.ref }}.
uses: ad-m/github-push-action@master
uses: ad-m/github-push-action@v0.8.0
with:
github_token: ${{ secrets.CI_TOKEN }}
branch: ${{ github.ref }}
99 changes: 34 additions & 65 deletions .github/workflows/GenerateReleaseZip.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
name: Generate Github Release Zip

env:
# Change this to point to your solution, or the folder in which your solution
# can be found.
SLN_PATH: Source/
# Change this to what you want your folder name to be in people's Mods/
# folder. It should be unique to your mod.
MOD_NAME: MeleeAnimation
Expand All @@ -12,6 +9,23 @@ env:
RELEASE_DRAFT: false
RELEASE_PRERELEASE: false

MOD_CONTENTS: |
About/
Animations/
Bundles/
WeaponTweakData/
Defs/
Patches/
Languages/
Patch_AlienRaces/
Patch_FacialAnimation/
Patch_Lightsabers/
Patch_CAI5000/
Patch_CombatExtended/
Sounds/
Textures/
loadfolders.xml
on:
push:
tags:
Expand All @@ -20,6 +34,7 @@ on:
- 'v*'

jobs:

build:
name: Build on ${{ matrix.operating-system }}
runs-on: ${{ matrix.operating-system }}
Expand All @@ -29,58 +44,35 @@ jobs:
# cross-platform using mono. I chose Ubuntu because it ran the fastest
# for the build steps.
operating-system: [ubuntu-latest]
rimworld-version: [1.4, 1.5] # Add Rimworld version here!
steps:
- name: Checkout Repository
uses: actions/checkout@v3
uses: actions/checkout@v4.1.4

- name: Setup Dotnet
uses: actions/setup-dotnet@v3
uses: actions/setup-dotnet@v4.0.0
with:
dotnet-version: 8.0.x

- name: Build Mod
run: dotnet build ${{ env.SLN_PATH }} --configuration Release

# I don't know how well testing will work without Rimworld actually installed.
# But if you have unit tests configured to work with dotnet, you may be able
# to uncomment this and add a testing step.
# - name: Test Mod
# run: dotnet test ${{ env.SLN_PATH }} --no-restore --verbosity normal

# There is no `zip` command on windows so you need to use tar.
# - name: Zip-up Mod
# run: tar --exclude="*." -zcvf dist.tar.gz About/ Assemblies/ Defs/ Languages/ Patches/ RimCI/ Sounds/ Textures/
- name: Build Mod (RW ${{ matrix.rimworld-version }})
run: dotnet build Source/${{ matrix.rimworld-version }} --configuration Release

# To modify this with your own directory structure, just change the paths to
# whatever you want. It will not upload any empty directories, those with only
# hidden files will also be excluded.
- name: Upload Mod Artifacts
uses: actions/upload-artifact@v3
- name: Upload Mod Artifacts (RW ${{ matrix.rimworld-version }})
uses: actions/upload-artifact@v4.3.3
with:
name: build
retention-days: 7
name: build-${{ matrix.rimworld-version }}
retention-days: 1
path: |
1.4/
1.5/
About/
Animations/
Bundles/
WeaponTweakData/
Defs/
Patches/
Languages/
Patch_AlienRaces/
Patch_FacialAnimation/
Patch_Lightsabers/
Patch_CAI5000/
Patch_CombatExtended/
Sounds/
Textures/
loadfolders.xml
${{ matrix.rimworld-version }}/
${{ env.MOD_CONTENTS }}
!**/.*
# This final path is to exclude hidden files such as .gitkeep and .DS_STORE.
# I would recommend keeping it, but I don't think it will break anything if
# you remove or modify it.

package:
name: Package
needs: build
Expand All @@ -90,37 +82,16 @@ jobs:
# This is a special syntax for GitHub Actions that sets an environment
# variable. See: https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable
run: echo "MOD_PATH=$HOME/$MOD_NAME" >> $GITHUB_ENV
# run: echo "::set-env name=MOD_PATH::$HOME/$MOD_NAME"

- name: Create Mod Folder
run: mkdir -p ${{ env.MOD_PATH }}

- name: Download Mod Artifacts from Build Step
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4.1.7
with:
name: build
# Note that 'name' is not specified, this will cause all artifacts from this run to be downloaded.
merge-multiple: true # Important, this merges the different rimworld version outputs
path: ${{ env.MOD_PATH }}

# If you have any other Rimworld folders that didn't get scooped up in the
# artifacts, add them here. It may be neccessary to change this for v1.1 mods.
- name: Create Mod Folders
run: |
mkdir -p ${{ env.MOD_PATH }}/1.4/
mkdir -p ${{ env.MOD_PATH }}/1.5/
mkdir -p ${{ env.MOD_PATH }}/About/
mkdir -p ${{ env.MOD_PATH }}/Animations/
mkdir -p ${{ env.MOD_PATH }}/Bundles/
mkdir -p ${{ env.MOD_PATH }}/WeaponTweakData/
mkdir -p ${{ env.MOD_PATH }}/Defs/
mkdir -p ${{ env.MOD_PATH }}/Patches/
mkdir -p ${{ env.MOD_PATH }}/Languages/
mkdir -p ${{ env.MOD_PATH }}/Patch_AlienRaces/
mkdir -p ${{ env.MOD_PATH }}/Patch_FacialAnimation/
mkdir -p ${{ env.MOD_PATH }}/Patch_Lightsabers/
mkdir -p ${{ env.MOD_PATH }}/Patch_CAI5000/
mkdir -p ${{ env.MOD_PATH }}/Patch_CombatExtended/
mkdir -p ${{ env.MOD_PATH }}/Sounds/
mkdir -p ${{ env.MOD_PATH }}/Textures/

- name: Zip Mod
run: |
Expand All @@ -143,13 +114,11 @@ jobs:
id: get_version
# This is a special syntax for GitHub Actions that sets an output
# variable. See: https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable
# run: echo ::set-output name=VERSION::$(echo ${{ github.ref }} | cut -d / -f 3)
run: echo "VERSION=$(echo ${{ github.ref }} | cut -d / -f 3)" >> $GITHUB_OUTPUT

- name: Set Environment Variables
# This is a special syntax for GitHub Actions that sets an environment
# variable. See: https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable
# run: echo "::set-env name=MOD_RELEASE::$MOD_NAME-${{ steps.get_version.outputs.VERSION }}"
run: echo "MOD_RELEASE=$MOD_NAME-${{ steps.get_version.outputs.VERSION }}" >> $GITHUB_ENV

- name: Download Mod Artifacts from Build Step
Expand All @@ -160,7 +129,7 @@ jobs:

- name: Create Release
id: create_release
uses: actions/create-release@v1
uses: actions/create-release@v1.1.4
env:
GITHUB_TOKEN: ${{ secrets.CI_TOKEN }}
with:
Expand Down
35 changes: 35 additions & 0 deletions Source/1.4/AMRetextureSupport/AMRetextureSupport.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net472</TargetFramework>
<OutputType>Library</OutputType>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<NoStdLib>false</NoStdLib>
<LangVersion>11</LangVersion>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
<RootNamespace>AM.Retexture</RootNamespace>
<Configurations>Release</Configurations>
<Nullable>disable</Nullable>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DebugType>none</DebugType>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Krafs.Publicizer" Version="2.2.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<!-- Ungodly hack to access rimworld private properties & methods -->
<Publicize Include="Assembly-CSharp" />
</ItemGroup>

<!-- _____ 1.4 _____ -->
<ItemGroup Condition="'$(Configuration)'=='Release'">
<PackageReference Include="Krafs.Rimworld.Ref" Version="1.4.3901" />
</ItemGroup>

</Project>
Loading

0 comments on commit 67d83e4

Please sign in to comment.