Skip to content

Commit

Permalink
Update scripts, packaging, and example mod for playtest-20201213.
Browse files Browse the repository at this point in the history
  • Loading branch information
pchote committed Jan 9, 2021
1 parent 570a304 commit 3a36491
Show file tree
Hide file tree
Showing 26 changed files with 565 additions and 624 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Continuous Integration

on:
push:
pull_request:

jobs:
linux-mono:
name: Linux (mono)
runs-on: ubuntu-20.04

steps:
- name: Clone Repository
uses: actions/checkout@v2

- name: Prepare Environment
run: |
. mod.config;
awk '/\r$$/ { exit(1); }' mod.config || (printf "Invalid mod.config format. File must be saved using unix-style (LF, not CRLF or CR) line endings.\n"; exit 1);
- name: Check Code
run: |
make check
make check-packaging-scripts
- name: Check Mod
run: |
sudo apt-get install lua5.1
make check-scripts
make test
windows:
name: Windows (Framework 4.7)
runs-on: windows-2019

steps:
- name: Clone Repository
uses: actions/checkout@v2

- name: Check Code
shell: powershell
run: |
dotnet nuget locals all --clear
.\make.ps1 check
- name: Check Mods
run: |
chocolatey install lua --version 5.1.5.52
$ENV:Path = $ENV:Path + ";C:\Program Files (x86)\Lua\5.1\"
.\make.ps1 check-scripts
.\make.ps1 test
93 changes: 93 additions & 0 deletions .github/workflows/packaging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: Release Packaging

on:
push:
tags:
- '*'

jobs:
linux:
name: Linux AppImages
runs-on: ubuntu-20.04

steps:
- name: Clone Repository
uses: actions/checkout@v2

- name: Prepare Environment
run: echo "GIT_TAG=${GITHUB_REF#refs/tags/}" >> ${GITHUB_ENV}

