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

Adjust CI to handle build executables for supported platforms #176

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

elken
Copy link

@elken elken commented Jan 21, 2025

Marked as draft as this has conflicts with a recent change, and I am offering these changes as a proposal. Aware I also have to re-enable tests as well. Figured I'd get your input early 😄

If you want me to drop certain bits I can, and I think there's probably a cleaner way we can handle the various on/off states we have across runs.

Once this is merged, I have changes needed ready to go for homebrew-jank to pick this up.

Copy link
Member

@jeaye jeaye left a comment

Choose a reason for hiding this comment

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

This is great to see, Ellis! I think it's excellent to build for macOS, but let's keep Ubuntu using apt and use bash scripts which we can lint. I've left notes for how we can fit this into the existing build matrix, too.

Comment on lines 20 to 24
run: |
if [[ "$OSTYPE" == "linux"* ]]; then
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
sudo apt-get install -y libzip-dev libbz2-dev libgc-dev
fi
Copy link
Member

Choose a reason for hiding this comment

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

I think it's good to have Linux brew in the matrix, but it should not replace apt, simply due to the fact that the vast majority of Ubuntu/Debian users use apt and not Linux brew. It's more impactful for us to test what people will be using.

I would assume (correct me if I'm wrong) that a Linux binary built with Linux brew deps will not work on a Linux machine without Linux brew installed, due to dynamic lib dependency hell. If I'm right about that, using CI to make our Ubuntu builds would then be forcing Linux brew onto everyone, right?

Copy link
Member

Choose a reason for hiding this comment

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

Note: If we do add Linux brew separately, that would be our 8th build job. Nothing wrong with that, just clarifying.

Copy link
Author

@elken elken Jan 22, 2025

Choose a reason for hiding this comment

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

Won't necesserily break at all no, you would just still need the deps installed which will be taken care of when we ship .deb and .rpms. Linux can load the objects from anywhere, they don't have to be installed via brew and in fact if they weren't then the LD paths will already be correctly loaded. I'll prove this next time I'm on my desktop.

EDIT: Running in a fresh ubuntu-24.10 distrobox and all I did was install clang-19, libgc-dev and libzip-dev (which also conveniently gives me the minimum dependencies I need for later ha) and it fails purely because clojure.core is missing since I just copied the exe to /tmp so the linker can't find the brew deps.
image

The only difference in package managers is brew has a good enough version of clang which prevents us having to spend several hours building it. Once ubuntu-24.10 images start shipping we can use those as it ships with clang-19.

I did try every variation of Clang I could but for some reason it always failed for weird errors.

Copy link
Author

Choose a reason for hiding this comment

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

Think I have a way around this to have the best of both worlds here, but my point above still stands about the package manager in use.

Copy link
Member

Choose a reason for hiding this comment

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

Ok, gotcha. I'm confident that you know more about packaging that I do. 🙃 Just wanted to make sure we considered this. If it works and it's simpler, great!

Copy link
Author

Choose a reason for hiding this comment

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

No worries! You're right to question it as it does add some potential confusion 😄

Comment on lines 31 to 44
if [[ "$OSTYPE" == "darwin"* ]]; then
export SDKROOT=$(xcrun --sdk macosx --show-sdk-path)
fi

if [[ "$OSTYPE" == "linux"* ]]; then
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
fi

export PATH="$(brew --prefix)/opt/llvm/bin:${PATH}"
export LDFLAGS="-Wl,-rpath,$(brew --prefix)/opt/llvm/lib ${LDFLAGS}"
export CPPFLAGS="-I$(brew --prefix)/opt/llvm/include ${CPPFLAGS}"

${{ github.workspace }}/compiler+runtime/bin/configure -GNinja \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} #\
#-Djank_tests=on \
# -Djank_analysis="${ANALYSIS:-off}" \
# -Djank_coverage="${COVERAGE:-off}"

