Skip to content

fix(project) I fixed an issue on MacOS action regarding C++ headers. #7

fix(project) I fixed an issue on MacOS action regarding C++ headers.

fix(project) I fixed an issue on MacOS action regarding C++ headers. #7

name: Thrust Compiler (macOS - latest)
on:
push:
tags:
- 'thrustc-x86_64-macos-v*.*.*'
jobs:
thrustc-x86_64-macos:
runs-on: macos-latest
permissions:
contents: write
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Generating Unique ID
run: |
BASE_NAME=$(echo "$GITHUB_REF" | sed 's|^refs/tags/||')
VERSION=$(echo "$BASE_NAME" | sed 's|^thrustc-x86_64-macos-||')
BUILD_ID="${BASE_NAME}-${GITHUB_RUN_ID}"
echo "BUILD_ID=$BUILD_ID" >> $GITHUB_ENV
echo "TAG_NAME=$BASE_NAME" >> $GITHUB_ENV
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "Unique ID: $BUILD_ID"
echo "Version: $VERSION"
- name: Cloning Thrust Compiler
run: |
git clone --depth 1 https://github.com/thrustlang/thrustc
- name: Reading Changelog
run: |
CHANGELOG_PATH="thrustc/changelogs/${{ env.TAG_NAME }}/README.md"
if [ ! -f "$CHANGELOG_PATH" ]; then
echo "::error::No changelog found for tag '${{ env.TAG_NAME }}'. A changelog must exist at $CHANGELOG_PATH before releasing a compiler version."
exit 1
fi
CHANGELOG_CONTENT=$(cat "$CHANGELOG_PATH")
{
echo "CHANGELOG<<EOF"
echo "$CHANGELOG_CONTENT"
echo "EOF"
} >> $GITHUB_ENV
echo "Version changelog loaded successfully."
- name: Removing pre-installed LLVM/Clang versions
run: |
for pkg in $(brew list | grep -E '^llvm(@[0-9]+)?$|^clang-format(@[0-9]+)?$'); do
brew uninstall --ignore-dependencies "$pkg" || true
done
- name: Installing Rust
run: |
curl --proto '=https' --tlsv1.3 https://sh.rustup.rs -sSf | sh -s -- -y
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
- name: Installing dependencies
run: |
brew install cmake ninja upx
brew install llvm@17
echo "$(brew --prefix llvm@17)/bin" >> $GITHUB_PATH
- name: Cloning the Compiler Dependency Builder
run: |
git clone --depth 1 https://github.com/thrustlang/compiler-dependency-builder
- name: Running the Compiler Dependency Builder
run: |
LLVM_PREFIX=$(brew --prefix llvm@17)
SDKROOT=$(xcrun --sdk macosx --show-sdk-path)
export CC="$LLVM_PREFIX/bin/clang"
export CXX="$LLVM_PREFIX/bin/clang++"
export CXXFLAGS="-nostdinc++ -isystem $LLVM_PREFIX/include/c++/v1 -isysroot $SDKROOT"
export LDFLAGS="-L$LLVM_PREFIX/lib -Wl,-rpath,$LLVM_PREFIX/lib"
cargo run -- --llvm-major 17 \
--llvm-minor 0 \
--llvm-patch 6 \
--llvm-libcpp true
working-directory: compiler-dependency-builder
- name: Installing and Configuring Build Cache
run: |
cargo install sccache
working-directory: thrustc
- name: Building Thrust Compiler
run: |
cargo build --release
working-directory: thrustc
- name: Extracting Dynamic Dependencies
run: |
BINARY="thrustc/target/release/thrustc"
DYLIB_OUTPUT=$(otool -L "$BINARY" 2>/dev/null || echo "Could not inspect binary")
{
echo "DYNAMIC_DEPS<<EOF"
echo "$DYLIB_OUTPUT"
echo "EOF"
} >> $GITHUB_ENV
- name: Releasing Thrust Compiler
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ env.TAG_NAME }}
name: ${{ env.TAG_NAME }}
body: |
# Thrust Compiler
Version: ${{ env.VERSION }}
## Backends
### LLVM
Architecture targets for which the compiler was compiled.
- ``x86_64``
- ``AArch64``
- ``RISC-V``
- ``ARM``
- ``MIPS``
- ``PowerPC``
- ``SystemZ``
- ``AMDGPU``
- ``Hexagon``
- ``Lanai``
- ``LoongArch``
- ``MSP430``
- ``NVPTX``
- ``SPARC``
- ``XCore``
- ``BPF``
- ``SPIR-V``
- ``WebAssembly``
## Changelog
${{ env.CHANGELOG }}
## Dynamic Dependencies
${{ env.DYNAMIC_DEPS }}
files: |
thrustc/target/release/thrustc
draft: false