Skip to content

Add GitHub action to build the examples #61

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

Closed
wants to merge 2 commits into from

Conversation

infiniteloop5
Copy link
Contributor

This shows a proof-of-concept for a simple continuous integration system, using GitHub actions.

A single file is added, defining the steps to build the code.

The steps are:

  • Download a recent development snapshot toolchain.
  • Setup Python venv and install Python dependencies.
  • Build pico-blink example, as a starting point.

Example runs:

  • Successful run: To show a blinky.uf2 binary for pico-blink is produced, I applied the fix from pull request 60. The corresponding, successfull run can be found here.
  • Unsuccessful run: Without the patch from PR 60, the pico-blink example does not compile. This can be seen here

The action is run daily at 9 AM UTC, this can be set to any other time.

Steps for the other examples can be added later, in case this approach is liked.

This is intended to provide a starting point to continuously build the examples using the latest development snapshot toolchain. As a proof-of-concept, the `pico-blink` example is build.
@iCMDdev
Copy link
Contributor

iCMDdev commented Sep 16, 2024

That's pretty cool! Though I think Apple usually uses their own CI (at least in a few swift repos). But if a CI will be adopted I think we could also add automatic releases of UF2 binaries (though the point of these examples is to build them yourself, so I don't know if that's any helpful).

For example, I did this in this repo, though it could be improved with version tags.

@iCMDdev
Copy link
Contributor

iCMDdev commented Sep 17, 2024

@rauhul
Copy link
Collaborator

rauhul commented Sep 17, 2024

So there are some caveats, 1) I need to get them enabled on this repo (should be easy, I hope). 2) we can't use macOS runners yet

@infiniteloop5
Copy link
Contributor Author

  1. I'll try to change it to a Linux runner. For the changes, should I add additional commits or force push, for a cleaner git history?

@rauhul
Copy link
Collaborator

rauhul commented Sep 18, 2024

We will squash on merge so feel free to take whichever approach you prefer in the PR.

@infiniteloop5
Copy link
Contributor Author

Using Linux runners is more complicated than anticipated.

I managed to use Linux to build the pico-blink example, but ran into the following problems, all related to building on Linux:

  • xcrun is not available on Linux. This can be worked around in the build.sh of pico-blink by adding if [ $(uname) = "Linux" ] checks to not use xcrun.
  • Apple libtool and GNU libtool (Linux) behave different. On macOS build, the -static flag of libtool is used to produce static libraries. However, GNU libtool 2.4.7 does not know the -static flag (at least on Ubuntu 24.04). Older versions of Ubuntu do seem to have to -static flag, as can be seen here

My impression is, building for Linux has hardly been tested, if at all.

Going further, I see two options:

  • Reject this pull request. The action runs in my private fork, any issues that show up there have to reported manually.
  • You have to figure out how to use macOS runners.

@iCMDdev
Copy link
Contributor

iCMDdev commented Sep 21, 2024

Going further, I see two options:

  • Reject this pull request. The action runs in my private fork, any issues that show up there have to reported manually.
  • You have to figure out how to use macOS runners.

Why not also fix the Linux build? Especially if we won't be able to use macOS runners.

Looking at build.sh, there's a few things that need to be adjusted for Linux:

  • First, as you already pointed out, xcrun should not be used on Linux:
if [ $(uname) = "Darwin" ]
  SWIFT_EXEC=${SWIFT_EXEC:-`xcrun -f swift`}
  CLANG=${CLANG:-`xcrun -f clang`}
  PYTHON_EXEC=${PYTHON_EXEC:-`xcrun -f python3`}
elif [ $(uname) = "Linux" ]
  SWIFT_EXEC=${SWIFT_EXEC:-`which swift`}
  CLANG=${SWIFT_EXEC:-`which clang`}
  PYTHON_EXEC=${PYTHON_EXEC:-`which python3`}
fi

@infiniteloop5
Copy link
Contributor Author

Why not also fix the Linux build?

I'm not willing to do it. If somebody else wants to, please go ahead.

@iCMDdev
Copy link
Contributor

iCMDdev commented Sep 26, 2024

Why not also fix the Linux build?

I'm not willing to do it. If somebody else wants to, please go ahead.

I'm willing to do it but I guess I'll need to document myself about this and find the time for it. I'm not sure how busy I'll be in the near future, but we'll see :)

Maybe some help / tips from others would be helpful / if someone else wants to take on this I'd be happy to help as much as I can.

@infiniteloop5 infiniteloop5 force-pushed the feature/ci branch 11 times, most recently from 1e8a9c1 to d8d66ad Compare October 11, 2024 00:35
@infiniteloop5
Copy link
Contributor Author

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.

3 participants