${{ github.workspace }}/compiler+runtime/bin/compile
# ${{ github.workspace }}/compiler+runtime/bin/test
# LLVM_PROFILE_FILE=build/test.profraw ./bin/test
# llvm-profdata merge --sparse build/test.profraw -o build/test.profdata
# llvm-cov show ./build/jank-test --instr-profile build/test.profdata > coverage.txt
Copy link
Member

Choose a reason for hiding this comment

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

This was in bin/ci/test so that we can easily benefit from linting it (we have a CI job for this). In general, I'm opposed to writing large amounts of bash in yaml files, so I tend to pull those into scripts.

Copy link
Author

Choose a reason for hiding this comment

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

I did debate it as it was getting quite large, no worries then will amend

Comment on lines 59 to 69
export DESTDIR=${{ github.workspace }}/jank-${{ matrix.os }}-$(date +'%Y-%m-%d').$(git rev-parse --short $GITHUB_SHA)
export OS_NAME=$(uname | tr "[:upper:]" "[:lower:]")
export FOLDER=jank-${OS_NAME}-$(uname -m)
export DESTDIR=${{ github.workspace }}/${FOLDER}
${{ github.workspace }}/compiler+runtime/bin/install
tar czf $DESTDIR.tar.gz $DESTDIR/
echo "archive=$DESTDIR.tar.gz" >> $GITHUB_OUTPUT

cp -R ${DESTDIR} .

tar czf ${DESTDIR}.tar.gz ${FOLDER}/
echo "archive=${DESTDIR}.tar.gz" >> $GITHUB_OUTPUT
Copy link
Member

Choose a reason for hiding this comment

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

This would be good in a bin/ci/install script which we can lint, too.

Comment on lines 1 to 4
[submodule "third-party/vcpkg"]
path = compiler+runtime/third-party/vcpkg
url = https://github.com/jank-lang/vcpkg.git
path = compiler+runtime/third-party/vcpkg
url = https://github.com/jank-lang/vcpkg.git
[submodule "compiler+runtime/third-party/folly"]
Copy link
Member

Choose a reason for hiding this comment

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

Very odd to see changes in here.

Copy link
Author

Choose a reason for hiding this comment

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

Tabs to spaces. My editor converts them automatically on save.

@@ -257,6 +257,8 @@ include(cmake/dependency/fmt.cmake)
include(cmake/dependency/libzippp.cmake)

find_package(OpenSSL REQUIRED COMPONENTS Crypto)
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_STATIC_RUNTIME OFF)
Copy link
Member

Choose a reason for hiding this comment

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

What's the static runtime? Will you please put it as a comment so I can also know in 6 months when I ask myself the same thing? 😂

Copy link
Author

Choose a reason for hiding this comment

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

I can actually remove that, thanks for spotting

Comment on lines +6 to +10
if [[ -e "./build/llvm-install" ]]; then
clang_format="./build/llvm-install/usr/local/bin/clang-format"
else
clang_format="$(command -v clang-format)"
fi
Copy link
Member

Choose a reason for hiding this comment

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

Please drop the then down, Allman style. Also, this file has 2 space indentation.

Copy link
Author

Choose a reason for hiding this comment

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

Worth adding an editorconfig file, I can add also if you want

Copy link
Member

Choose a reason for hiding this comment

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

Up to you if it's worth it.

os: [ubuntu-24.04]
os: [ macos-15]
Copy link
Member

Choose a reason for hiding this comment

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

For macOS, given the new matrix on main, we should probably just include a Debug + Release job. All of the analysis, codecov, and sanitization can happen on Ubuntu. We have 5 build jobs (1 lint) right now, so this should put us at 7 build jobs.

Copy link
Author

Choose a reason for hiding this comment

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

I want to have a re-think on adjusting the pipeline to better streamline the steps while still handling the Debug/Release steps.

Are you sure there's no value in having macOS also do those?

Copy link
Member

Choose a reason for hiding this comment

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

I don't think there's no value in macOS doing sanitization, but I'm also wary of exploding our CI jobs. If you'd like to try with all the jobs first, we can do that.

@elken elken force-pushed the main branch 14 times, most recently from 6eeb701 to 3002be6 Compare January 23, 2025 07:45
TODO Fill this in when done
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