fix(#14): build script does not rebuild when the LLVM prefix has been… #189
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: Linux Test Suite | |
on: [push, pull_request] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
linux-tests-opt: | |
name: "LLVM/OPT ${{ matrix.llvm-version[0] }} Linux" | |
runs-on: ubuntu-latest | |
env: | |
LLVM_INSTALL_PATH: ~/llvm | |
PLUGINS_PATH: tests/plugins/target/debug | |
strategy: | |
matrix: | |
llvm-version: | |
- ["10", "10-0", "v10.0.1-rust-1.46/llvm-10.0.1-rust-1.46-linux-x86_64.tar.gz", "libLLVM-10.so"] | |
- ["11", "11-0", "v11.0.1-rust-1.51/llvm-lld-11.0.1-rust-1.51-linux-x86_64.tar.gz", "libLLVM-11.so"] | |
- ["12", "12-0", "v12.0.1-rust-1.55/llvm-lld-12.0.1-rust-1.55-linux-x86_64.tar.gz", "libLLVM-12.so"] | |
- ["13", "13-0", "v13.0.0-rust-1.59/llvm-lld-13.0.0-rust-1.59-linux-x86_64.tar.gz", "libLLVM-13.so"] | |
- ["14", "14-0", "v14.0.6-rust-1.64/llvm-lld-14.0.6-rust-1.64-linux-x86_64.tar.gz", "libLLVM-14.so"] | |
- ["15", "15-0", "v15.0.0-rust-1.65/llvm-lld-15.0.0-rust-1.65-linux-x86_64.tar.gz", "libLLVM-15.so"] | |
- ["16", "16-0", "v16.0.2-rust-1.71/llvm-lld-16.0.2-rust-1.71-linux-x86_64.tar.gz", "libLLVM-16.so"] | |
- ["17", "17-0", "v17.0.6-rust-1.75/llvm-lld-17.0.6-rust-1.75-linux-x86_64.tar.gz", "libLLVM-17.so"] | |
- ["18", "18-0", "v18.1.2-rust-1.78/llvm-lld-18.1.2-rust-1.78-linux-x86_64.tar.gz", "libLLVM.so.18.1"] | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v2 | |
- name: Setup LLVM Installation Path | |
run: | | |
mkdir ${{ env.LLVM_INSTALL_PATH }} | |
echo "$HOME/llvm/bin" >> $GITHUB_PATH | |
- name: Check LLVM Artifacts In Cache | |
id: cache-llvm | |
uses: actions/cache@v3 | |
with: | |
path: | | |
${{ env.LLVM_INSTALL_PATH }}/bin/llvm-config | |
${{ env.LLVM_INSTALL_PATH }}/bin/opt | |
${{ env.LLVM_INSTALL_PATH }}/lib/${{ matrix.llvm-version[3] }} | |
${{ env.LLVM_INSTALL_PATH }}/lib/libLLVM.so | |
${{ env.LLVM_INSTALL_PATH }}/include | |
key: ${{ runner.os }}-llvm-${{ matrix.llvm-version[0] }}-opt | |
- name: Download LLVM Binaries | |
if: steps.cache-llvm.outputs.cache-hit != 'true' | |
run: | | |
wget --user-agent='GithubCI' -O llvm.tar.gz https://github.com/jamesmth/llvm-project/releases/download/${{ matrix.llvm-version[2] }} | |
tar -C ~ -xf llvm.tar.gz | |
- name: Build Tests | |
run: | | |
cargo b \ | |
--manifest-path tests/plugins/Cargo.toml \ | |
-p plugin* \ | |
--no-default-features \ | |
--features target-x86,llvm${{ matrix.llvm-version[1] }} | |
- name: Run Tests | |
run: | | |
opt \ | |
--load-pass-plugin="${{ env.PLUGINS_PATH }}/libplugin1.so" \ | |
--passes="mpass,function(fpass)" \ | |
tests/test.ll \ | |
-disable-output | |
opt \ | |
--load-pass-plugin="${{ env.PLUGINS_PATH }}/libplugin2.so" \ | |
--passes="mpass1,mpass2" \ | |
tests/test.ll \ | |
-disable-output | |
opt \ | |
--load-pass-plugin="${{ env.PLUGINS_PATH }}/libplugin3.so" \ | |
--passes="mpass1,mpass2" \ | |
tests/test.ll \ | |
-disable-output | |
opt \ | |
--load-pass-plugin="${{ env.PLUGINS_PATH }}/libplugin4.so" \ | |
--passes="mpass,function(fpass)" \ | |
tests/test.ll \ | |
-disable-output | |
opt \ | |
--load-pass-plugin="${{ env.PLUGINS_PATH }}/libplugin5.so" \ | |
--passes="mpass,function(fpass)" \ | |
tests/test.ll \ | |
-disable-output | |
opt \ | |
--load-pass-plugin="${{ env.PLUGINS_PATH }}/libplugin6.so" \ | |
--passes="default<O3>" \ | |
tests/test.ll \ | |
-disable-output | |
opt \ | |
--load-pass-plugin="${{ env.PLUGINS_PATH }}/libplugin7.so" \ | |
--passes="lto<O3>" \ | |
tests/test.ll \ | |
-disable-output | |
linux-tests-lld: | |
name: "LLVM/LLD ${{ matrix.llvm-version[0] }} Linux" | |
runs-on: ubuntu-latest | |
env: | |
LLVM_INSTALL_PATH: ~/llvm | |
PLUGINS_PATH: tests/plugins/target/debug | |
strategy: | |
matrix: | |
llvm-version: | |
- ["11", "11-0", "1.51", "v11.0.1-rust-1.51/llvm-lld-11.0.1-rust-1.51-linux-x86_64.tar.gz", "libLLVM-11.so"] | |
- ["12", "12-0", "1.55", "v12.0.1-rust-1.55/llvm-lld-12.0.1-rust-1.55-linux-x86_64.tar.gz", "libLLVM-12.so"] | |
- ["13", "13-0", "1.59", "v13.0.0-rust-1.59/llvm-lld-13.0.0-rust-1.59-linux-x86_64.tar.gz", "libLLVM-13.so"] | |
- ["14", "14-0", "1.64", "v14.0.6-rust-1.64/llvm-lld-14.0.6-rust-1.64-linux-x86_64.tar.gz", "libLLVM-14.so"] | |
- ["15", "15-0", "1.65", "v15.0.0-rust-1.65/llvm-lld-15.0.0-rust-1.65-linux-x86_64.tar.gz", "libLLVM-15.so"] | |
- ["16", "16-0", "1.71", "v16.0.2-rust-1.71/llvm-lld-16.0.2-rust-1.71-linux-x86_64.tar.gz", "libLLVM-16.so"] | |
- ["17", "17-0", "1.75", "v17.0.6-rust-1.75/llvm-lld-17.0.6-rust-1.75-linux-x86_64.tar.gz", "libLLVM-17.so"] | |
- ["18", "18-0", "1.78", "v18.1.2-rust-1.78/llvm-lld-18.1.2-rust-1.78-linux-x86_64.tar.gz", "libLLVM.so.18.1"] | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v2 | |
- name: Setup LLVM Installation Path | |
run: | | |
mkdir ${{ env.LLVM_INSTALL_PATH }} | |
echo "$HOME/llvm/bin" >> $GITHUB_PATH | |
- name: Check LLVM Artifacts In Cache | |
id: cache-llvm | |
uses: actions/cache@v3 | |
with: | |
path: | | |
${{ env.LLVM_INSTALL_PATH }}/bin/llvm-config | |
${{ env.LLVM_INSTALL_PATH }}/bin/lld | |
${{ env.LLVM_INSTALL_PATH }}/bin/ld.lld | |
${{ env.LLVM_INSTALL_PATH }}/lib/${{ matrix.llvm-version[4] }} | |
${{ env.LLVM_INSTALL_PATH }}/lib/libLLVM.so | |
${{ env.LLVM_INSTALL_PATH }}/include | |
key: ${{ runner.os }}-llvm-${{ matrix.llvm-version[0] }}-lld | |
- name: Download LLVM Binaries | |
if: steps.cache-llvm.outputs.cache-hit != 'true' | |
run: | | |
wget --user-agent='GithubCI' -O llvm.tar.gz https://github.com/jamesmth/llvm-project/releases/download/${{ matrix.llvm-version[3] }} | |
tar -C ~ -xf llvm.tar.gz | |
- name: Build Tests | |
run: | | |
cargo b \ | |
--manifest-path tests/plugins/Cargo.toml \ | |
-p plugin*-lld \ | |
--no-default-features \ | |
--features target-x86,llvm${{ matrix.llvm-version[1] }} | |
- name: Run Tests | |
run: | | |
rustup install ${{ matrix.llvm-version[2] }} | |
rustup default ${{ matrix.llvm-version[2] }} | |
RUSTFLAGS=" \ | |
-Clinker-plugin-lto \ | |
-Clink-arg=-B${{ env.LLVM_INSTALL_PATH }}/bin \ | |
-Clink-arg=-fuse-ld=lld \ | |
-Clink-arg=-Xlinker \ | |
-Clink-arg=--load-pass-plugin="$GITHUB_WORKSPACE/${{ env.PLUGINS_PATH }}/libplugin1_lld.so" \ | |
-Clink-arg=-Xlinker \ | |
-Clink-arg=--lto-newpm-passes=mpass \ | |
" \ | |
cargo b --manifest-path tests/test-rust/Cargo.toml --release | |
[ $(cat ~/rust.ll) == "1" ] |