-
Notifications
You must be signed in to change notification settings - Fork 250
Add a workflow to bake blueprint properties of props #6752
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
Merged
Garanas
merged 50 commits into
FAForever:develop
from
Garanas:feature/workflow-bake-props
May 3, 2025
Merged
Changes from all commits
Commits
Show all changes
50 commits
Select commit
Hold shift + click to select a range
cd759c2
Add a workflow file to bake blueprint properties
Garanas d25ae78
Copy from the `fa` folder
Garanas c23a0dd
Listen to program arguments
Garanas 2fb8ac5
Copy instead of moving the run file
Garanas 4279c8b
Add some dummy changes for testing purposes
Garanas 28541b7
Replace all the references
Garanas 65fd322
Rebuild prop blueprints
Garanas d2f086c
Fix a Lua syntax error
Garanas e569dc4
Add a snippet
Garanas 7d29420
Use the SSH key of the machine user of FAForever
Garanas 276fad3
Update changelog/snippets/other.6752.md
Garanas 6c3a914
Update .github/workflows/scripts/baking/bake-props.lua
Garanas 3ecae80
Use cone mode properly
Garanas 2c65bef
Try and fix sparse checkout
Garanas abca223
Try and fix sparse checkout
Garanas 20e4eeb
Ignore all Lua files inside the .github folder
Garanas a480f06
Create a commit or pull request depending on the workflow event
Garanas eedf195
Add some change to commit
Garanas d8cf191
Stage files instead of add
Garanas 8501dd8
Make changes that should be detected when rebuilding
Garanas 642488c
Derp, include the blueprint post processing lua files
Garanas 5182a4c
Include all source files
Garanas b7c08af
Allow the commit to fail
Garanas 5a0cdaf
Use the reference input
Garanas bb95980
Update .github/workflows/scripts/baking/bake-props.lua
Garanas 18e8b4e
Use the reference variable - not the string value
Garanas de9b184
Adjust the naming convention for baking properties
Garanas 3eb6565
Fix the description of the reference input
Garanas a115269
Tweak descriptions and properties of the baking workflow
Garanas e3e5be3
Ignore Lua in the .Github folder when checking syntax
Garanas 2c0450a
Do not use cone mode when checking out for the test
Garanas c35f2d5
Specify only files that we ship for syntax test
Garanas 5c38624
Add all files inside folders
Garanas 67dc0e9
Add missing Lua files
Garanas 2aa8452
Use a double asterisk to catch remaining Lua files
Garanas 05cf922
Try and catch all Lua files
Garanas 80dd64c
Decipher what 100 files we're missing
Garanas 2d70411
Add missing asterisk
Garanas 1b2804b
Add Lua files inside the textures folder
Garanas d6ff0cb
Include the textures folder
Garanas 63d014a
Remove debug statement
Garanas ec0e668
Add details to the commit message
Garanas 8382e03
Add more details to the pull request body
Garanas 774f626
Match the name of the job with its purpose
Garanas 7b449c3
Remove spaces to indicate the creation of a variable
Garanas 97f13c0
Do not add more details to the pull request body
Garanas 2a62523
Remove space after the use of `\`
Garanas 9b970bb
Add a more descriptive pull request
Garanas b453a69
Remove dummy changes to test
Garanas 90f3664
Add a snippet about changes to the test workflow
Garanas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,137 @@ | ||
| # Copyright (c) 2025 Willem 'Jip' Wijnia | ||
| # | ||
| # Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| # of this software and associated documentation files (the "Software"), to deal | ||
| # in the Software without restriction, including without limitation the rights | ||
| # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| # copies of the Software, and to permit persons to whom the Software is | ||
| # furnished to do so, subject to the following conditions: | ||
| # | ||
| # The above copyright notice and this permission notice shall be included in all | ||
| # copies or substantial portions of the Software. | ||
| # | ||
| # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| # SOFTWARE. | ||
|
|
||
| name: Bake blueprints | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| blueprints: | ||
| required: true | ||
| type: choice | ||
| description: The type of blueprints to bake properties into | ||
| options: | ||
| - props | ||
| - units | ||
| - projectiles | ||
| - emitters | ||
|
|
||
| reference: | ||
| required: true | ||
| type: choice | ||
| description: The reference (branch or tag) to use as a basis for baking. | ||
| options: | ||
| - develop | ||
| - staging/faf | ||
| - staging/fafbeta | ||
| - staging/fafdevelop | ||
|
|
||
| env: | ||
| COMMIT_MESSAGE: "Bake properties of ${{ inputs.blueprints }}\r\n\r\nThis commit originates from automation through GitHub Actions. The run was initiated by ${{ github.actor }}.\r\n\r\nThe run can be found at ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}." | ||
| PULL_REQUEST_BODY: "This pull request originates from automation through GitHub Actions. The run was initiated by ${{ github.actor }}.\r\n\r\nThe run can be found at ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}. It involves the baking of properties into blueprints of ${{ inputs.blueprints }}. By baking in the properties we make it easier to understand the behavior of the blueprints." | ||
|
|
||
| jobs: | ||
| bake-blueprints: | ||
| runs-on: ubuntu-latest | ||
| defaults: | ||
| run: | ||
| shell: bash | ||
|
|
||
| steps: | ||
| # Checkout the wiki generator that we use to bake blueprints | ||
| - name: Checkout Brewlan Wikigen Repository | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| repository: The-Balthazar/BrewWikiGen | ||
| path: ./brew-wiki-gen | ||
|
|
||
| # Checkout the FA repository | ||
| - name: Checkout FAF Repository | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| ref: ${{ inputs.reference }} | ||
| ssh-key: ${{ secrets.SSH_FAFOREVER_MACHINE_USER }} | ||
| path: ./fa | ||
| sparse-checkout-cone-mode: false | ||
| sparse-checkout: | | ||
| *.lua | ||
| *.bp | ||
|
|
||
| # Install the correct version of Lua for the wiki generator | ||
| - name: Install Lua 5.4 | ||
| uses: leafo/gh-actions-lua@v10 | ||
| with: | ||
| luaVersion: "5.4" | ||
|
|
||
| # Prepare the run file | ||
| - name: Replace run.lua | ||
| run: | | ||
| FILE="fa/.github/workflows/scripts/baking/bake-${{ inputs.blueprints }}.lua" | ||
| if [ ! -f "$FILE" ]; then | ||
| echo "Error: File $FILE does not exist." | ||
| exit 1 | ||
| fi | ||
|
|
||
| sudo cp "$FILE" brew-wiki-gen/Run.lua | ||
|
|
||
| # Use the wiki generator to bake the properties | ||
| - name: Execute lua run | ||
| run: | | ||
| lua brew-wiki-gen/Run.lua --OutputDirectory="fa.wiki/" --WikiGeneratorDirectory="brew-wiki-gen/" --FADirectory="fa/" | ||
|
|
||
| # Create a branch, commit and pull request | ||
| - name: Create a pull request | ||
| if: github.event_name == 'workflow_dispatch' | ||
| working-directory: fa | ||
| run: | | ||
| git config user.email "github@faforever.com" | ||
| git config user.name "FAForever Machine User" | ||
|
|
||
| git checkout -b bake/${{ inputs.blueprints }}-${{ github.run_id }} | ||
|
|
||
| git stage . | ||
| git commit -m "${{ env.COMMIT_MESSAGE }}" | ||
| git push origin bake/${{ inputs.blueprints }}-${{ github.run_id }} | ||
|
|
||
| # Install GitHub CLI (gh) | ||
| sudo apt update | ||
| sudo apt install gh -y | ||
|
|
||
| # Authenticate gh (use GITHUB_TOKEN) | ||
| echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --with-token | ||
|
|
||
| # Create a pull request | ||
| gh pr create \ | ||
| --title "Bake properties of ${{ inputs.blueprints }}" \ | ||
| --body "${{ env.PULL_REQUEST_BODY }}" \ | ||
| --base "${{ github.ref_name }}" \ | ||
| --head "bake/${{ inputs.blueprints }}-${{ github.run_id }}" | ||
|
|
||
| # Create a commit and push it | ||
| - name: Create a commit | ||
| if: github.event_name != 'workflow_dispatch' | ||
| working-directory: fa | ||
| run: | | ||
| git config user.email "github@faforever.com" | ||
| git config user.name "FAForever Machine User" | ||
|
|
||
| git add . | ||
| git commit -m "${{ env.COMMIT_MESSAGE }}" | ||
| git push |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,211 @@ | ||
| -------------------------------------------------------------------------------- | ||
| -- Supreme Commander mod automatic unit wiki generation script for Github wikis | ||
| -- Copyright 2021-2022 Sean 'Balthazar' Wheeldon Lua 5.4.2 | ||
| -------------------------------------------------------------------------------- | ||
|
|
||
| --[{ ---------------------------------------------------------------------- ]]-- | ||
| --[[ Inputs -- NOTE: Mod input files must be valid lua ]]-- | ||
| --[[ ---------------------------------------------------------------------- ]]-- | ||
| local OutputDirectory = "D:/faf-development/fa.wiki/" | ||
| local WikiGeneratorDirectory = "D:/faf-development/BrewWikiGen/" | ||
| local FADirectory = "D:/faf-development/fa/" | ||
|
|
||
| --#region This section deals with overriding the OutputDirectory and WikiGeneratorDirectory if required by command-line arguments | ||
|
|
||
| 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) | ||
| --#endregion | ||
|
|
||
| EnvironmentData = { | ||
| name = 'Forged Alliance', | ||
| author = 'Gas Powered Games', | ||
| version = '1.6.6', | ||
| icon = false, | ||
| location = FADirectory, | ||
|
|
||
| GenerateWikiPages = false, | ||
| RebuildBlueprints = true, | ||
| RunSanityChecks = false, | ||
|
|
||
| base64 = { | ||
| UnitIcons = false, | ||
| }, | ||
|
|
||
| Lua = FADirectory, | ||
| LOC = FADirectory, | ||
|
|
||
| PreModBlueprints = {}, | ||
| PostModBlueprints = { | ||
| "BakePropBlueprints" | ||
| }, | ||
|
|
||
| LoadExtraBlueprints = { | ||
| Beam = false, | ||
| Mesh = false, | ||
| Prop = true, | ||
| Emitter = false, | ||
| TrailEmitter = false, | ||
| }, | ||
| } | ||
|
|
||
| WikiOptions = { | ||
| Language = 'US', -- These are not ISO_639-1. As an Englishman I am offended. | ||
|
|
||
| GenerateHomePage = false, | ||
| GenerateSidebar = false, | ||
| GenerateModPages = false, | ||
| GenerateUnitPages = false, | ||
| GenerateProjectilesPage = false, | ||
| GenerateCategoryPages = false, | ||
|
|
||
| -- Unit page options | ||
| IncludeStrategicIcon = false, | ||
| AbilityDescriptions = false, | ||
| BalanceNote = '<LOC wiki_balance_stats_steam>Displayed stats are from when launched on the steam/retail version of the game.', | ||
| ConstructionNote = '<LOC wiki_builders_note_steam>Build times from the Steam/retail version of the game:', | ||
| BuildListSaysModUnits = false, | ||
|
|
||
| OnlineRepoUnitPageBlueprintLink = 'https://github.com/The-Balthazar/BrewLAN/tree/master/', | ||
| LocalRepuUnitPageBlueprintLink = FADirectory, | ||
| } | ||
|
|
||
| RebuildBlueprintOptions = { | ||
| RebuildBpFiles = { | ||
| Unit = false, | ||
| Beam = false, | ||
| Mesh = false, | ||
| Prop = true, | ||
| Emitter = false, | ||
| Projectile = false, | ||
| TrailEmitter = false, | ||
| }, | ||
| RemoveUnusedValues = false, | ||
| CleanupBuildOnLayerCaps = false, | ||
| CleanupGeneralBackgroundIcon = false, | ||
| CleanupWreckageLayers = false, | ||
| CleanupCommandCaps = false, | ||
| CleanupIntelOverlayCategories = false, | ||
| RemoveMilitaryOverlayCategories = false, | ||
| RemoveProductCategories = false, | ||
| RecalculateThreat = false, | ||
| } | ||
|
|
||
| CleanupOptions = { | ||
| CleanUnitBpFiles = false, | ||
| CleanUnitBpGeneral = false, | ||
| CleanUnitBpDisplay = false, | ||
| CleanUnitBpInterface = false, | ||
| CleanUnitBpUseOOBTestZoom = false, | ||
| CleanUnitBpThreat = false, | ||
| } | ||
|
|
||
| ModDirectories = { -- In order | ||
| -- 'C:/BrewLAN/mods/BrewLAN/', | ||
| -- 'C:/BrewLAN/mods/BrewLAN_Units/BrewAir/', | ||
| -- 'C:/BrewLAN/mods/BrewLAN_Units/BrewIntel/', | ||
| -- 'C:/BrewLAN/mods/BrewLAN_Units/BrewMonsters/', | ||
| -- 'C:/BrewLAN/mods/BrewLAN_Units/BrewResearch/', | ||
| -- 'C:/BrewLAN/mods/BrewLAN_Units/BrewShields/', | ||
| -- 'C:/BrewLAN/mods/BrewLAN_Units/BrewTeaParty/', | ||
| -- 'C:/BrewLAN/mods/BrewLAN_Units/BrewTurrets/', | ||
| } | ||
|
|
||
| BlueprintExclusions = { | ||
| '/op[ec][^/]*_unit%.bp', --bp files like OPE2001 | ||
| '/[ux][arse]c[^/]*_unit%.bp', --Exclude civilian units. | ||
| } | ||
|
|
||
| BlueprintIdExclusions = { -- Excludes blueprints with any of these IDs (case insensitive) | ||
| "zxa0001", -- Dummy unit | ||
| "zxa0002", -- Dummy unit for external/mobile factory units | ||
| "zxa0003", -- Dummy unit | ||
| "ura0001O", -- Cybran build drone | ||
| "ura0002O", -- Cybran build drone | ||
| "ura0003O", -- Cybran build drone | ||
| "XRO4001", -- Remains of Dostya | ||
| } | ||
|
|
||
| FooterCategories = { -- In order | ||
| 'UEF', 'AEON', 'CYBRAN', 'SERAPHIM', | ||
| 'TECH1', 'TECH2', 'TECH3', 'EXPERIMENTAL', | ||
| 'MOBILE', | ||
| 'ANTIAIR', 'ANTINAVY', 'DIRECTFIRE', | ||
| 'AIR', 'LAND', 'NAVAL', | ||
| 'HOVER', | ||
| 'ECONOMIC', | ||
| 'SHIELD', 'PERSONALSHIELD', | ||
| 'BOMBER', 'TORPEDOBOMBER', | ||
| 'MINE', | ||
| 'COMMAND', 'SUBCOMMANDER', 'ENGINEER', 'FIELDENGINEER', | ||
| 'TRANSPORTATION', 'AIRSTAGINGPLATFORM', | ||
| 'SILO', | ||
| 'FACTORY', | ||
| 'ARTILLERY', | ||
| 'STRUCTURE', | ||
| } | ||
|
|
||
| Logging = { -- Functional logs | ||
| LogEmojiSupported = false, | ||
|
|
||
| LocalisationLoaded = false, | ||
| HelpStringsLoaded = false, | ||
| BuffsLoaded = false, | ||
| SCMLoadIssues = false, | ||
| SandboxedFileLogs = { | ||
| Debug = false, -- SPEW | ||
| Log = true, -- LOG, _ALERT, print | ||
| Warn = true, -- WARN | ||
| }, | ||
|
|
||
| ExcludedBlueprints = false, | ||
| BlueprintTotals = true, | ||
| MissingUnitImage = true, | ||
|
|
||
| ChangeDiscarded = true, | ||
| NewFileWrites = true, | ||
| FileAppendWrites = true, | ||
| FileUpdateWrites = false, | ||
| FileAssetCopies = true, | ||
|
|
||
| ThreatCalculationWarnings = false, | ||
| } | ||
| Sanity = { -- Advice logs | ||
| BlueprintChecks = false, | ||
| BlueprintPedanticChecks = false, | ||
| BlueprintStrategicIconChecks = false, | ||
| } | ||
| Info = { -- Misc data logs | ||
| UnitLODCounts = false, | ||
| ProjectileBlueprintCounts = false, | ||
| } | ||
|
|
||
| dofile(WikiGeneratorDirectory.."Main.lua") | ||
| GeneratorMain(OutputDirectory) | ||
|
|
||
This file contains hidden or 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
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| - (#6752) Fix (proper) use of sparse checkout cone mode to speed up CI/CD |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.