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

Use case: build matrix for 32bit and 64 bit #40

Closed
lazka opened this issue Jul 11, 2020 · 3 comments
Closed

Use case: build matrix for 32bit and 64 bit #40

lazka opened this issue Jul 11, 2020 · 3 comments

Comments

@lazka
Copy link
Member

lazka commented Jul 11, 2020

A common CI use case is building your project for 32bit and 64bit, which in the setup-msys2 case also means the package names passed to "install" are different, and then in bash depending on the build do something different maybe.

I'd like to see an example for this in the README.

@eine
Copy link
Collaborator

eine commented Jul 11, 2020

Hi @lazka! I have thought about that, but the issue is that there are too many possibilities and it can be overwhelming. The principle is really simple: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstrategy

    strategy:
      fail-fast: false
      max-parallel: N
      matrix:
        OBJECT/STRUCT_OR_LIST_OF_OBJECTS/STRUCTS

So, the most basic syntax is the one used in https://github.com/msys2/MINGW-packages/blob/master/.github/workflows/main.yml#L12-L18:

      matrix:
        include:
          - msystem: MINGW64
            msystem_lower: mingw64
            arch: x86_64
          - msystem: MINGW32
            msystem_lower: mingw32
            arch: i686

Where you use the values as ${{ matrix.msystem }}, ${{ matrix.msystem_lower }} or ${{ matrix.arch }}.

It can be rewritten as follows:

      matrix:
        task: [
          { msystem: MINGW64, msystem_lower: mingw64, arch: x86_64 },
          { msystem: MINGW32, msystem_lower: mingw32, arch: i686 }
        ]

This is equivalent, but values are used as ${{ matrix.task.msystem }}, ${{ matrix.task.msystem_lower }}, etc. This is used in https://github.com/ghdl/ghdl/blob/master/.github/workflows/push.yml#L60-L66.

At the same time, any of the parameters defined in the matrix can be used "anywhere", meaning any field of the YAML. Examples:

As a result, I am not sure about putting all this in the README, because I don't want to duplicate GitHub Actions' docs. Instead, I think it would be desirable to add just some short comment that links to the docs and to https://github.com/msys2/MINGW-packages/blob/master/.github/workflows/main.yml as a "living example".

BTW, msystem: MINGW64, msystem_lower: mingw64 is clearly redundant and "annoying". It can be worked around as shown in https://github.com/umarcor/gtkwave/blob/ci-msys2/.github/workflows/build.yml#L46, but it would be desirable if either lowercase or uppercase values were accepted. Is it possible?

That last workflow is also interesting because the same tool is tested/built on MINGW64/MINGW32 and with gtk2/gtk3, i.e. four jobs are generated from the matrix: https://github.com/umarcor/gtkwave/blob/ci-msys2/.github/workflows/build.yml#L16-L20 (gtkwave/gtkwave#20). Moreover, packages are automatically updated to a pre-release, as assets/artifacts.

@lazka
Copy link
Member Author

lazka commented Jul 11, 2020

As a result, I am not sure about putting all this in the README, because I don't want to duplicate GitHub Actions' docs. Instead, I think it would be desirable to add just some short comment that links to the docs and to https://github.com/msys2/MINGW-packages/blob/master/.github/workflows/main.yml as a "living example".

ok, sounds good too. In case that wasn't clear, I just wanted a small example to show one way, so users see that it's possible.

BTW, msystem: MINGW64, msystem_lower: mingw64 is clearly redundant and "annoying". It can be worked around as shown in https://github.com/umarcor/gtkwave/blob/ci-msys2/.github/workflows/build.yml#L46, but it would be desirable if either lowercase or uppercase values were accepted. Is it possible?

I've filed msys2/MSYS2-packages#2040 (but not sure if it's worth the effort)

eine added a commit that referenced this issue Jul 12, 2020
@eine eine closed this as completed Jul 12, 2020
@lazka
Copy link
Member Author

lazka commented Jul 12, 2020

Thank you!

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

No branches or pull requests

2 participants