[workflows] Update GitHub workflows #1563
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: 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-22.04 | |
env: | |
install_prefix: /usr/local | |
strategy: | |
matrix: | |
target: [X86] | |
cc: [clang] | |
version: [14, 15] | |
llvm_branch: [release_16x, release_17x] | |
include: | |
- target: X86 | |
cc: gcc | |
version: 12 | |
llvm_branch: [release_16x, release_17x] | |
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 -o llvm_runs.json | |
# Search backwards in the workflow history for a run that targeted the | |
# the desired branch and produced the correct number of artifacts, | |
# i.e. ran all jobs successfully. Each run of pre-compile_llvm.yml is | |
# expected to produce 4 artifacts. Give up after 10 attempts. | |
i=0 | |
while [ $i -lt 10 ]; do | |
curl -sL "`jq -r '.workflow_runs[$i].artifacts_url?' llvm_runs.json`" -o llvm_artifacts.json | |
if [ "`jq -r '.workflow_runs[$i].head_branch?' llvm_runs.json`" != ${{ matrix.llvm_branch }} ]; then | |
if [ "`jq -r '.total_count?' llvm_artifacts.json`" == "4" ]; then | |
url=`jq -r '.artifacts[] | select(.name == "llvm_build_${{ matrix.target }}_${{ matrix.cc }}_${{ matrix.version }}_${{ matrix.llvm_branch }}") | .archive_download_url' llvm_artifacts.json` | |
curl -sL -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" $url -o llvm_build.zip | |
break | |
else | |
echo "Build (N-$i) did not produced the correct number of artifacts." | |
fi | |
else | |
echo "Build (N-$i) did not target ${{ matrix.llvm_branch }}." | |
fi | |
i=$((i + 1)) | |
done | |
- 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 | |
- 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 == '15' | |
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 == '15' | |
uses: actions/upload-artifact@v2 | |
with: | |
name: html_docs_flang | |
path: html |