Skip to content

workflow refactor#134

Merged
SpaceWalkerRS merged 54 commits intoOrnitheMC:mainfrom
Kahzerx:main
Sep 2, 2023
Merged

workflow refactor#134
SpaceWalkerRS merged 54 commits intoOrnitheMC:mainfrom
Kahzerx:main

Conversation

@Kahzerx
Copy link
Copy Markdown
Member

@Kahzerx Kahzerx commented Aug 29, 2023

This refactor has 3 parts

.github/workflows/build.yml

  • Matrix based build, up to 20 concurrent builds (max for free tier) and 24 versions hardcoded
  • I've also moved it to ubuntu because it was a bit faster

.github/workflows/build_all.yml

This has to be run before the "Publish" workflow

  • Full rewrite of build_all.py with threading support (it only uses 1 thread for now) and 3 retries on failed builds

steps

  1. It will first run .github/workflows/scripts/matrix_gen.py, which takes all available unique versions from mappings/, split them into 20 different arrays and save the output.
  2. Will then create 2 jobs, one to display all versions, another one to build the 20 arrays as 20 concurrent jobs.
  3. if run successfully, the last task will run, this one runs .github/workflows/scripts/workflow_gen.py, this will split all versions into n publish workflows, every workflow will have up to 230 versions each in its matrix, and it will then commit and push those generated workflows.

Requirements

For this build_all workflow to work you need to make 2 changes:

  1. go to feather-mappings > settings > Actions > General > Workflow permissions > Read and write permissions
  2. and admin profile or an org admin profile needs to create a PAT with workflow enabled

This is so the build_all workflow can commit and push new github actions to the workflows directory

.github/workflows/build_all.yml

Once the build_all workflow has been run, there should be some new publish_{n}.yml that will trigger when the .github/workflows/build_all.yml completes

On Publish run, the generated ones will run as well running a 230 job max matrix each

The publish.py script has also been rewritten with the retry logic if fails

Kahzerx and others added 30 commits August 28, 2023 00:14
build test
name
fixed path
workflow dispatch
test
push
other way of writing env
version parser
kek
20 concurrent jobs
test_paralel
set versions as argument
environment
join array
is env
py builder
java and wrapper validator
exit code
max parallel set to 20
show version list
publisher
publish dir rename
fail-fast option
generate all the necessary publish files on successful build action
oopsi chdir
github token
write permissions
Kahzerx and others added 22 commits August 29, 2023 10:00
workflow token
token test
write action permission
temp clear
workflow token
publish test
template fix
cleanup
matrix based build workflow
string versions
checkout v3
ubuntu runner
make gradle script executable from workflow
stop publish generator and add bash script
publish.py Outdated
stderr=subprocess.STDOUT,
shell=True,
env=env,
cwd=os.path.join(self._PUBLISH_TEMP_DIR, self._version)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What is the thought behind changing the working directory? I don't think it causes any issues, since Gradle will make sure any file access in the build script is relative to the project directory, but then this change has no effect at all?

Copy link
Copy Markdown
Member Author

@Kahzerx Kahzerx Aug 29, 2023

Choose a reason for hiding this comment

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

gradle doesn't allow doing multiple builds at the same time since it only uses one dir, so if we try to multithread it, it will break because "the same resource is being accessed from multiple processes", so i decided to just move the files gradle needs to survive to another directory named like the version and do the build there
It doesn't affect at all because there is only one process as you can see here https://github.com/OrnitheMC/feather-mappings/pull/134/files#diff-3252d091f3490b6e1103b1e47ed6e4d909cb8d2bb279bc54730383e0860ea566R184 but to keep the mutithread support for the future just in case we want to use it
this doesnt change anything, its more relevant for build than to publish, i can remove it from publish.py iyw, i just copy pasted :P

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

gradle doesn't allow doing multiple builds at the same time since it only uses one, so if we try to multithread it, it will break because "the same resource is being accessed from multiple processes", so i decided to just move the files gradle needs to survive to another directory named like the version and do the build there

ahhh I see, so it's needed to make the build_all work.

this doesnt change anything, its more relevant for build than to publish, i can remove it from publish.py iyw

at that point might as well just remove the publish script and publish through the feather script tbh

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

is not exactly the same, i'd need to change the feather.py behaviour for the publish option to add the retry logic

or we don't want that anymore and just use the job action retry manually?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

the manual retry is probably good enough tbh

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

okay~

run feather script, remove publish.py
@Kahzerx
Copy link
Copy Markdown
Member Author

Kahzerx commented Aug 29, 2023

done

@SpaceWalkerRS SpaceWalkerRS requested a review from Copetan August 29, 2023 22:59
@SpaceWalkerRS SpaceWalkerRS merged commit 10eb198 into OrnitheMC:main Sep 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants