1414
1515jobs :
1616 build_flang :
17- runs-on : ubuntu-20 .04
17+ runs-on : ubuntu-22 .04
1818 env :
1919 install_prefix : /usr/local
2020 strategy :
2121 matrix :
2222 target : [X86]
23- cc : [clang, gcc]
24- version : [10, 11]
25- llvm_branch : [release_15x]
23+ cc : [clang]
24+ version : [14, 15]
25+ llvm_branch : [release_16x, release_17x]
26+ include :
27+ - target : X86
28+ cc : gcc
29+ version : 12
30+ llvm_branch : release_16x
31+ - target : X86
32+ cc : gcc
33+ version : 12
34+ llvm_branch : release_17x
2635
2736 steps :
2837 # Checks-out your repository under $GITHUB_WORKSPACE, so the job can access it
@@ -45,21 +54,27 @@ jobs:
4554 - name : Download artifacts
4655 run : |
4756 cd ../..
48- curl -sL https://api.github.com/repos/flang-compiler/classic-flang-llvm-project/actions/workflows/pre-compile_llvm.yml/runs --output runs_llvm.json
49- wget --output-document artifacts_llvm `jq -r '.workflow_runs[0].artifacts_url?' runs_llvm.json`
50-
51- i="0"
52- # Keep checking older builds to find the right branch and correct number of artifacts
53- while { [ `jq -r '.total_count?' artifacts_llvm` != "5" ] || \
54- [ `jq -r --argjson i "$i" '.workflow_runs[$i].head_branch?' runs_llvm.json` != ${{ matrix.llvm_branch }} ]; } && \
55- [ $i -lt 10 ];
56- do
57- echo "No artifacts or wrong branch in build $i, counting from latest"
58- i=$[$i+1]
59- wget --output-document artifacts_llvm `jq -r --argjson i "$i" '.workflow_runs[$i].artifacts_url?' runs_llvm.json`
57+ # Search backwards in the workflow history for the specified branch
58+ # for the first successful run that produced the desired artifact.
59+ build_name="llvm_build_${{ matrix.target }}_${{ matrix.cc }}_${{ matrix.version }}_${{ matrix.llvm_branch }}"
60+ curl -sL https://api.github.com/repos/flang-compiler/classic-flang-llvm-project/actions/workflows/pre-compile_llvm.yml/runs -o llvm_runs.json
61+ urls=(`jq -r --arg b ${{ matrix.llvm_branch }} '.workflow_runs[] | select(.head_branch == $b) | select (.conclusion == "success") | .artifacts_url?' llvm_runs.json`)
62+ for artifacts_url in "${urls[@]}"; do
63+ curl -sL "$artifacts_url" -o llvm_artifacts.json
64+ archive_url=`jq -r --arg b $build_name '.artifacts[] | select(.name == $b) | .archive_download_url' llvm_artifacts.json`
65+ if [ -z "$archive_url" ]; then
66+ echo "$artifacts_url did not contain a $build_name archive; too old?"
67+ continue
68+ fi
69+ echo "Downloading $archive_url."
70+ if curl -sL -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" $archive_url -o llvm_build.zip; then
71+ break
72+ fi
6073 done
61- url=`jq -r '.artifacts[] | select(.name == "llvm_build_${{ matrix.target }}_${{ matrix.cc }}_${{ matrix.version }}_${{ matrix.llvm_branch }}") | .archive_download_url' artifacts_llvm`
62- wget --output-document llvm_build.zip --header="Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" $url
74+ if [ ! -f llvm_build.zip ]; then
75+ echo "Could not download the correct prebuilt compiler; aborting."
76+ exit 1
77+ fi
6378
6479 - name : Install llvm
6580 run : |
7085 cd classic-flang-llvm-project/build
7186 sudo make install/fast
7287
73- # gcc11 and g++11 are needed to install llvm
74- - if : matrix.cc == 'gcc' && matrix.version == '11'
75- run : sudo apt install gcc-11 g++-11
76-
7788 - name : Build and install flang & libpgmath
7889 run : |
7990 ${{ env.install_prefix }}/bin/clang --version
@@ -89,13 +100,13 @@ jobs:
89100 make check-flang-long
90101
91102 # Archive documentation just once, for the fastest job.
92- - if : matrix.cc == 'clang' && matrix.version == '11 '
103+ - if : matrix.cc == 'clang' && matrix.version == '15 '
93104 run : |
94105 cd build/flang/docs/web
95106 cp -r html/ ../../.. # copy to a place where Upload can find it.
96107
97108 # Upload docs just once, for the fastest job.
98- - if : matrix.cc == 'clang' && matrix.version == '11 '
109+ - if : matrix.cc == 'clang' && matrix.version == '15 '
99110 uses : actions/upload-artifact@v2
100111 with :
101112 name : html_docs_flang
0 commit comments