This repository was archived by the owner on Oct 18, 2026. It is now read-only.
Repository navigation
176 lines (151 loc) · 5.93 KB
/
Copy pathbuild.yml
File metadata and controls
176 lines (151 loc) · 5.93 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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
permissions:
contents: write
name: Build Deen Release
on:
workflow_dispatch:
push:
tags:
- 'v*.*.*'
env:
CARGO_TERM_COLOR: always
jobs:
build:
name: Build ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
name: deen-linux-x86_64
binary: deen
- target: aarch64-apple-darwin
os: macos-latest
name: deen-macos-aarch64
binary: deen
- target: x86_64-pc-windows-msvc
os: windows-latest
name: deen-windows-x86_64
binary: deen.exe
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Setup Rust cache
uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
# Linux dependencies
- name: Install Linux dependencies
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y llvm-18-dev libclang-18-dev clang-18 libpolly-18-dev
echo "LLVM_SYS_180_PREFIX=/usr/lib/llvm-18" >> $GITHUB_ENV
# macOS dependencies
- name: Install macOS dependencies
if: matrix.os == 'macos-latest'
run: |
brew install llvm@18 zstd libffi
LLVM_PREFIX=$(brew --prefix llvm@18)
echo "LLVM_SYS_180_PREFIX=$LLVM_PREFIX" >> $GITHUB_ENV
echo "LIBRARY_PATH=$LLVM_PREFIX/lib:$(brew --prefix zstd)/lib:$(brew --prefix libffi)/lib:$LIBRARY_PATH" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=$LLVM_PREFIX/lib:$(brew --prefix zstd)/lib:$(brew --prefix libffi)/lib:$LD_LIBRARY_PATH" >> $GITHUB_ENV
echo "PKG_CONFIG_PATH=$LLVM_PREFIX/lib/pkgconfig:$(brew --prefix zstd)/lib/pkgconfig:$(brew --prefix libffi)/lib/pkgconfig:$PKG_CONFIG_PATH" >> $GITHUB_ENV
echo "RUSTFLAGS=-L$LLVM_PREFIX/lib" >> $GITHUB_ENV
# Windows dependencies
- name: Install Windows dependencies
if: matrix.os == 'windows-latest'
run: |
curl -L -o llvm.tar.xz https://github.com/llvm/llvm-project/releases/download/llvmorg-18.1.8/clang+llvm-18.1.8-x86_64-pc-windows-msvc.tar.xz
7z x llvm.tar.xz
7z x llvm.tar -oC:\
move "C:\clang+llvm-18.1.8-x86_64-pc-windows-msvc" "C:\llvm"
- name: Set Windows LLVM environment
if: matrix.os == 'windows-latest'
run: |
echo "LLVM_SYS_180_PREFIX=C:\llvm" >> $env:GITHUB_ENV
echo "PATH=C:\llvm\bin;$env:PATH" >> $env:GITHUB_ENV
shell: pwsh
- name: Build
run: cargo build --release --target ${{ matrix.target }}
- name: Prepare binary (Unix)
if: matrix.os != 'windows-latest'
run: |
cp target/${{ matrix.target }}/release/${{ matrix.binary }} ${{ matrix.name }}
chmod +x ${{ matrix.name }}
- name: Prepare binary (Windows)
if: matrix.os == 'windows-latest'
run: |
copy target\${{ matrix.target }}\release\${{ matrix.binary }} ${{ matrix.name }}.exe
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.name }}
path: ${{ matrix.name }}${{ matrix.os == 'windows-latest' && '.exe' || '' }}
release:
name: Create Draft Release
runs-on: ubuntu-latest
needs: build
if: github.event_name == 'workflow_dispatch' || startsWith(github.ref, 'refs/tags/v')
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Prepare release assets
run: |
mkdir -p release-assets
# Create platform-specific archive names and copy binaries
# Linux binary
mkdir -p release-assets/deen-linux-x86_64
cp artifacts/deen-linux-x86_64/deen-linux-x86_64 release-assets/deen-linux-x86_64/deen
cp LICENSE release-assets/deen-linux-x86_64/
cp README.md release-assets/deen-linux-x86_64/
cp -r stdlib release-assets/deen-linux-x86_64/
chmod +x release-assets/deen-linux-x86_64/deen
# macOS binary
mkdir -p release-assets/deen-macos-aarch64
cp artifacts/deen-macos-aarch64/deen-macos-aarch64 release-assets/deen-macos-aarch64/deen
cp LICENSE release-assets/deen-macos-aarch64/
cp README.md release-assets/deen-macos-aarch64/
cp -r stdlib release-assets/deen-macos-aarch64/
chmod +x release-assets/deen-macos-aarch64/deen
# Windows binary
mkdir -p release-assets/deen-windows-x86_64
cp artifacts/deen-windows-x86_64/deen-windows-x86_64.exe release-assets/deen-windows-x86_64/deen.exe
cp LICENSE release-assets/deen-windows-x86_64/
cp README.md release-assets/deen-windows-x86_64/
cp -r stdlib release-assets/deen-windows-x86_64/
# Create archives for each platform
cd release-assets
tar -czf deen-linux-x86_64.tar.gz deen-linux-x86_64/
tar -czf deen-macos-aarch64.tar.gz deen-macos-aarch64/
zip -r deen-windows-x86_64.zip deen-windows-x86_64/
- name: Generate tag name
id: tag
run: |
if [[ "${{ github.event_name }}" == "push" && "${{ github.ref }}" =~ refs/tags/(v.*) ]]; then
TAG="${BASH_REMATCH[1]}"
else
TIMESTAMP=$(date +"%Y%m%d%H%M%S")
TAG="release-${TIMESTAMP}"
fi
echo "tag=${TAG}" >> $GITHUB_OUTPUT
- name: Create Draft Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.tag.outputs.tag }}
name: "Deen Compiler ${{ steps.tag.outputs.tag }}"
draft: true
generate_release_notes: true
files: |
release-assets/deen-linux-x86_64.tar.gz
release-assets/deen-macos-aarch64.tar.gz
release-assets/deen-windows-x86_64.zip