ci: use build matrix #10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
push: | |
branches: | |
- buildscripts | |
env: | |
LLVM_VERSION: 17.0.6 | |
jobs: | |
build: | |
strategy: | |
matrix: | |
include: | |
- os: macos-14 | |
arch: arm64 | |
upload_includes: true | |
- os: macos-13 | |
arch: x86_64 | |
runs-on: ${{ matrix.os }} | |
env: | |
LLVM_ARCH: ${{ matrix.arch }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
repository: llvm/llvm-project | |
ref: llvmorg-${{env.LLVM_VERSION}} | |
- name: Install dependencies | |
run: | | |
brew install ninja | |
- name: Build | |
run: | | |
cmake -S llvm -B build_osx -G "Ninja" -DCMAKE_OSX_DEPLOYMENT_TARGET=11 -DCMAKE_OSX_ARCHITECTURES=$LLVM_ARCH -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi" -DLLVM_ENABLE_PROJECTS="clang;lld;polly" -DLLVM_ENABLE_ASSERTIONS=Off -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/tmp/llvm | |
cmake --build build_osx --target install | |
- name: Compress | |
run: | | |
cd /tmp/llvm | |
mv lib lib_$LLVM_ARCH | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: llvm-${{env.LLVM_ARCH}} | |
path: /tmp/llvm/llvm_${{env.LLVM_ARCH}} | |
- name: Upload includes | |
if: ${{ matrix.upload_includes }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: includes | |
path: /tmp/llvm/include | |
artifacts: | |
name: Assemble release | |
permissions: | |
contents: write | |
runs-on: ubuntu-latest | |
needs: [build] | |
steps: | |
- name: Download all artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
path: artifacts | |
- name: Download x86 | |
uses: actions/download-artifact@v3 | |
with: | |
name: llvm-x86 | |
path: dist | |
- name: Extract arm64 | |
run: | | |
mkdir llvm-arm64 | |
tar -xzf dist/llvm-arm64.tar.gz -C llvm-arm64 | |
- name: Extract x86 | |
run: | | |
mkdir llvm-x86 | |
tar -xzf dist/llvm-x86.tar.gz -C llvm-x86 | |
- name: Create archive | |
run: | | |
mkdir $LLVM_VERSION | |
mv artifacts/*/* $LLVM_VERSION/ | |
tar -czf llvm-$LLVM_VERSION.tgz $LLVM_VERSION | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: llvm-${{env.LLVM_VERSION}} | |
path: llvm-${{env.LLVM_VERSION}}.tgz | |
- uses: ncipollo/release-action@v1 | |
if: ${{ contains(github.ref, 'refs/tags/') }} | |
with: | |
artifacts: llvm-${{env.LLVM_VERSION}}.tgz |