diff --git a/.github/actions/build/action.yml b/.github/actions/build/action.yml index e24cffec..aa618a77 100644 --- a/.github/actions/build/action.yml +++ b/.github/actions/build/action.yml @@ -14,39 +14,30 @@ outputs: runs: using: "composite" steps: - - name: Install brew packages - working-directory: ${{ github.workspace }}/compiler+runtime - shell: bash - run: | - if [[ "$OSTYPE" == "linux"* ]]; then - eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" - sudo apt-get install -y libzip-dev libbz2-dev libgc-dev - fi - HOMEBREW_NO_AUTO_UPDATE=1 brew install ninja libzip doctest boost llvm@19 double-conversion bdw-gc clang-format - - name: Compile and test shell: bash working-directory: ${{ github.workspace }}/compiler+runtime run: | - if [[ "$OSTYPE" == "darwin"* ]]; then - export SDKROOT=$(xcrun --sdk macosx --show-sdk-path) - fi + ./bin/ci/test + # 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 + # 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}" + # 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/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/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 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index da0e444d..8c9ce44a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -5,33 +5,51 @@ on: push: jobs: - test: + linux: + strategy: + matrix: + build_type: [ Debug, Release ] + runs-on: ubuntu-latest + container: ubuntu:24.10 + env: + CC: clang-19 + CXX: clang++-19 + timeout-minutes: 240 + steps: + - name: Install deps + run: apt update && apt install -y git git-lfs sudo build-essential libzip-dev libbz2-dev libgc-dev clang-19 libboost-all-dev ninja-build doctest-dev cmake libllvmlibc-19-dev libclang-19-dev libssl-dev + - uses: actions/checkout@v4 + with: + submodules: recursive + - name: Build and test + uses: ./.github/actions/build + id: build + with: + update_release: ${{ github.ref == 'refs/heads/main' && matrix.build_type == 'Release' }} + - name: Update latest release + if: success() && github.ref == 'refs/heads/main' && ${{ matrix.build_type == 'Release' }} + uses: softprops/action-gh-release@v2 + with: + tag_name: latest + token: ${{ secrets.GITHUB_TOKEN }} + files: ${{ steps.build.outputs.release_archive }} + + macos: strategy: fail-fast: false matrix: - # TODO: sanitize: [On, Off] - os: [ macos-15] + os: [ macos-13, macos-15 ] # TODO: Enable release once we no longer have a Clang crash: # https://github.com/jank-lang/jank/actions/runs/12269972895/job/34234432107 - build_type: [Debug] - include: - - os: ubuntu-24.04 - cc: clang - cxx: clang++ - - os: macos-13 - cc: clang - cxx: clang++ - - os: macos-15 - cc: clang - cxx: clang++ + build_type: [Debug, Release] runs-on: ${{ matrix.os }} env: - CC: ${{ matrix.cc }} - CXX: ${{ matrix.cxx }} - CODECOV: ${{ matrix.codecov }} - ANALYSIS: ${{ matrix.analysis }} + CC: clang + CXX: clang++ timeout-minutes: 240 # 4h steps: + - name: Install dependencies + run: HOMEBREW_NO_AUTO_UPDATE=1 brew install ninja libzip doctest boost llvm@19 double-conversion bdw-gc clang-format - uses: actions/checkout@v4 with: submodules: recursive diff --git a/compiler+runtime/bin/ci/test b/compiler+runtime/bin/ci/test index 25f797cf..47293ad3 100755 --- a/compiler+runtime/bin/ci/test +++ b/compiler+runtime/bin/ci/test @@ -1,20 +1,30 @@ #!/usr/bin/env bash -set -eu +set -e +if [[ "$OSTYPE" == "darwin"* ]]; +then + export SDKROOT=$(xcrun --sdk macosx --show-sdk-path) + 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}" +fi -llvm_dir="${PWD}/build/llvm-install" -if [[ ! -d "${llvm_dir}" ]]; +if [[ "${BUILD_LLVM:-off}" == "on" ]]; then - mkdir -p build - pushd build - ../bin/build-clang - popd + llvm_dir="${PWD}/build/llvm-install" + if [[ ! -d "${llvm_dir}" ]]; + then + mkdir -p build + pushd build + ../bin/build-clang + popd + fi + export CC="${llvm_dir}/usr/local/bin/clang" + export CXX="${llvm_dir}/usr/local/bin/clang++" fi -export CC="${llvm_dir}/usr/local/bin/clang" -export CXX="${llvm_dir}/usr/local/bin/clang++" ./bin/configure -GNinja \ - -Djank_local_clang=on \ + -Djank_local_clang="${BUILD_LLVM:-off}" \ -Djank_tests=on \ -Djank_analysis="${ANALYSIS:-off}" \ "$@" @@ -29,8 +39,8 @@ then -Djank_analysis=off \ "$@" LLVM_PROFILE_FILE=build/test.profraw ./bin/test - "${llvm_dir}/usr/local/bin/llvm-profdata" merge --sparse build/test.profraw -o build/test.profdata - "${llvm_dir}/usr/local/bin/llvm-cov" show ./build/jank-test --instr-profile build/test.profdata > coverage.txt + "${llvm_dir:-/}/usr/local/bin/llvm-profdata" merge --sparse build/test.profraw -o build/test.profdata + "${llvm_dir:-/}/usr/local/bin/llvm-cov" show ./build/jank-test --instr-profile build/test.profdata > coverage.txt # This file will be read by a subsequent CodeCov Github action. else ./bin/test