Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature - Add github workflows for wiki generation #6188

Merged
merged 83 commits into from
May 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
18e2990
create basic framework for wf
relent0r May 13, 2024
3ac6275
add comment to confirm the destination location for converted icons
relent0r May 13, 2024
3d8a955
update
relent0r May 13, 2024
14bfabd
update checkout type
relent0r May 13, 2024
0d3092e
try sparse checkout again
relent0r May 13, 2024
0446fd2
find magick install location
relent0r May 13, 2024
59c3459
try reveal location again
relent0r May 13, 2024
bf6ac1d
try again
relent0r May 13, 2024
88b17eb
update
relent0r May 13, 2024
88978f2
pff
relent0r May 13, 2024
5ac17e6
dont really get this
relent0r May 13, 2024
d485599
why cant i find this
relent0r May 13, 2024
21e0e7f
update to use correct command line
relent0r May 13, 2024
c1d2646
retest
relent0r May 13, 2024
8cd869a
add directory exists check
relent0r May 13, 2024
2bd7e06
dump current directory
relent0r May 13, 2024
3aa60e7
wtf
relent0r May 13, 2024
557cbef
more checks
relent0r May 13, 2024
e4cec90
did we accidentally not check anything out
relent0r May 13, 2024
12363cc
update
relent0r May 14, 2024
197678d
update sparse checkout location
relent0r May 14, 2024
439055e
validate destination folder
relent0r May 14, 2024
e0d2552
add verbose for logging
relent0r May 14, 2024
e780476
split into two icon sets
relent0r May 14, 2024
8477d59
update names
relent0r May 14, 2024
a8a6cb6
add check for run.lua
relent0r May 14, 2024
606bc4a
Merge branch 'deploy/fafdevelop' into feat/github-wf-icons
relent0r May 14, 2024
695e361
validate that files exist
relent0r May 14, 2024
3d9bc33
add wiki to checkout
relent0r May 14, 2024
a9ec76d
add params for run.lua
relent0r May 14, 2024
8ad5a17
update to use my branch for testing
relent0r May 14, 2024
2a9bad6
update units to the same
relent0r May 14, 2024
6d5d6ff
use the right repo to go with that branch
relent0r May 14, 2024
8ca1416
why is this not picking up the parameters
relent0r May 14, 2024
e7f0907
dont bother chewing the restraints
relent0r May 14, 2024
7e793b4
print the arg table because I need to know
relent0r May 14, 2024
0be0391
try using the correct table reference for the args
relent0r May 14, 2024
1fd4b39
check match values
relent0r May 14, 2024
c6781bf
discect args
relent0r May 14, 2024
9ddadb1
check the args key values
relent0r May 14, 2024
ad8db8c
try dump the args table
relent0r May 14, 2024
ffb24da
strip leading --
relent0r May 14, 2024
0223ad0
add FA directory
relent0r May 14, 2024
97f7771
add missing dir
relent0r May 14, 2024
2824351
remove logging
relent0r May 14, 2024
64b0223
update
relent0r May 15, 2024
700c1aa
add units to sparse checkout
relent0r May 15, 2024
6a470a0
add projectiles to sparse checkout
relent0r May 15, 2024
bba2ef6
update based on feedback
relent0r May 15, 2024
9169fd1
does workflow dispatch require to be on the main branch?
relent0r May 15, 2024
627ed29
readd branch push for testing
relent0r May 15, 2024
8ec6547
readd wiki folder
relent0r May 15, 2024
68c5a59
run script under admin context
relent0r May 15, 2024
3bbdcc1
unable to find scripts now
relent0r May 15, 2024
76f1f38
sudo cant find script
relent0r May 15, 2024
6f4fea9
typo
relent0r May 15, 2024
89cd563
try use workspace var for script location
relent0r May 15, 2024
b4a3dbf
workspace check
relent0r May 15, 2024
4c5e723
update
relent0r May 15, 2024
0d124e1
bash script run
relent0r May 15, 2024
e1d51cc
update scripts for usage
relent0r May 15, 2024
41459dc
retry
relent0r May 15, 2024
17d16ee
remove unneeded function
relent0r May 15, 2024
726f60e
validate wiki output
relent0r May 15, 2024
4fe7217
output confirmed. fix typo
relent0r May 15, 2024
47cca44
are we fixing units?
relent0r May 15, 2024
6a2ba25
why cant we find the wiki scripts
relent0r May 15, 2024
8b5dec4
fix typo
relent0r May 15, 2024
5e877cc
refine sparse checkout for units
relent0r May 15, 2024
58047d9
make sh executable
relent0r May 16, 2024
9ff8ae3
revert scripts and try set working directory
relent0r May 16, 2024
8447b6b
action run
relent0r May 16, 2024
fdd3558
magick is not available on this version.
relent0r May 16, 2024
f75a6e8
set +x back again
May 16, 2024
7d82aec
why is this failing suddenly
May 16, 2024
94d6b5d
add comments for sparse checkout reasoning.
May 17, 2024
7f77ebf
Update the generate-icons workflow
Garanas May 19, 2024
1a51fe3
update for just blueprints
relent0r May 19, 2024
3640528
rename workflows to be correct
relent0r May 19, 2024
dab8b5b
update to use correct branches and triggers
relent0r May 19, 2024
994bfcf
Skip checking the run.lua file as it is written using Lua 5.4
Garanas May 20, 2024
6fa5393
Correct syntax
Garanas May 20, 2024
76d75e6
Add a snippet
Garanas May 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 84 additions & 0 deletions .github/workflows/wiki-generate-blueprints.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: FAF Wiki Generator for Blueprints

