wrapper #62
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
name: Build and Test | |
on: | |
push: | |
branches: | |
- 'master' | |
pull_request: | |
branches: | |
- '**' | |
permissions: | |
contents: write | |
jobs: | |
llvm: | |
strategy: | |
matrix: | |
llvm-version: [16, 17, 18] | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Install LLVM and Clang | |
run: wget https://apt.llvm.org/llvm.sh && chmod +x llvm.sh && sudo ./llvm.sh ${{ matrix.llvm-version }} | |
- name: Replace default clang | |
run: | | |
sudo mv /usr/bin/clang /usr/bin/clang-old | |
sudo mv /usr/bin/clang++ /usr/bin/clang++-old | |
sudo ln -s /usr/bin/clang-${{ matrix.llvm-version }} /usr/bin/clang | |
sudo ln -s /usr/bin/clang++-${{ matrix.llvm-version }} /usr/bin/clang++ | |
sudo ln -s /usr/bin/opt-${{ matrix.llvm-version }} /usr/bin/opt | |
- name: Check LLVM and Clang | |
run: clang --version && opt --version | |
- name: Configure CMake with Clang | |
run: cmake -B build -DLLVM_DIR=/usr/lib/llvm-${{ matrix.llvm-version }}/cmake -DCMAKE_C_COMPILER=clang-${{ matrix.llvm-version }} -DCMAKE_CXX_COMPILER=clang++-${{ matrix.llvm-version }} | |
- name: Build | |
run: | | |
cmake --build build -t run_test | |
- name: Copy artifact | |
run: | | |
mkdir -p artifacts | |
cp build/libpasses.so artifacts/libpasses-${{ matrix.llvm-version }}.so | |
cp build/wrapper artifacts/wrapper | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: libpasses-${{ matrix.llvm-version }} | |
path: artifacts | |
retention-days: 1 | |
release: | |
needs: llvm | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' && github.ref == 'refs/heads/master' | |
steps: | |
- name: Download all artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: artifacts | |
- name: Create release archive | |
run: | | |
mkdir release_files | |
find artifacts -name "libpasses-*.so" -exec cp {} release_files/ \; | |
cp artifacts/wrapper release_files/ | |
cd release_files | |
zip -r ../libpasses.zip * | |
cd .. | |
- name: Generate release tag | |
id: tag | |
run: | | |
echo "TAG_NAME=release-$(date +'%Y%m%d%H%M%S')" >> $GITHUB_OUTPUT | |
- name: Create Release and Upload Asset | |
uses: softprops/action-gh-release@v2 | |
with: | |
tag_name: ${{ steps.tag.outputs.TAG_NAME }} | |
name: Release ${{ steps.tag.outputs.TAG_NAME }} | |
draft: false | |
prerelease: false | |
files: ./libpasses.zip |