| 
 | 1 | +name: Check LLVM Versions  | 
 | 2 | + | 
 | 3 | +on:  | 
 | 4 | +  push:  | 
 | 5 | +    branches: [ master ]  | 
 | 6 | +  issue_comment: # On PR issue comment  | 
 | 7 | +    types: [ created ]  | 
 | 8 | + | 
 | 9 | +jobs:  | 
 | 10 | +  comment-triggered:  | 
 | 11 | +    runs-on: ubuntu-20.04  | 
 | 12 | + | 
 | 13 | +    outputs:  | 
 | 14 | +      value: ${{ steps.value.outputs.value }}  | 
 | 15 | +      checks_should_run: ${{ steps.checks_should_run.outputs.checks_should_run }}  | 
 | 16 | + | 
 | 17 | +    steps:  | 
 | 18 | +    - id: value  | 
 | 19 | +    # Allow triggering with a comment of `Do: Check LLVM Versions`.  | 
 | 20 | +    # If we are a pull_request, we have the trigger comment, and the person  | 
 | 21 | +    # requesting is the one who made the PR, then we run.  | 
 | 22 | +      run: >-  | 
 | 23 | +        echo "::set-output name=value::${{ github.event_name == 'issue_comment'  | 
 | 24 | +        && github.event.issue.pull_request != ''  | 
 | 25 | +        && github.event.comment.body == 'Do: Check LLVM Versions'  | 
 | 26 | +        && github.event.comment.user.id == github.event.issue.user.id }}"  | 
 | 27 | +
  | 
 | 28 | +    - id: checks_should_run  | 
 | 29 | +      run: >-  | 
 | 30 | +        echo "::set-output name=checks_should_run::${{  | 
 | 31 | +          steps.value.outputs.value == 'true'  | 
 | 32 | +          || github.event_name == 'push'  | 
 | 33 | +          || github.event_name == 'pull_request' }}"  | 
 | 34 | +
  | 
 | 35 | +  init-report:  | 
 | 36 | +    needs: comment-triggered  | 
 | 37 | +    runs-on: ubuntu-20.04  | 
 | 38 | +    if: needs.comment-triggered.outputs.value == 'true'  | 
 | 39 | + | 
 | 40 | +    outputs:  | 
 | 41 | +      report: ${{ steps.report.outputs.comment-id }}  | 
 | 42 | + | 
 | 43 | +    steps:  | 
 | 44 | +    - name: Initialize Report  | 
 | 45 | +      uses:  peter-evans/[email protected]  | 
 | 46 | +      id: report  | 
 | 47 | +      with:  | 
 | 48 | +        issue-number: ${{ github.event.issue.number }}  | 
 | 49 | +        body: |  | 
 | 50 | +          Checking LLVM versions: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}  | 
 | 51 | +
  | 
 | 52 | +  check-llvm-versions:  | 
 | 53 | +    needs: comment-triggered  | 
 | 54 | +    runs-on: ubuntu-${{ matrix.os }}  | 
 | 55 | +    if: needs.comment-triggered.outputs.checks_should_run == 'true'  | 
 | 56 | + | 
 | 57 | +    strategy:  | 
 | 58 | +      fail-fast: false  | 
 | 59 | +      matrix:  | 
 | 60 | +        include:  | 
 | 61 | +          - llvm: 7  | 
 | 62 | +            llvm-ver: 7.1  | 
 | 63 | +            os: 18.04  | 
 | 64 | +            ubuntu: bionic  | 
 | 65 | +          - llvm: 8  | 
 | 66 | +            llvm-ver: 8.0  | 
 | 67 | +            os: 18.04  | 
 | 68 | +            ubuntu: bionic  | 
 | 69 | +          - llvm: 9  | 
 | 70 | +            llvm-ver: 9.0  | 
 | 71 | +            os: 20.04  | 
 | 72 | +            ubuntu: focal  | 
 | 73 | +          - llvm: 10  | 
 | 74 | +            llvm-ver: 10.0  | 
 | 75 | +            os: 20.04  | 
 | 76 | +            ubuntu: focal  | 
 | 77 | +          - llvm: 11  | 
 | 78 | +            llvm-ver: 11.1  | 
 | 79 | +            os: 20.04  | 
 | 80 | +            ubuntu: focal  | 
 | 81 | +          - llvm: 12  | 
 | 82 | +            llvm-ver: 12.0  | 
 | 83 | +            os: 20.04  | 
 | 84 | +            ubuntu: focal  | 
 | 85 | +          - llvm: 13  | 
 | 86 | +            llvm-ver: 13.0  | 
 | 87 | +            os: 20.04  | 
 | 88 | +            ubuntu: focal  | 
 | 89 | + | 
 | 90 | +    steps:  | 
 | 91 | +    - name: Install dependencies  | 
 | 92 | +      run: |  | 
 | 93 | +        # Setup LLVM GPG Key  | 
 | 94 | +        wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -  | 
 | 95 | +
  | 
 | 96 | +        sudo add-apt-repository "deb http://apt.llvm.org/${{ matrix.ubuntu }}/ llvm-toolchain-${{ matrix.ubuntu }}-${{ matrix.llvm }} main"  | 
 | 97 | +        sudo apt-get update  | 
 | 98 | +
  | 
 | 99 | +        sudo apt-get install clang++-${{ matrix.llvm }} llvm-${{ matrix.llvm }} ninja-build  | 
 | 100 | +
  | 
 | 101 | +    - uses: actions/checkout@v2  | 
 | 102 | +      with:  | 
 | 103 | +        fetch-depth: 0  | 
 | 104 | + | 
 | 105 | +    - run: |  | 
 | 106 | +        echo ${{ github.token }} | gh auth login --with-token  | 
 | 107 | +        gh pr checkout ${{ github.event.issue.number }}  | 
 | 108 | +      if: needs.comment-triggered.outputs.value == 'true'  | 
 | 109 | +
  | 
 | 110 | +    - name: Configure OptSched  | 
 | 111 | +      run: |  | 
 | 112 | +        mkdir build-optsched && cd build-optsched  | 
 | 113 | +
  | 
 | 114 | +        cmake .. -GNinja                                                               \  | 
 | 115 | +            -DCMAKE_BUILD_TYPE=Release                                                 \  | 
 | 116 | +            -DOPTSCHED_LLVM_VERSION=${{ matrix.llvm-ver }}                                 \  | 
 | 117 | +            -DCMAKE_CXX_COMPILER=g++ -DCMAKE_C_COMPILER=gcc                            \  | 
 | 118 | +            -DOPTSCHED_ENABLE_AMDGPU=OFF                                               \  | 
 | 119 | +            -DCMAKE_INSTALL_PREFIX=$PWD/install  | 
 | 120 | +
  | 
 | 121 | +    - name: Build OptSched  | 
 | 122 | +      working-directory: build-optsched  | 
 | 123 | +      run: ninja  | 
 | 124 | + | 
 | 125 | +    - name: Run tests  | 
 | 126 | +      working-directory: build-optsched  | 
 | 127 | +      run: ctest -VV  | 
 | 128 | + | 
 | 129 | +  report:  | 
 | 130 | +    needs: [comment-triggered, init-report, check-llvm-versions]  | 
 | 131 | +    runs-on: ubuntu-20.04  | 
 | 132 | +    if: always()  | 
 | 133 | + | 
 | 134 | +    steps:  | 
 | 135 | +    - name: Report CI  | 
 | 136 | +      if: needs.comment-triggered.outputs.value == 'true'  | 
 | 137 | +      uses:  peter-evans/[email protected]  | 
 | 138 | +      with:  | 
 | 139 | +        comment-id: ${{ needs.init-report.outputs.report }}  | 
 | 140 | +        body: |  | 
 | 141 | +          | Check | Status |  | 
 | 142 | +          | ----- | ------ |  | 
 | 143 | +          ${{  | 
 | 144 | +            format('| Check LLVM Versions | {0}{1}{2} |',  | 
 | 145 | +              needs.check-llvm-versions.result == 'success' && '✔ Passed' || '',  | 
 | 146 | +              needs.check-llvm-versions.result == 'failure' && '❌ Failed' || '',  | 
 | 147 | +              (needs.check-llvm-versions.result != 'success' && needs.check-llvm-versions.result != 'failure') && 'Skipped' || ''  | 
 | 148 | +            )  | 
 | 149 | +          }}  | 
0 commit comments