-
Notifications
You must be signed in to change notification settings - Fork 268
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
CI: Windows/MSYS2 packaging #65
Conversation
b4ab050
to
2439021
Compare
Amazing!
may resolve this issue (seems works for libftdi) bitstreams (including test_sfl.svf) must be installed in Thanks |
So, it was a silly mistake on my side... I was using I updated this PR. If you want, you can merge it and keep it for CI purposes. It will build one MINGW32 and one MINGW64 package after each push or pull request. BTW, would you mind releasing a new version (git tag)? That would help for getting an archive when upstreaming the package (instead of requiring git). |
Releasing a new version is in my todolist. Current release v0.1 is outdated. I need to check if some issue or idea needs to be fixed / applied before or after new release. But a new release must be done ASAP. |
No rush, since we can use git meanwhile (msys2/MINGW-packages#7351), but it'd be nice to retrieve a tarball instead.
I agree. hdl/MINGW-packages is for MSYS2 packages. There is a sibling project, hdl/containers, for OCI containers (docker, podman, etc.). That's a container ecosystem of EDA tooling, based on Debian Buster. Hence, it would be possible to use the same plumbing for CI here. In fact, hdl/containers is an evolution of the CI infrastructure in GHDL. See https://hdl.github.io/containers/#_context. Furthermore, it is possible to use docker containers for foreign architectures (say ARM). That allows generating multiarch images. See dbhi/qus and dbhi/docker. Actually, dbhi/qus is used in open-tool-forge/fpga-toolchain for building static binaries of this project (see https://github.com/open-tool-forge/fpga-toolchain/blob/feature/46-arm-builds/scripts/test/test_entrypoint.sh#L24).
See a discussion about different packaging approaches in https://github.com/hdl/smoke-tests/blob/main/CONTEXT.md (refed from https://github.com/hdl/MINGW-packages/blob/main/CONTEXT.md). When packaging a tool for typical GNU/Linux distributions (apt, dnf/yum, pacman...) the complexity relies on the number of target architectures that need to be supported. Each tool needs to be cross-compiled for 6-12 different platforms, which increases the maintenance burden significantly. Conversely, when packaging for Windows, there are de facto two options only (MINGW32 or MINGW64) and a single package manager exists. Therefore, the variability and effort are much less. Moreover, the point about PKGBUILD files is that those are probably the most simple building/packaging recipes I am aware of. # set pkgdir
# set MINGW_PACKAGE_PREFIX
mkdir "${pkgdir}"
_realname=openFPGALoader
pacman -S --noconfirm \
"${MINGW_PACKAGE_PREFIX}-libftdi" \
"${MINGW_PACKAGE_PREFIX}-gcc" \
"${MINGW_PACKAGE_PREFIX}-make" \
"${MINGW_PACKAGE_PREFIX}-cmake")
mkdir build
cd build
MSYS2_ARG_CONV_EXCL=- cmake \
-G "MinGW Makefiles" \
-DCMAKE_INSTALL_PREFIX="${MINGW_PREFIX}" \
../
cmake --build .
openFPGALoader.exe --help
mingw32-make DESTDIR="${pkgdir}" install
_licenses="${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}"
mkdir -p "${_licenses}"
install -m 644 ../LICENSE "${_licenses}" The remaining 10 lines are the wrapping functions (build, check, package) and metadata (name, version, description, url, license). Yet, manually you would need to handle:
By using Last, but not least, having a PKGBUILD file is useful for:
For reference, in GHDL, PKGBUILD files are used (https://github.com/ghdl/ghdl/tree/master/dist/msys2-mingw) for building nightly artifacts (https://github.com/ghdl/ghdl/runs/1472008237?check_suite_focus=true and https://github.com/ghdl/ghdl/actions/runs/390849319), which are then available in a pre-release (https://github.com/ghdl/ghdl/releases/tag/nightly) and through a GitHub Action (https://github.com/ghdl/setup-ghdl-ci). The PKGBUILD files in GHDL's repo are similar but not the same as the upstream (https://github.com/msys2/MINGW-packages/tree/master/mingw-w64-ghdl). Overall, I believe that using PKGBUILD files for MSYS2 is easier to understand and maintain than any manual procedure. Yet, please, feel free to argue otherwise. |
openFPGALoader was upstreamed to MSYS2 (https://github.com/msys2/MINGW-packages/tree/master/mingw-w64-openFPGALoader) and it's in the update queue: https://packages.msys2.org/new. When released (removed from the update queue), it will be available through |
@trabucayre I rebased on top of master and all looks good. Do you mind tagging v0.2.6 for updating the MSYS2 packages? https://packages.msys2.org/package/mingw-w64-x86_64-openFPGALoader |
Sorry for delay. |
No worries and thanks! |
Great! |
hi, I think I must apply this PR to be sure to have a buildable system everytime for all possible target. |
Not at all. The PKGBUILD recipe can be anywhere, and the directory does not need to be named
The only point is that you need to On the other hand, I don't think that build recipes belong in
Yes, it is possible. Not exactly the same job, but we can add other jobs or additional workflows.
Here, it will be difficult to actually test the tool in CI. But we can build it on multiple platforms and ensure that it does not crash, at least (https://github.com/hdl/smoke-tests/blob/main/openFPGALoader.sh). Overall, I don't like manual build procedures. That's why I use PKGBUILD recipes on MSYS2. Hence, I am not comfortable with using manual procedures on Linux jobs. I'd prefer to use DEB or RPM recipes. Yet, I am lacking knowledge about those specific recipe formats. Hence, unfortunately, I cannot help in that regard. I can help with the CI/workflow/artifact management, though (as I do in GHDL, GTKWave, etc.). BTW, as soon as I get familiar with building openFPGALoader on Debian Buster, I want to add it to the
I agree. CI is a must nowadays. Software development is very organic, and small projects need all the help from automation they can get. That is one of the roles I play in the open source EDA tooling community. Hence, I'm willing to walk this path with you. However, it needs to be a tight collaboration because I cannot afford the cognitive load of learning the specific details of this project. So, if you are willing to merge this PR, let me know, and I will review it before doing so. Do you like emojis? We use those a lot in GHDL and in other repos, because it helps understand the big picture: However, those are unicode characters, so I understand if some projects don't want to use them. |
Ok
It make sense.
I needs to learn more about this task, it's really interesting and important to be sure to haven't regressions.
It's true. It's a more clean way to install package.
Building manually openFPGALoader in debian is really straightforward. Will see how to create files to generate a deb. For RPM I think @jeanthom knows how to do this
Yes of course !
It's my goal yes. it's true this display is more easy to understood as textual version Thanks. |
baf4eea
to
bfb7a48
Compare
* Split build and test into two jobs. * Use emojis/icons. * Build/test clang64 and ucrt64 too. * Add workflow_dispatch.
@trabucayre I think this is ready to merge now.
I suggest we merge this, so that GitHub Actions is enabled in this repo. From there on, PRs will trigger CI runs, which will make it easier to iterate. Meanwhile, see an execution: https://github.com/umarcor/openFPGALoader/actions/runs/1040103477 |
LGTM just two things:
Thanks |
It's actually a good idea. I changed it.
My idea was to just finish the sentence with a dot. Then I thought about adding the |
Fixed now!
I added it in the "Test package" step of the workflow, instead of the "check()" function of the PKGBUILD recipe. Is that ok? Or do you prefer to have it in the recipe? |
Thanks! |
@trabucayre, maybe you can tag 0.6.0 to update the MSYS2 packages? |
I was thinking to finish spiflash's rework, and merge @UweBonnes bmp PR before next release, but it's make more sense to create a new release and to postpone these evolutions to the next one. |
done! |
Thanks! msys2/MINGW-packages#10224 |
Just seen this PR! |
Good catch! That's actually not critical, because zlib is a dependency of gcc, cmake, etc. That's why CI did not fail. Anyway, I will keep that fix in a branch, to be pushed the next time I bump other packages. |
In fact zlib is not marked as required (in a first time) but I must change this. |
This PR is not to be merged per se, but for showcasing a problem.
In the context of hdl/MINGW-packages, I'm writing a PKGBUILD file for having
openFPGALoader
upstreamed as an MSYS2 package (packages.msys2.org). See hdl/MINGW-packages@openFPGALoader: mingw-w64-openFPGALoader.This PR contains a PKGBUILD similar to the one in hdl/MINGW-packages, but here sources are not retrieved, since the build is executed in subdir
msys2
(new, where PKGBUILD is located). Furthermore, a GitHub Actions workflow is added. It uses Action setup-msys2, mimicking the workflow in the upstream msys2/MINGW-packages.So far, building is successful. However,make install
fails. Locally, it will open an interactive prompt. Upon exit, the build will fail. On the other hand, in CI it cannot open the interactive prompt, so it is skipped and nothing is installed (packaged). In this PR, I worked around it by manually copying the files in https://github.com/trabucayre/openFPGALoader/blob/master/CMakeLists.txt#L174-L182. Still, I'd like to fix it.I checked open-tool-forge/fpga-toolchain (/cc @edbordin), but it seems that
make install
is not used there: https://github.com/open-tool-forge/fpga-toolchain/blob/main/scripts/compile_openfpgaloader.sh#L34.@trabucayre, is the location of those bitstreams and
test_sfl.svf
correct?See CI run: https://github.com/umarcor/openFPGALoader/actions/runs/389784436