diff --git a/.github/workflows/build_flang.yml b/.github/workflows/build_flang.yml index b8a0d08e185..76592938020 100644 --- a/.github/workflows/build_flang.yml +++ b/.github/workflows/build_flang.yml @@ -14,15 +14,18 @@ on: jobs: build_flang: - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 env: install_prefix: /usr/local strategy: matrix: target: [X86] - cc: [clang, gcc] - version: [10, 11] - llvm_branch: [release_15x] + cc: [clang] + version: [14, 15] + llvm_branch: [release_16x, release_17x] + include: + - cc: gcc + version: 12 steps: # Checks-out your repository under $GITHUB_WORKSPACE, so the job can access it @@ -45,21 +48,26 @@ jobs: - 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` + # Search backwards in the workflow history for the specified branch + # for the first successful run that produced the desired artifact. + build_name="llvm_build_${{ matrix.target }}_${{ matrix.cc }}_${{ matrix.version }}_${{ matrix.llvm_branch }}" + curl -sL https://api.github.com/repos/flang-compiler/classic-flang-llvm-project/actions/workflows/pre-compile_llvm.yml/runs -o llvm_runs.json + urls=(`jq -r --arg b ${{ matrix.llvm_branch }} '.workflow_runs[] | select(.head_branch == $b) | select (.conclusion == "success") | .artifacts_url?' llvm_runs.json`) + for artifacts_url in "${urls[@]}"; do + curl -sL "$artifacts_url" -o llvm_artifacts.json + archive_url=`jq -r --arg b $build_name '.artifacts[] | select(.name == $b) | .archive_download_url' llvm_artifacts.json` + if [ -z "$archive_url" ]; then + echo "$artifacts_url did not contains a $build_name archive; too old?" + continue + fi + if curl -sL -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" $archive_url -o llvm_build.zip; then + break + fi 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 + if [ ! -f llvm_build.zip ]; then + echo "Could not download the correct prebuilt compiler; aborting." + exit 1 + fi - name: Install llvm run: | @@ -70,10 +78,6 @@ jobs: 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 @@ -89,13 +93,13 @@ jobs: make check-flang-long # Archive documentation just once, for the fastest job. - - if: matrix.cc == 'clang' && matrix.version == '11' + - 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 == '11' + - if: matrix.cc == 'clang' && matrix.version == '15' uses: actions/upload-artifact@v2 with: name: html_docs_flang diff --git a/.github/workflows/build_flang_arm64.yml b/.github/workflows/build_flang_arm64.yml index 0f16a4144cc..c10046a495d 100644 --- a/.github/workflows/build_flang_arm64.yml +++ b/.github/workflows/build_flang_arm64.yml @@ -26,7 +26,7 @@ jobs: strategy: matrix: target: [AArch64] - llvm_branch: [release_15x] + llvm_branch: [release_16x, release_17x] steps: - name: Check tools diff --git a/.github/workflows/build_flang_windows.yml b/.github/workflows/build_flang_windows.yml index d76e3140b70..b17e919362d 100644 --- a/.github/workflows/build_flang_windows.yml +++ b/.github/workflows/build_flang_windows.yml @@ -20,7 +20,7 @@ jobs: os: - windows-latest # - self-hosted - llvm_branch: [release_15x] + llvm_branch: [release_16x, release_17x] include: - os: windows-latest arch: amd64