-
-
Notifications
You must be signed in to change notification settings - Fork 4
155 lines (123 loc) · 4.46 KB
/
Copy paththrustc-x86_64-macos.yml
File metadata and controls
155 lines (123 loc) · 4.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
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