Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@LecrisUT
Copy link

@LecrisUT LecrisUT commented Jun 28, 2023

  • Add concurrency. This helps cancel ongoing jobs when you push a new commit
  • Unify the CI jobs to one file
  • Migrate strategy matrix to a separate file
  • Group matrix jobs. Dunno how to do this, might postpone Partially organized in Checks view
  • Cleanup ci jobs. E.g. submodules is not needed
  • Setup Swiglang from upstream GitHub Actions. See .github/actions/setup-lang/action.yaml

After some experimentation, I propose a clean solution using fmf

What's fmf?

FMF in a nutshell is an extension to yaml such that you can define and combine yaml files hierarchically. E.g. in a top-level file (/Lib/main.fmf) you have

github-matrix:
  version: [ "" ]
  cpp-std: [ "c++11","c++14","c++17" ]

then in a child file (/Lib/python/main.fmf) you can write as:

github-matrix+:
  version: [ "3.8","3.9","3.10","3.11","3.12" ]

which is equivalent to:

github-matrix:
  version: [ "3.8","3.9","3.10","3.11","3.12" ]
  cpp-std: [ "c++11","c++14","c++17" ]

Primarily fmf is used in tmt which is a testing-framework where you can define test hierarchically. It might be useful to also use that infrastructure, but for now, one step at a time.

Some tips of how to view the data:

## Install fmf
$ pip install fmf
## Go to the root of fmf (the folder that contains `.fmf/version`)
$ cd Lib
## Show all leaf nodes
$ fmf ls
## Show all data in each node
$ fmf show
## Show only the data in python. Note it is a regex expression so `java`/`javascript` needs more sanitization
$ fmf show --name=/python
Why fmf?

Originally I was planning to store these as json files, but it soon proved quite unwieldy especially due to the duplications across the variants. This approach will allow:

  • reduce duplication and maintenance. E.g. if c++20 should be added to all languages as experimental, this can be done in the top-level /Lib/main.fmf and all languages will inherit it.
  • simplify the sanitization of variables. Passing strings and interpreting them back as json for strategy.matrix proved quite complicated adding too much boilerplate to the workflows making them unnavigable. In this approach, the whole matrix-github is passed as a single object.

Upstream issues:

@LecrisUT LecrisUT marked this pull request as draft June 28, 2023 13:04
@LecrisUT LecrisUT mentioned this pull request Jun 28, 2023
10 tasks
@LecrisUT LecrisUT force-pushed the ci/gh-action branch 2 times, most recently from 07a104a to aedb197 Compare June 28, 2023 13:39
@ojwb
Copy link
Member

ojwb commented Aug 1, 2023

  • path [default=/Lib/${input.lang}]: A variable to filter the paths where the CI should run or not

Note this is more complicated to do correctly that just /Lib/${input.lang} - that wouldn't be useful even for PRs as we want to know if a PR to fix e.g. a Python-specific issue breaks any other target languages before merging it. So anything touching generic library, testsuite or source files needs to trigger a full set of jobs, but we certainly can save running jobs when the only files touched are target-language-specific such as Lib/python, Examples/python, Examples/test-suite/python and Source/Modules/python.cxx.

  • ignore-path: ignore the arguments in path and run the workflow. This is to be used on master branch

If we've got accurate filtering of which jobs to run (which would be nice), I don't really see a good enough reason to avoid using it on master too. We're not going to have long gaps without a full set of jobs because anything which touches a generic files needs to trigger jobs for all languages.

Hooking up on.workflow_dispatch such that a full set of jobs can be manually triggered from the web UI might be handy sometimes - e.g. I can imagine wsfulton might want to be able to verify CI is definitely all green before making a release.

@LecrisUT
Copy link
Author

LecrisUT commented Aug 2, 2023

So anything touching generic library, testsuite or source files needs to trigger a full set of jobs, but we certainly can save running jobs when the only files touched are target-language-specific such as Lib/python, Examples/python, Examples/test-suite/python and Source/Modules/python.cxx.

That's precisely the design that I was planning to add. My plan is to use the design here and a json/yaml file configuration to define all the languages, variants and paths.

If we've got accurate filtering of which jobs to run (which would be nice), I don't really see a good enough reason to avoid using it on master too. We're not going to have long gaps without a full set of jobs because anything which touches a generic files needs to trigger jobs for all languages.