on:
workflow_dispatch:

jobs:

generate-blueprints:
runs-on: ubuntu-latest
defaults:
run:
shell: bash

steps:
# Checkout repos, FA repo is sparse checkout as it is quite large
- name: Checkout Brewlan Wikigen Repository
uses: actions/checkout@v4
with:
repository: The-Balthazar/BrewWikiGen
ref: master
path: ./brew-wiki-gen
# FA repo is sparse checkout as it is quite large and we dont won't to incur higher action minutes for no reason
- name: Checkout FAF Repository # -png folder doesnt exist yet, confirm location.
uses: actions/checkout@v4
with:
repository: FAForever/fa
ref: deploy/develop
path: ./fa
sparse-checkout-cone-mode: |
wiki
loc
lua/ui/help/unitscription.lua
lua/ui/help/tooltips.lua
lua/sim/AdjacencyBuffs.lua
lua/system/Blueprints.lua
units/*_unit.bp
units/*_LOD0.scm
projectiles

- name: Checkout FAF Wiki Repository
uses: actions/checkout@v4
with:
repository: FAForever/fa.wiki
ref: master
path: ./fa.wiki

- name: Install Lua 5.4
uses: leafo/gh-actions-lua@v10
with:
luaVersion: "5.4"

- name: Replace run.lua
run: |
sudo mv fa/wiki/Run.lua brew-wiki-gen/Run.lua

- name: Execute lua run
run: |
lua brew-wiki-gen/Run.lua --OutputDirectory="fa.wiki/" --WikiGeneratorDirectory="brew-wiki-gen/" --FADirectory="fa/"


- name: Upload as artifact
uses: actions/upload-artifact@v4
with:
name: Wiki
path: fa.wiki

#- name: Store the game version
# id: gameVersionJSON # but it is a string here!
# working-directory: app/data
# run: |
# json=`cat ./version.json`
# echo "json=$json" >> $GITHUB_OUTPUT

#- name: Update Wiki repository # but it is a string here!
# working-directory: fa.wiki
# run: |
# git config user.email "administrator@faforever.com"
# git config user.name "FAForever"

# git stage .
# git commit -m "Update generated data to game version ${{ fromJson(steps.gameVersionJSON.outputs.json).version}}"
# git push origin HEAD:master


73 changes: 73 additions & 0 deletions .github/workflows/wiki-generate-icons.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: FAF Wiki Generator for icons

on:
workflow_dispatch:

jobs:

generate-icons:
runs-on: ubuntu-latest
defaults:
run:
shell: bash

steps:
# Checkout repos

# FA repo is sparse checkout as it is quite large and we dont won't to incur higher action minutes for no reason
- name: Checkout FAF Repository # -png folder doesnt exist yet, confirm location.
uses: actions/checkout@v4
with:
repository: FAForever/fa
ref: deploy/develop
path: ./fa
sparse-checkout: |
wiki
textures/ui/common/game/strategicicons
textures/ui/common/icons/units

- name: Checkout FAF Wiki Repository
uses: actions/checkout@v4
with:
repository: FAForever/fa.wiki
ref: master
path: ./fa.wiki

- name: Install Image Magick
run: |
sudo apt-get install -y imagemagick

# copy strategic and unit icons and convert them to PNGs. Assume this should be going to the wiki location not the fa repo
- name: Convert Strategic Icons
working-directory: fa
run: |
wiki/icons-convert-strategic.sh
wiki/icons-convert-unit.sh

- name: Move Strategic Icons
run: |
mv -f fa/wiki/generated/strategicicons/*.png fa.wiki/icons/strategicicons
mv -f fa/wiki/generated/units/*.png fa.wiki/icons/units

- name: Upload as artifact
uses: actions/upload-artifact@v4
with:
name: Wiki
path: fa.wiki

# - name: Store the game version
# id: gameVersionJSON # but it is a string here!
# working-directory: app/data
# run: |
# json=`cat ./version.json`
# echo "json=$json" >> $GITHUB_OUTPUT

# - name: Update Wiki repository # but it is a string here!
# working-directory: fa.wiki
# run: |
# git config user.email "administrator@faforever.com"
# git config user.name "FAForever"

# git stage .
# git commit -m "Update generated data to game version ${{ fromJson(steps.gameVersionJSON.outputs.json).version}}"
# git push origin HEAD:master
1 change: 1 addition & 0 deletions changelog/snippets/other.6188.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- (#6188) Create a Github workflow to automate the population of the Wiki
6 changes: 4 additions & 2 deletions tests/run-syntax-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ while read file; do
if [ "$file" != "./.vscode/fa-plugin.lua" ]; then
if [ "$file" != "./lua/system/class.lua" ]; then
if [ "$file" != "./lua/sim/NavGenerator.lua" ]; then
check_file "$file"
(( files_checked++ ))
if [ "$file" != "./wiki/Run.lua" ]; then
check_file "$file"
(( files_checked++ ))
fi
fi
fi
fi
Expand Down
40 changes: 36 additions & 4 deletions wiki/Run.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,52 @@
--[[ ---------------------------------------------------------------------- ]]--
local OutputDirectory = "D:/faf-development/fa.wiki/"
local WikiGeneratorDirectory = "D:/faf-development/BrewWikiGen/"
local FADirectory = "D:/faf-development/fa/"

-- This section deals with overriding the OutputDirectory and WikiGeneratorDirectory if required
relent0r marked this conversation as resolved.
Show resolved Hide resolved
local function parse_args(arg)
local args = {}
for i = 1, #arg do
local key, value = arg[i]:match("--([^=]+)=(.*)")
if key and value then
key = key:gsub("^%-+", "") -- Remove leading '-' characters
args[key] = value
end
end
return args
end

local args = parse_args(arg)

-- Overwrite default values if provided as command-line arguments
if args["OutputDirectory"] then
OutputDirectory = args["OutputDirectory"]
end
if args["WikiGeneratorDirectory"] then
WikiGeneratorDirectory = args["WikiGeneratorDirectory"]
end
if args["FADirectory"] then
FADirectory = args["FADirectory"]
end

print("Directories set")
print("Output Directory: " ..OutputDirectory)
print("Wiki Generator Directory: " ..WikiGeneratorDirectory)
print("FA Directory: " ..FADirectory)

EnvironmentData = {
name = 'Forged Alliance Forever',
author = 'Gas Powered Games',
version = '1.6.6',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Version should be the current dev branch FAF version, 1.6.6 is the Steam version, and the Author should us; The FAF development team or something.

icon = false,
location = 'D:/faf-development/fa/',
location = FADirectory,

GenerateWikiPages = true, --Generate pages for env blueprints
RebuildBlueprints = true, --Rebuild env blueprints
RunSanityChecks = false, --Sanity check env bps

Lua = 'D:/faf-development/fa/',
LOC = 'D:/faf-development/fa/',
Lua = FADirectory,
LOC = FADirectory,
-- ExtraData = '',

PreModBlueprints = {},
Expand All @@ -46,7 +78,7 @@ WikiOptions = {
BuildListSaysModUnits = true,

OnlineRepoUnitPageBlueprintLink = 'https://github.com/FAForever/fa/',
LocalRepuUnitPageBlueprintLink = 'D:/faf-development/fa/',
LocalRepuUnitPageBlueprintLink = FADirectory,
}

RebuildBlueprintOptions = {
Expand Down
4 changes: 2 additions & 2 deletions wiki/icons-convert-strategic.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ fi

mkdir "wiki/generated/strategicicons"

magick mogrify -path "wiki/generated/strategicicons" -format png "textures/ui/common/game/strategicicons/*.dds"
mogrify -path "wiki/generated/strategicicons" -format png "textures/ui/common/game/strategicicons/*.dds"

read -p "Press enter to continue"
#read -p "Press enter to continue"
4 changes: 2 additions & 2 deletions wiki/icons-convert-unit.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ fi

mkdir "wiki/generated/units"

magick mogrify -path "wiki/generated/units" -format png "textures/ui/common/icons/units/*.dds"
mogrify -path "wiki/generated/units" -format png "textures/ui/common/icons/units/*.dds"

read -p "Press enter to continue"
#read -p "Press enter to continue"