Skip to content

[LLVM16][build] Specify LLVM_MAIN_SRC_DIR when running build-flang.sh #1476

[LLVM16][build] Specify LLVM_MAIN_SRC_DIR when running build-flang.sh

[LLVM16][build] Specify LLVM_MAIN_SRC_DIR when running build-flang.sh #1476

Workflow file for this run

name: Flang build & test
on:
push:
branches: [ master ]
paths-ignore:
- '**/.github/workflows/build_flang_arm64.yml'
- '**/.github/workflows/build_flang_windows.yml'
pull_request:
branches: [ master ]
paths-ignore:
- '**/.github/workflows/build_flang_arm64.yml'
- '**/.github/workflows/build_flang_windows.yml'
jobs:
build_flang:
runs-on: ubuntu-20.04
env:
install_prefix: /usr/local
strategy:
matrix:
target: [X86]
cc: [clang, gcc]
version: [10, 11]
llvm_branch: [release_15x]
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so the job can access it
- uses: actions/checkout@v2
- name: ccache
uses: hendrikmuhs/ccache-action@v1
with:
key: ${{ matrix.cc }}-${{ matrix.version }}
- name: Check tools
run: |
sudo apt update
sudo apt install python3-sphinx
git --version
cmake --version
make --version
# Download artifacts for the classic-flang-llvm-project-related builds (all toolchains)
- name: Download artifacts
run: |
cd ../..
curl -sL https://api.github.com/repos/flang-compiler/classic-flang-llvm-project/actions/workflows/pre-compile_llvm.yml/runs --output runs_llvm.json
wget --output-document artifacts_llvm `jq -r '.workflow_runs[0].artifacts_url?' runs_llvm.json`
i="0"
# Keep checking older builds to find the right branch and correct number of artifacts
while { [ `jq -r '.total_count?' artifacts_llvm` != "5" ] || \
[ `jq -r --argjson i "$i" '.workflow_runs[$i].head_branch?' runs_llvm.json` != ${{ matrix.llvm_branch }} ]; } && \
[ $i -lt 10 ];
do
echo "No artifacts or wrong branch in build $i, counting from latest"
i=$[$i+1]
wget --output-document artifacts_llvm `jq -r --argjson i "$i" '.workflow_runs[$i].artifacts_url?' runs_llvm.json`
done
url=`jq -r '.artifacts[] | select(.name == "llvm_build_${{ matrix.target }}_${{ matrix.cc }}_${{ matrix.version }}_${{ matrix.llvm_branch }}") | .archive_download_url' artifacts_llvm`
wget --output-document llvm_build.zip --header="Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" $url
- name: Install llvm
run: |
cd ../..
# Don't clone nor build - use the prepackaged sources and prebuilt build directory
unzip llvm_build.zip
tar xzf llvm_build.tar.gz
cd classic-flang-llvm-project/build
sudo make install/fast
# gcc11 and g++11 are needed to install llvm
- if: matrix.cc == 'gcc' && matrix.version == '11'
run: sudo apt install gcc-11 g++-11
- name: Build and install flang & libpgmath
run: |
${{ env.install_prefix }}/bin/clang --version
./build-flang.sh -t ${{ matrix.target }} -p ${{ env.install_prefix }} -n $(nproc) -c -s -v -l $(realpath ../../classic-flang-llvm-project/llvm)
- name: Copy llvm-lit
run: |
cp ../../classic-flang-llvm-project/build/bin/llvm-lit build/flang/bin/.
- name: Test flang
run: |
cd build/flang
make check-flang-long
# Archive documentation just once, for the fastest job.
- if: matrix.cc == 'clang' && matrix.version == '11'
run: |
cd build/flang/docs/web
cp -r html/ ../../.. # copy to a place where Upload can find it.
# Upload docs just once, for the fastest job.
- if: matrix.cc == 'clang' && matrix.version == '11'
uses: actions/upload-artifact@v2
with:
name: html_docs_flang
path: html