My reasoning for that is to have a workflow that could do a sanity check (e.g. there are changes in python-dev, or changes in the compiler, etc.). Pushes to master should be fine in terms of frequency, but this could be on a weekly schedule as well.

Hooking up on.workflow_dispatch such that a full set of jobs can be manually triggered from the web UI might be handy sometimes

👍

@ojwb
Copy link
Member

ojwb commented Aug 2, 2023

My reasoning for that is to have a workflow that could do a sanity check (e.g. there are changes in python-dev, or changes in the compiler, etc.). Pushes to master should be fine in terms of frequency, but this could be on a weekly schedule as well.

In the case of python-dev that comes from the Ubuntu package repos which means it'll only change for targetted fixes for security or other high severity bugs, or else when we move to a new Ubuntu release but for the latter case the CI config file changes (from saying e.g. ubuntu-20.04 to ubuntu-22.04) and that changing should trigger a full set of jobs anyway.

There are some dependencies that get installed from sources with more liberal update policies than Ubuntu, but I think the benefits of reducing the number of CI jobs for many pushes to master outweighs the potential downside of not seeing the effects of a breaking change to a target language dependency until we next happen to trigger a build for it (that's actually true already, it's just that such triggering would happen a bit less often with these changes).

@LecrisUT
Copy link
Author

LecrisUT commented Aug 2, 2023

By python-dev I was referring to python-3.qw-dev from setup-python github action. And similarly for the other languages, it should be designed to allow for running the latest development versions so that breaking changes can be caught early in the development stage instead of after release

@LecrisUT LecrisUT force-pushed the ci/gh-action branch 20 times, most recently from 62bfd4e to 7a30f66 Compare August 30, 2023 12:34
@LecrisUT
Copy link
Author

@ojwb @erezgeva @wsfulton gentle poke to request some attention on this PR

Signed-off-by: Cristian Le <[email protected]>
Avoids duplication of jobs and concurrency issues

Signed-off-by: Cristian Le <[email protected]>
- Use `fmf` to simplify the metadata for each toolchain and language check
- Trigger language test only if corresponding files are changed
- Always trigger all tests if a base swig file is changed

Signed-off-by: Cristian Le <[email protected]>
Signed-off-by: Cristian Le <[email protected]>
Signed-off-by: Cristian Le <[email protected]>
(cherry picked from commit ebc2c4c)
(cherry picked from commit bd3fc8a)
Signed-off-by: Cristian Le <[email protected]>
Signed-off-by: Cristian Le <[email protected]>
Signed-off-by: Cristian Le <[email protected]>
Signed-off-by: Cristian Le <[email protected]>
Signed-off-by: Cristian Le <[email protected]>
Signed-off-by: Cristian Le <[email protected]>
Signed-off-by: Cristian Le <[email protected]>
Signed-off-by: Cristian Le <[email protected]>
@erezgeva
Copy link
Contributor

erezgeva commented Dec 23, 2023

Hi @LecrisUT ,

I like your work and I think the pull request is a good one.

From my side there are 2 blocking:

  1. The job title on the web are too long and contain words like 'test' 'language' and 'run'. Theses worlds provide no information. The words appear on the start of the title make it harder to read.
    Please use the original titles!
    See my run: https://github.com/erezgeva/swig/actions/runs/6357334511

  2. There are jobs that fails. They are probably new tests.
    I do not oppose adding extra tests for a "full" testing.
    But the default tests must pass!

@LecrisUT
Copy link
Author

1. The job title on the web are too long and contain words like 'test' 'language' and 'run'. Theses worlds provide no information. The words appear on the start of the title make it harder to read.
   **Please use the original titles!**
   See my run: https://github.com/erezgeva/swig/actions/runs/6357334511

Agree. After some experimentation I found where the naming comes from and how to simplify, but I cannot get rid of the folder-like structure though, i.e. the CI/.../.... So, how should we:

  • distinguish between lang and toolchain workflows? I think the best would be with emoji like 🛠️ , but what can we use for lang? 🗨️ ?
  • are the current versions still too long? Can you be more specific on how you would want them simplified?
2. There are jobs that fails. They are probably new tests.
   I do not oppose adding extra tests for a "full" testing.
   **But the default tests must pass!**

Pay attention to the CI/pass. There it shows if the normal tests fail or not. The additional tests are for experimental to highlight and keep track of how things are failing there and what needs to be done. What I can do is to mask the failing tests when pushed to main, that way the checks appear green in the commit history. I strongly recommend to keep them and show the failures in the PR.