- name: Package AppImage
run: |
make engine
mkdir -p build/linux
./packaging/linux/buildpackage.sh "${GIT_TAG}" "${PWD}/build/linux"
- name: Upload Packages
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref }}
overwrite: true
file_glob: true
file: build/linux/*

macos:
name: macOS Disk Images
runs-on: macos-10.15

steps:
- name: Clone Repository
uses: actions/checkout@v2

- name: Prepare Environment
run: echo "GIT_TAG=${GITHUB_REF#refs/tags/}" >> ${GITHUB_ENV}

- name: Package Disk Images
env:
MACOS_DEVELOPER_IDENTITY: ${{ secrets.MACOS_DEVELOPER_IDENTITY }}
MACOS_DEVELOPER_CERTIFICATE_BASE64: ${{ secrets.MACOS_DEVELOPER_CERTIFICATE_BASE64 }}
MACOS_DEVELOPER_CERTIFICATE_PASSWORD: ${{ secrets.MACOS_DEVELOPER_CERTIFICATE_PASSWORD }}
MACOS_DEVELOPER_USERNAME: ${{ secrets.MACOS_DEVELOPER_USERNAME }}
MACOS_DEVELOPER_PASSWORD: ${{ secrets.MACOS_DEVELOPER_PASSWORD }}
run: |
make engine
mkdir -p build/macos
./packaging/macos/buildpackage.sh "${GIT_TAG}" "${PWD}/build/macos"
- name: Upload Packages
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref }}
overwrite: true
file_glob: true
file: build/macos/*

windows:
name: Windows Installers
runs-on: ubuntu-20.04

steps:
- name: Clone Repository
uses: actions/checkout@v2

- name: Prepare Environment
run: |
echo "GIT_TAG=${GITHUB_REF#refs/tags/}" >> ${GITHUB_ENV}
sudo apt install nsis
- name: Package Installers
run: |
make engine
mkdir -p build/windows
./packaging/windows/buildpackage.sh "${GIT_TAG}" "${PWD}/build/windows"
- name: Upload Packages
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref }}
overwrite: true
file_glob: true
file: build/windows/*
51 changes: 0 additions & 51 deletions .travis.yml

This file was deleted.

60 changes: 27 additions & 33 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# make check-sdk-scripts
# make check-packaging-scripts

.PHONY: utility stylecheck build clean engine version check check-scripts check-sdk-scripts check-packaging-scripts check-variables
.PHONY: check-sdk-scripts check-packaging-scripts check-variables engine all clean version check-scripts check test
.DEFAULT_GOAL := all

PYTHON = $(shell command -v python3 2> /dev/null)
Expand Down Expand Up @@ -48,8 +48,19 @@ MOD_SOLUTION_FILES = $(shell find . -maxdepth 1 -iname '*.sln' 2> /dev/null)

MSBUILD = msbuild -verbosity:m -nologo

# Enable 32 bit builds while generating the windows installer
WIN32 = false
ifndef TARGETPLATFORM
UNAME_S := $(shell uname -s)
UNAME_M := $(shell uname -m)
ifeq ($(UNAME_S),Darwin)
TARGETPLATFORM = osx-x64
else
ifeq ($(UNAME_M),x86_64)
TARGETPLATFORM = linux-x64
else
TARGETPLATFORM = unix-generic
endif
endif
endif

check-sdk-scripts:
@awk '/\r$$/ { exit(1); }' mod.config || (printf "Invalid mod.config format: file must be saved using unix-style (CR, not CRLF) line endings.\n"; exit 1)
Expand Down Expand Up @@ -110,43 +121,26 @@ check-variables:
exit 1; \
fi

engine-dependencies: check-variables check-sdk-scripts
@./fetch-engine.sh || (printf "Unable to continue without engine files\n"; exit 1)
@cd $(ENGINE_DIRECTORY) && make dependencies WIN32=$(WIN32)

engine: check-variables check-sdk-scripts
@./fetch-engine.sh || (printf "Unable to continue without engine files\n"; exit 1)
@cd $(ENGINE_DIRECTORY) && make core WIN32=$(WIN32)

utility: engine-dependencies engine
@test -f "$(ENGINE_DIRECTORY)/OpenRA.Utility.exe" || (printf "OpenRA.Utility.exe not found!\n"; exit 1)
@cd $(ENGINE_DIRECTORY) && make all

core:
@command -v $(MSBUILD) >/dev/null || (echo "OpenRA requires the '$(MSBUILD)' tool provided by Mono >= 5.4."; exit 1)
all: engine
@command -v $(MSBUILD) >/dev/null || (echo "OpenRA requires the '$(MSBUILD)' tool provided by Mono >= 5.18."; exit 1)
ifneq ("$(MOD_SOLUTION_FILES)","")
@find . -maxdepth 1 -name '*.sln' -exec $(MSBUILD) -t:restore \;
ifeq ($(WIN32), $(filter $(WIN32),true yes y on 1))
@find . -maxdepth 1 -name '*.sln' -exec $(MSBUILD) -t:build -p:Configuration="Release-x86" \;
else
@$(MSBUILD) -t:build -p:Configuration=Release
@find . -maxdepth 1 -name '*.sln' -exec $(MSBUILD) -t:build -p:Configuration=Release \;
@find . -maxdepth 1 -name '*.sln' -exec $(MSBUILD) -t:Build -restore -p:Configuration=Release -p:TargetPlatform=$(TARGETPLATFORM) \;
endif
endif

all: engine-dependencies engine core

clean: engine
@command -v $(MSBUILD) >/dev/null || (echo "OpenRA requires the '$(MSBUILD)' tool provided by Mono >= 5.4."; exit 1)
@command -v $(MSBUILD) >/dev/null || (echo "OpenRA requires the '$(MSBUILD)' tool provided by Mono >= 5.18."; exit 1)
ifneq ("$(MOD_SOLUTION_FILES)","")
@find . -maxdepth 1 -name '*.sln' -exec $(MSBUILD) -t:clean \;
endif
@cd $(ENGINE_DIRECTORY) && make clean
@printf "The engine has been cleaned.\n"

version: check-variables
@awk '{sub("Version:.*$$","Version: $(VERSION)"); print $0}' $(MANIFEST_PATH) > $(MANIFEST_PATH).tmp && \
awk '{sub("/[^/]*: User$$", "/$(VERSION): User"); print $0}' $(MANIFEST_PATH).tmp > $(MANIFEST_PATH) && \
rm $(MANIFEST_PATH).tmp
@sh -c '. $(ENGINE_DIRECTORY)/packaging/functions.sh; set_mod_version $(VERSION) $(MANIFEST_PATH)'
@printf "Version changed to $(VERSION).\n"

check-scripts: check-variables
Expand All @@ -159,18 +153,18 @@ ifneq ("$(LUA_FILES)","")
@luac -p $(LUA_FILES)
endif

check: utility
check: engine
ifneq ("$(MOD_SOLUTION_FILES)","")
@echo "Compiling in debug mode..."
@$(MSBUILD) -t:build -p:Configuration=Debug
@$(MSBUILD) -t:build -restore -p:Configuration=Debug
endif
@echo "Checking runtime assemblies..."
@MOD_SEARCH_PATHS="$(MOD_SEARCH_PATHS)" mono --debug "$(ENGINE_DIRECTORY)/OpenRA.Utility.exe" $(MOD_ID) --check-runtime-assemblies $(WHITELISTED_OPENRA_ASSEMBLIES) $(WHITELISTED_THIRDPARTY_ASSEMBLIES) $(WHITELISTED_CORE_ASSEMBLIES) $(WHITELISTED_MOD_ASSEMBLIES)
@./utility.sh --check-runtime-assemblies $(WHITELISTED_OPENRA_ASSEMBLIES) $(WHITELISTED_THIRDPARTY_ASSEMBLIES) $(WHITELISTED_CORE_ASSEMBLIES) $(WHITELISTED_MOD_ASSEMBLIES)
@echo "Checking for explicit interface violations..."
@MOD_SEARCH_PATHS="$(MOD_SEARCH_PATHS)" mono --debug "$(ENGINE_DIRECTORY)/OpenRA.Utility.exe" $(MOD_ID) --check-explicit-interfaces
@./utility.sh --check-explicit-interfaces
@echo "Checking for incorrect conditional trait interface overrides..."
@MOD_SEARCH_PATHS="$(MOD_SEARCH_PATHS)" mono --debug "$(ENGINE_DIRECTORY)/OpenRA.Utility.exe" $(MOD_ID) --check-conditional-trait-interface-overrides
@./utility.sh --check-conditional-trait-interface-overrides

test: utility
test: all
@echo "Testing $(MOD_ID) mod MiniYAML..."
@MOD_SEARCH_PATHS="$(MOD_SEARCH_PATHS)" mono --debug "$(ENGINE_DIRECTORY)/OpenRA.Utility.exe" $(MOD_ID) --check-yaml
@./utility.sh --check-yaml
13 changes: 5 additions & 8 deletions OpenRA.Mods.Example/OpenRA.Mods.Example.csproj
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net461</TargetFramework>
<TargetFramework>net472</TargetFramework>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Optimize>true</Optimize>
<LangVersion>5</LangVersion>
<LangVersion>7.3</LangVersion>
<DebugSymbols>true</DebugSymbols>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<OutputPath>../mods/example</OutputPath>
<OutputPath>../engine/bin</OutputPath>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<PlatformTarget>AnyCPU</PlatformTarget>
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
Expand All @@ -21,17 +21,14 @@
<Optimize>false</Optimize>
</PropertyGroup>
<ItemGroup>
<Reference Include="Eluant">
<HintPath>../engine/thirdparty/download/Eluant.dll</HintPath>
<Private>False</Private>
</Reference>
<ProjectReference Include="../engine/OpenRA.Game/OpenRA.Game.csproj">
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="../engine/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj">
<Private>False</Private>
</ProjectReference>
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" />
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" PrivateAssets="All" />
<AdditionalFiles Include="../engine/stylecop.json" />
</ItemGroup>
<Target Name="DisableAnalyzers" BeforeTargets="CoreCompile" Condition="'$(Configuration)'=='Release'">
Expand All @@ -40,4 +37,4 @@
<Analyzer Remove="@(Analyzer)" />
</ItemGroup>
</Target>
</Project>
</Project>
4 changes: 2 additions & 2 deletions launch-dedicated.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ if "!MOD_ID!" == "" goto badconfig
if "!ENGINE_VERSION!" == "" goto badconfig
if "!ENGINE_DIRECTORY!" == "" goto badconfig

if not exist %ENGINE_DIRECTORY%\OpenRA.Game.exe goto noengine
if not exist %ENGINE_DIRECTORY%\bin\OpenRA.exe goto noengine
>nul find %ENGINE_VERSION% %ENGINE_DIRECTORY%\VERSION || goto noengine
cd %ENGINE_DIRECTORY%

:loop
OpenRA.Server.exe Game.Mod=%MOD_ID% Server.Name=%Name% Server.ListenPort=%ListenPort% Server.AdvertiseOnline=%AdvertiseOnline% Server.EnableSingleplayer=%EnableSingleplayer% Server.Password=%Password% Server.RequireAuthentication=%RequireAuthentication% Server.ProfileIDBlacklist=%ProfileIDBlacklist% Server.ProfileIDWhitelist=%ProfileIDWhitelist% Server.EnableSyncReports=%EnableSyncReports% Server.EnableGeoIP=%EnableGeoIP% Server.ShareAnonymizedIPs=%ShareAnonymizedIPs% Engine.SupportDir=%SupportDir%
bin\OpenRA.Server.exe Game.Mod=%MOD_ID% Engine.EngineDir=".." Server.Name=%Name% Server.ListenPort=%ListenPort% Server.AdvertiseOnline=%AdvertiseOnline% Server.EnableSingleplayer=%EnableSingleplayer% Server.Password=%Password% Server.RequireAuthentication=%RequireAuthentication% Server.ProfileIDBlacklist=%ProfileIDBlacklist% Server.ProfileIDWhitelist=%ProfileIDWhitelist% Server.EnableSyncReports=%EnableSyncReports% Server.EnableGeoIP=%EnableGeoIP% Server.ShareAnonymizedIPs=%ShareAnonymizedIPs% Engine.SupportDir=%SupportDir%
goto loop

:noengine
Expand Down
2 changes: 1 addition & 1 deletion launch-dedicated.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ fi
cd "${ENGINE_DIRECTORY}"

while true; do
MOD_SEARCH_PATHS="${MOD_SEARCH_PATHS}" mono --debug OpenRA.Server.exe Game.Mod="${LAUNCH_MOD}" \
MOD_SEARCH_PATHS="${MOD_SEARCH_PATHS}" mono --debug bin/OpenRA.Server.exe Engine.EngineDir=".." Game.Mod="${LAUNCH_MOD}" \
Server.Name="${NAME}" Server.ListenPort="${LISTEN_PORT}" \
Server.AdvertiseOnline="${ADVERTISE_ONLINE}" \
Server.Password="${PASSWORD}" \
Expand Down
4 changes: 2 additions & 2 deletions launch-game.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ if "!ENGINE_VERSION!" == "" goto badconfig
if "!ENGINE_DIRECTORY!" == "" goto badconfig

set TEMPLATE_DIR=%CD%
if not exist %ENGINE_DIRECTORY%\OpenRA.Game.exe goto noengine
if not exist %ENGINE_DIRECTORY%\bin\OpenRA.exe goto noengine
>nul find %ENGINE_VERSION% %ENGINE_DIRECTORY%\VERSION || goto noengine
cd %ENGINE_DIRECTORY%

OpenRA.Game.exe Game.Mod=%MOD_ID% Engine.LaunchPath="%TEMPLATE_LAUNCHER%" "Engine.ModSearchPaths=%MOD_SEARCH_PATHS%" "%*"
bin\OpenRA.exe Game.Mod=%MOD_ID% Engine.EngineDir=".." Engine.LaunchPath="%TEMPLATE_LAUNCHER%" "Engine.ModSearchPaths=%MOD_SEARCH_PATHS%" "%*"
set ERROR=%errorlevel%
cd %TEMPLATE_DIR%

Expand Down
4 changes: 2 additions & 2 deletions launch-game.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ fi
require_variables "MOD_ID" "ENGINE_VERSION" "ENGINE_DIRECTORY"

cd "${TEMPLATE_ROOT}"
if [ ! -f "${ENGINE_DIRECTORY}/OpenRA.Game.exe" ] || [ "$(cat "${ENGINE_DIRECTORY}/VERSION")" != "${ENGINE_VERSION}" ]; then
if [ ! -f "${ENGINE_DIRECTORY}/bin/OpenRA.exe" ] || [ "$(cat "${ENGINE_DIRECTORY}/VERSION")" != "${ENGINE_VERSION}" ]; then
echo "Required engine files not found."
echo "Run \`make\` in the mod directory to fetch and build the required files, then try again.";
exit 1
fi

cd "${ENGINE_DIRECTORY}"
mono OpenRA.Game.exe Engine.LaunchPath="${TEMPLATE_LAUNCHER}" "Engine.ModSearchPaths=${MOD_SEARCH_PATHS}" Game.Mod="${MOD_ID}" "$@"
mono --debug bin/OpenRA.exe Engine.EngineDir=".." Engine.LaunchPath="${TEMPLATE_LAUNCHER}" "Engine.ModSearchPaths=${MOD_SEARCH_PATHS}" Game.Mod="${MOD_ID}" "$@"

0 comments on commit 3a36491

Please sign in to comment.