github: rework clang-compilation CI #218
Workflow file for this run
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: Clang (LLVM) intrinsic test case compilation | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
workflow_dispatch: # Allows manual triggering of the workflow | |
jobs: | |
build-and-test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
llvm-version: [latest-rel] | |
env: | |
COMPILER: llvm-project/build/bin/clang | |
EXTRA_CFLAGS: "-target riscv64" | |
steps: | |
- name: Checkout rvv-intrinsic-doc | |
uses: actions/checkout@v4 | |
with: | |
repository: riscv-non-isa/rvv-intrinsic-doc | |
path: rvv-intrinsic-doc | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
- name: Install Python dependencies | |
run: | | |
pip install junitparser | |
working-directory: ${{ github.workspace }} | |
- name: Set up LLVM (latest release) | |
if: matrix.llvm-version == 'latest-rel' | |
run: | | |
latest_release=$(curl -sL https://api.github.com/repos/llvm/llvm-project/releases/latest) | |
download_url=$(echo "$latest_release" | jq -r '.assets[] | select(.name | endswith("Linux-X64.tar.xz")) | .browser_download_url') | |
if [ -z "$download_url" ]; then | |
echo "Error: Could not find Linux X64 tarball URL" | |
exit 1 | |
fi | |
filename=$(basename "$download_url") | |
echo "Downloading $filename..." | |
curl -sL -o "$filename" "$download_url" | |
tar xf "$filename" | |
extracted_dir=$(tar tf "$filename" | head -1 | cut -f1 -d"/") | |
# Set the COMPILER environment variable | |
echo "COMPILER=${{ github.workspace }}/$extracted_dir/bin/clang" >> $GITHUB_ENV | |
working-directory: ${{ github.workspace }} | |
- name: Install prerequisites (main) | |
if: matrix.llvm-version == 'main' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y ninja-build | |
working-directory: ${{ github.workspace }} | |
- name: Checkout LLVM (main) | |
if: matrix.llvm-version == 'main' | |
uses: actions/checkout@v4 | |
with: | |
repository: llvm/llvm-project | |
path: llvm-project | |
fetch-depth: 1 | |
- name: Configure & Build LLVM (main) | |
if: matrix.llvm-version == 'main' | |
run: | | |
mkdir -p build && cd build | |
cmake -G Ninja ../llvm \ | |
-DCMAKE_C_COMPILER=`which clang` \ | |
-DCMAKE_CXX_COMPILER=`which clang++` \ | |
-DCMAKE_BUILD_TYPE=Release \ | |
-DLLVM_ENABLE_PROJECTS="clang" \ | |
-DLLVM_TARGETS_TO_BUILD="RISCV" \ | |
-DLLVM_DEFAULT_TARGET_TRIPLE="riscv64-unknown-linux-gnu" | |
ninja | |
working-directory: llvm-project | |
- name: Test | |
# shell: 'script --return --quiet --log-out /dev/null --command "bash -e {0}"' | |
shell: bash | |
run: | | |
export PYTHONUNBUFFERED=1 | |
make -C rvv-intrinsic-generator run-vector-crypto-api-testing SHELL="bash -x" | |
continue-on-error: true | |
working-directory: rvv-intrinsic-doc | |
- name: show log | |
# shell: 'script --return --quiet --log-out /dev/null --command "bash -e {0}"' | |
shell: bash | |
if: always() | |
run: | | |
ls -al auto-generated/vector-crypto/api-testing/ | |
cat auto-generated/vector-crypto/api-testing/*.log | |
continue-on-error: true | |
working-directory: rvv-intrinsic-doc | |
# - name: Run compilation test, non-overloaded intrinsics (default (TAMA) policy) | |
# run: | | |
# set -e # Exit on any error | |
# make -C rvv-intrinsic-generator run-api-testing run-bfloat16-api-testing run-vector-crypto-api-testing | |
# working-directory: rvv-intrinsic-doc | |
# - name: Run compilation test, overloaded intrinsics (default (TAMA) policy) | |
# run: | | |
# set -e # Exit on any error | |
# make -C rvv-intrinsic-generator run-overloaded-api-testing run-bfloat16-overloaded-api-testing run-vector-crypto-overloaded-api-testing | |
# working-directory: rvv-intrinsic-doc | |
# - name: Run compilation test, non-overloaded intrinsics (non-default policy) | |
# run: | | |
# set -e # Exit on any error | |
# make -C rvv-intrinsic-generator run-policy-api-testing run-bfloat16-policy-api-testing run-vector-crypto-policy-api-testing | |
# working-directory: rvv-intrinsic-doc | |
# - name: Run compilation test, overloaded intrinsics (non-default policy) | |
# run: | | |
# set -e # Exit on any error | |
# make -C rvv-intrinsic-generator run-policy-overloaded-api-testing run-bfloat16-policy-overloaded-api-testing run-vector-crypto-policy-overloaded-api-testing | |
# working-directory: rvv-intrinsic-doc |