@erezgeva
Copy link
Contributor

1. The job title on the web are too long and contain words like 'test' 'language' and 'run'. Theses worlds provide no information. The words appear on the start of the title make it harder to read.
   **Please use the original titles!**
   See my run: https://github.com/erezgeva/swig/actions/runs/6357334511

Agree. After some experimentation I found where the naming comes from and how to simplify, but I cannot get rid of the folder-like structure though, i.e. the CI/.../.... So, how should we:

I like the folder like view.

  • distinguish between lang and toolchain workflows? I think the best would be with emoji like 🛠️ , but what can we use for lang? 🗨️ ?

The folder make it easier to read for example:

TCL lang >
C++ 11
C++ 17

You can put the 'lang' and 'tool' after as most developers know TCL is a language and 'GCC' a compiler (tool)
i.e.
GCC tool
TCL lang

As for emoji, I like the idea. You're choosing is better than my ideas.

  • are the current versions still too long? Can you be more specific on how you would want them simplified?
2. There are jobs that fails. They are probably new tests.
   I do not oppose adding extra tests for a "full" testing.
   **But the default tests must pass!**

Pay attention to the CI/pass. There it shows if the normal tests fail or not. The additional tests are for experimental to highlight and keep track of how things are failing there and what needs to be done. What I can do is to mask the failing tests when pushed to main, that way the checks appear green in the commit history. I strongly recommend to keep them and show the failures in the PR.

There is no difference.
If the PR fails, it will not be merged into 'main'.
Developers can not differ the 2 kinds.

What we can do is mark these failing tests with "continue-on-error: true" flag.
Once we add the features and publish experimental languages, we can revert the "continue-on-error" flag and make these tests mandatory.

Usually, as the tests take so long, the maintainers prefer not to run them and save the time.
Today there is only one test of that sort: "SWIGLANG: mzscheme"

If you improve the action: use artefacts and copy the tools from one job to another, than we can save time and add more tests :-)

@LecrisUT
Copy link
Author

You can put the 'lang' and 'tool' after as most developers know TCL is a language and 'GCC' a compiler (tool)

As for emoji, I like the idea. You're choosing is better than my ideas.

Thanks for the feedback, I'll try out some simplifications along those lines.

What we can do is mark these failing tests with "continue-on-error: true" flag.
Once we add the features and publish experimental languages, we can revert the "continue-on-error" flag and make these tests mandatory.

That is already what is done there (experimental == continue-on-error)

There is no difference.
If the PR fails, it will not be merged into 'main'.
Developers can not differ the 2 kinds.

Indeed, that is why I was trying to get the attention of the maintainers to discuss this change. Basically on my projects I set up a required workflow that points to Pass job so that the red jobs are ignored. Here are my notes on how to mask the results, and you can find it in action here (also in the PRs there).

I can disable the experimental jobs, but do you have a suggestion on where to track that these need to be re-enabled?

@erezgeva
Copy link
Contributor

You can put the 'lang' and 'tool' after as most developers know TCL is a language and 'GCC' a compiler (tool)
As for emoji, I like the idea. You're choosing is better than my ideas.

Thanks for the feedback, I'll try out some simplifications along those lines.

What we can do is mark these failing tests with "continue-on-error: true" flag.
Once we add the features and publish experimental languages, we can revert the "continue-on-error" flag and make these tests mandatory.

That is already what is done there (experimental == continue-on-error)

There is no difference.
If the PR fails, it will not be merged into 'main'.
Developers can not differ the 2 kinds.

Indeed, that is why I was trying to get the attention of the maintainers to discuss this change. Basically on my projects I set up a required workflow that points to Pass job so that the red jobs are ignored. Here are my notes on how to mask the results, and you can find it in action here (also in the PRs there).

I can disable the experimental jobs, but do you have a suggestion on where to track that these need to be re-enabled?

Seems you look for a project decision.
I am merely a Developer happy to contribute and help.
You should talk to @ojwb about this issue.

@LecrisUT LecrisUT mentioned this pull request Feb 6, 2024
Copy link
Contributor

@erezgeva erezgeva left a comment

Choose a reason for hiding this comment

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

I left my feedback.
The decision to have failed tests is up to the project Admins.

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.

4 participants