From ed93d000e4e26428f1960d6d430596246cb972f9 Mon Sep 17 00:00:00 2001 From: Pawel Szymichowski Date: Mon, 24 Oct 2022 18:48:46 +0200 Subject: [PATCH 1/6] Github Action improvements * Run verification build for all ocl-open-* releases branches weekly, * A separate workflow for running verification on demand, * Much improved on push/pull_request verification workflow that parses destination branch to get correct dependencies. --- .github/actions/build-opencl-clang/action.yml | 57 +++++++++++++++ .github/workflows/on-demand-verification.yml | 39 ++++++++++ .github/workflows/on-push-verification.yml | 71 +++++++++++++++++++ .github/workflows/scheduled-verification.yml | 44 ++++++++++++ 4 files changed, 211 insertions(+) create mode 100644 .github/actions/build-opencl-clang/action.yml create mode 100644 .github/workflows/on-demand-verification.yml create mode 100644 .github/workflows/on-push-verification.yml create mode 100644 .github/workflows/scheduled-verification.yml diff --git a/.github/actions/build-opencl-clang/action.yml b/.github/actions/build-opencl-clang/action.yml new file mode 100644 index 00000000..4034734b --- /dev/null +++ b/.github/actions/build-opencl-clang/action.yml @@ -0,0 +1,57 @@ +name: Build opencl-clang +inputs: + ref_llvm: + required: true + ref_translator: + required: true + ref_opencl-clang: + required: true + +runs: + using: 'composite' + steps: + + # Setup git credentials to make applying patches possible + - run: | + git config --global user.email "action@intel.com" + git config --global user.name "Action Bot" + shell: bash + + - name: Checkout LLVM + uses: actions/checkout@v3 + with: + repository: llvm/llvm-project + path: llvm-project + ref: ${{ inputs.ref_llvm }} + + - name: Checkout SPIRV-LLVM-Translator + uses: actions/checkout@v3 + with: + repository: KhronosGroup/SPIRV-LLVM-Translator + path: llvm-project/SPIRV-LLVM-Translator + ref: ${{ inputs.ref_translator }} + + - name: Checkout opencl-clang + uses: actions/checkout@v3 + with: + path: llvm-project/opencl-clang + ref: ${{ inputs.ref_opencl-clang }} + + - name: Configure + shell: bash + run: | + mkdir build && cd build + cmake ${{ github.workspace }}/llvm-project/llvm \ + -DLLVM_ENABLE_PROJECTS="clang" \ + -DLLVM_EXTERNAL_PROJECTS="llvm-spirv;opencl-clang" \ + -DLLVM_EXTERNAL_LLVM_SPIRV_SOURCE_DIR=${{ github.workspace }}/llvm-project/SPIRV-LLVM-Translator \ + -DLLVM_EXTERNAL_OPENCL_CLANG_SOURCE_DIR=${{ github.workspace }}/llvm-project/opencl-clang \ + -DCMAKE_BUILD_TYPE=Release \ + -DLLVM_TARGETS_TO_BUILD="X86" \ + -G "Unix Makefiles" + + - name: Build + shell: bash + run: | + cd build + make opencl-clang -j8 diff --git a/.github/workflows/on-demand-verification.yml b/.github/workflows/on-demand-verification.yml new file mode 100644 index 00000000..6c9a66f2 --- /dev/null +++ b/.github/workflows/on-demand-verification.yml @@ -0,0 +1,39 @@ +name: On demand verification +run-name: 'On demand by ${{ github.actor }}' + +# ===--- +# To be run manually by maintainers +# ===--- + +on: + workflow_dispatch: + inputs: + ref_llvm: + description: 'LLVM ref to build with' + required: true + default: 'main' + ref_translator: + description: 'SPIRV-LLVM-Translator ref to build with' + required: true + default: 'main' + ref_opencl-clang: + description: 'opencl-clang ref to build with' + required: true + default: 'master' + +jobs: + + verify_on_demand: + if: ${{ github.ref_name == 'master' }} + runs-on: ubuntu-22.04 + steps: + + - name: Checkout opencl-clang sources for action files availabilty + uses: actions/checkout@v3 + + - name: Run build-opencl-clang action + uses: ./.github/actions/build-opencl-clang + with: + ref_llvm: ${{ inputs.ref_llvm }} + ref_translator: ${{ inputs.ref_translator }} + ref_opencl-clang: ${{ inputs.ref_opencl-clang }} diff --git a/.github/workflows/on-push-verification.yml b/.github/workflows/on-push-verification.yml new file mode 100644 index 00000000..0bc8ff53 --- /dev/null +++ b/.github/workflows/on-push-verification.yml @@ -0,0 +1,71 @@ +name: On push verification +run-name: '${{ github.event_name }}: ${{ github.base_ref }} ${{ github.ref_name }}' # github.base_ref null for 'on: push' + +# ===--- +# Running on push & pull_request. +# This workflow parses the destination branch +# to choose correct dependencies revisions +# ===--- + +on: + push: + branches: + - master + - ocl-open-* + pull_request: + branches: + - master + - ocl-open-* + types: + - opened + - reopened + - synchronize # commit pushed to the PR + - ready_for_review # moved from draft state + +jobs: + + verify_default_branch: + name: Verify for `master` branch + # ref_name for 'on: push' + # base_ref for 'on: pull_request' + if: ${{ (github.event_name == 'push' && github.ref_name == 'master') || (github.event_name == 'pull_request' && github.base_ref == 'master') }} + runs-on: ubuntu-22.04 + steps: + + - name: Checkout opencl-clang sources for action files + uses: actions/checkout@v3 + + - name: Run build-opencl-clang action + uses: ./.github/actions/build-opencl-clang + with: + ref_llvm: main + ref_translator: main + ref_opencl-clang: ${{ github.ref }} + + verify_release_branch: + name: Verify for `ocl-open-*` release branch + # ref_name for 'on: push' + # base_ref for 'on: pull_request' + if: ${{ github.ref_name != 'master' && github.base_ref != 'master' }} + runs-on: ubuntu-22.04 + steps: + + - name: Checkout opencl-clang sources for action files + uses: actions/checkout@v3 + + # This step will fail when the branch naming scheme 'ocl-open-XXX' changes! + - name: Parse LLVM version from branch name + id: check-llvm-version + run: | + BRANCH="${{ github.base_ref }}" # on: pull_request, otherwise null + BRANCH=${BRANCH:-${{ github.ref_name }}} # on: push + LLVM_VERSION_LONG=$(echo $BRANCH | grep -oP '\d+') # Eg. 150 for LLVM 15 + LLVM_VERSION_SHORT=${LLVM_VERSION_LONG::-1} # Eg. 15 for LLVM 15 + echo "llvm_version=$LLVM_VERSION_SHORT" >> $GITHUB_OUTPUT + + - name: Run build-opencl-clang action + uses: ./.github/actions/build-opencl-clang + with: + ref_llvm: release/${{ steps.check-llvm-version.outputs.llvm_version }}.x + ref_translator: llvm_release_${{ steps.check-llvm-version.outputs.llvm_version }}0 + ref_opencl-clang: ${{ github.ref }} diff --git a/.github/workflows/scheduled-verification.yml b/.github/workflows/scheduled-verification.yml new file mode 100644 index 00000000..39436d61 --- /dev/null +++ b/.github/workflows/scheduled-verification.yml @@ -0,0 +1,44 @@ +name: Scheduled verification +run-name: Scheduled verification + +# ===--- +# Workflow run for regular SPIRV-LLVM-Translator and LLVM compatibility check +# ===--- + +on: + schedule: + # Run Sunday & Wednesday at 00:00 + - cron: 0 0 * * 0,3 + +jobs: + + verify-default-branches: + runs-on: ubuntu-22.04 + steps: + + - name: Checkout opencl-clang sources for action files availabilty + uses: actions/checkout@v3 + + - name: Run build-opencl-clang action + uses: ./.github/actions/build-opencl-clang + with: + ref_llvm: main + ref_translator: main + ref_opencl-clang: master + + verify-release-branches: + strategy: + matrix: + llvm_version: [ 10, 11, 12, 13, 14, 15 ] + runs-on: ubuntu-22.04 + steps: + + - name: Checkout opencl-clang sources for action files availabilty + uses: actions/checkout@v3 + + - name: Run build-opencl-clang action + uses: ./.github/actions/build-opencl-clang + with: + ref_llvm: release/${{ matrix.llvm_version }}.x + ref_translator: llvm_release_${{ matrix.llvm_version }}0 + ref_opencl-clang: ocl-open-${{ matrix.llvm_version }}0 From fe26a53cff257bcf5cb0e7de51a216aa37a80027 Mon Sep 17 00:00:00 2001 From: Pawel Szymichowski Date: Mon, 24 Oct 2022 18:51:46 +0200 Subject: [PATCH 2/6] Remove deprecated workflow file --- .github/workflows/check-in-tree-build.yml | 68 ----------------------- 1 file changed, 68 deletions(-) delete mode 100644 .github/workflows/check-in-tree-build.yml diff --git a/.github/workflows/check-in-tree-build.yml b/.github/workflows/check-in-tree-build.yml deleted file mode 100644 index 73882b92..00000000 --- a/.github/workflows/check-in-tree-build.yml +++ /dev/null @@ -1,68 +0,0 @@ -name: In-tree build - -on: - push: - branches: - - master - paths-ignore: # no need to check build for: - - 'docs/**' # documentation - - '**.md' # README - pull_request: - branches: - - master - paths-ignore: # no need to check build for: - - 'docs/**' # documentation - - '**.md' # README - schedule: - # Weekly build on Mondays - # Ideally, we might want to simplify our regular nightly build as we - # probably don't need every configuration to be built every day: most of - # them are only necessary in pre-commits to avoid breakages - - cron: 0 0 * * 0 - -env: - LLVM_VERSION: 15 - -jobs: - build_and_test_linux: - name: Linux - strategy: - matrix: - build_type: [Release] - include: - - build_type: Release - fail-fast: false - runs-on: ubuntu-18.04 - steps: - - name: Checkout LLVM sources - uses: actions/checkout@v2 - with: - repository: llvm/llvm-project - ref: main - path: llvm-project - - name: Checkout the translator sources - uses: actions/checkout@v2 - with: - repository: KhronosGroup/SPIRV-LLVM-Translator - ref: main - path: llvm-project/SPIRV-LLVM-Translator - - name: Checkout opencl-clang sources - uses: actions/checkout@v2 - with: - path: llvm-project/opencl-clang - - name: Configure - run: | - mkdir build && cd build - cmake ${{ github.workspace }}/llvm-project/llvm \ - -DLLVM_ENABLE_PROJECTS="clang" \ - -DLLVM_EXTERNAL_PROJECTS="llvm-spirv;opencl-clang" \ - -DLLVM_EXTERNAL_LLVM_SPIRV_SOURCE_DIR=${{ github.workspace }}/llvm-project/SPIRV-LLVM-Translator \ - -DLLVM_EXTERNAL_OPENCL_CLANG_SOURCE_DIR=${{ github.workspace }}/llvm-project/opencl-clang \ - -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ - -DLLVM_TARGETS_TO_BUILD="X86" \ - -G "Unix Makefiles" - - name: Build - run: | - cd build - - make opencl-clang -j2 From 670fcc24659a38aac10e3632ee41b5c73780397c Mon Sep 17 00:00:00 2001 From: Pawel Szymichowski Date: Mon, 24 Oct 2022 18:52:53 +0200 Subject: [PATCH 3/6] Move files documentation around a little bit --- .github/actions/build-opencl-clang/action.yml | 4 ++++ .github/workflows/on-demand-verification.yml | 6 +++--- .github/workflows/on-push-verification.yml | 6 +++--- .github/workflows/scheduled-verification.yml | 6 +++--- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/.github/actions/build-opencl-clang/action.yml b/.github/actions/build-opencl-clang/action.yml index 4034734b..ba9dd91b 100644 --- a/.github/actions/build-opencl-clang/action.yml +++ b/.github/actions/build-opencl-clang/action.yml @@ -1,3 +1,7 @@ +# ===--- +# Main opencl-clang building script +# ===--- + name: Build opencl-clang inputs: ref_llvm: diff --git a/.github/workflows/on-demand-verification.yml b/.github/workflows/on-demand-verification.yml index 6c9a66f2..c96e3f33 100644 --- a/.github/workflows/on-demand-verification.yml +++ b/.github/workflows/on-demand-verification.yml @@ -1,10 +1,10 @@ -name: On demand verification -run-name: 'On demand by ${{ github.actor }}' - # ===--- # To be run manually by maintainers # ===--- +name: On demand verification +run-name: 'On demand by ${{ github.actor }}' + on: workflow_dispatch: inputs: diff --git a/.github/workflows/on-push-verification.yml b/.github/workflows/on-push-verification.yml index 0bc8ff53..45f30523 100644 --- a/.github/workflows/on-push-verification.yml +++ b/.github/workflows/on-push-verification.yml @@ -1,12 +1,12 @@ -name: On push verification -run-name: '${{ github.event_name }}: ${{ github.base_ref }} ${{ github.ref_name }}' # github.base_ref null for 'on: push' - # ===--- # Running on push & pull_request. # This workflow parses the destination branch # to choose correct dependencies revisions # ===--- +name: On push verification +run-name: '${{ github.event_name }}: ${{ github.base_ref }} ${{ github.ref_name }}' # github.base_ref null for 'on: push' + on: push: branches: diff --git a/.github/workflows/scheduled-verification.yml b/.github/workflows/scheduled-verification.yml index 39436d61..8491d18e 100644 --- a/.github/workflows/scheduled-verification.yml +++ b/.github/workflows/scheduled-verification.yml @@ -1,10 +1,10 @@ -name: Scheduled verification -run-name: Scheduled verification - # ===--- # Workflow run for regular SPIRV-LLVM-Translator and LLVM compatibility check # ===--- +name: Scheduled verification +run-name: Scheduled verification + on: schedule: # Run Sunday & Wednesday at 00:00 From 640863e917accff25bf0d66d242aa24feb31b45e Mon Sep 17 00:00:00 2001 From: Pawel Szymichowski Date: Mon, 24 Oct 2022 19:06:25 +0200 Subject: [PATCH 4/6] Hotfix for on-demand trigger --- .github/workflows/on-demand-verification.yml | 1 - .github/workflows/on-push-verification.yml | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/on-demand-verification.yml b/.github/workflows/on-demand-verification.yml index c96e3f33..eee4700d 100644 --- a/.github/workflows/on-demand-verification.yml +++ b/.github/workflows/on-demand-verification.yml @@ -24,7 +24,6 @@ on: jobs: verify_on_demand: - if: ${{ github.ref_name == 'master' }} runs-on: ubuntu-22.04 steps: diff --git a/.github/workflows/on-push-verification.yml b/.github/workflows/on-push-verification.yml index 45f30523..ee0e04d8 100644 --- a/.github/workflows/on-push-verification.yml +++ b/.github/workflows/on-push-verification.yml @@ -4,7 +4,7 @@ # to choose correct dependencies revisions # ===--- -name: On push verification +name: On push & pull-request verification run-name: '${{ github.event_name }}: ${{ github.base_ref }} ${{ github.ref_name }}' # github.base_ref null for 'on: push' on: From 2360899a8b550e0d51cb1e87c8ac67a1a8770348 Mon Sep 17 00:00:00 2001 From: Pawel Szymichowski Date: Mon, 24 Oct 2022 19:15:01 +0200 Subject: [PATCH 5/6] Improve docs, add build_type switch --- .github/actions/build-opencl-clang/action.yml | 9 ++++++++- .github/workflows/on-demand-verification.yml | 15 ++++++++++++--- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/.github/actions/build-opencl-clang/action.yml b/.github/actions/build-opencl-clang/action.yml index ba9dd91b..43bb970e 100644 --- a/.github/actions/build-opencl-clang/action.yml +++ b/.github/actions/build-opencl-clang/action.yml @@ -5,11 +5,18 @@ name: Build opencl-clang inputs: ref_llvm: + description: 'LLVM ref to build with' required: true ref_translator: + description: 'SPIRV-LLVM-Translator ref to build with' required: true ref_opencl-clang: + description: 'opencl-clang ref to build with' required: true + build_type: + description: 'Build type to pass to CMake' + required: false + default: Release runs: using: 'composite' @@ -50,7 +57,7 @@ runs: -DLLVM_EXTERNAL_PROJECTS="llvm-spirv;opencl-clang" \ -DLLVM_EXTERNAL_LLVM_SPIRV_SOURCE_DIR=${{ github.workspace }}/llvm-project/SPIRV-LLVM-Translator \ -DLLVM_EXTERNAL_OPENCL_CLANG_SOURCE_DIR=${{ github.workspace }}/llvm-project/opencl-clang \ - -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_BUILD_TYPE=${{ inputs.build_type }} \ -DLLVM_TARGETS_TO_BUILD="X86" \ -G "Unix Makefiles" diff --git a/.github/workflows/on-demand-verification.yml b/.github/workflows/on-demand-verification.yml index eee4700d..9d70e405 100644 --- a/.github/workflows/on-demand-verification.yml +++ b/.github/workflows/on-demand-verification.yml @@ -11,15 +11,24 @@ on: ref_llvm: description: 'LLVM ref to build with' required: true - default: 'main' + default: main ref_translator: description: 'SPIRV-LLVM-Translator ref to build with' required: true - default: 'main' + default: main ref_opencl-clang: description: 'opencl-clang ref to build with' required: true - default: 'master' + default: master + build_type: + description: 'Build type to pass to CMake' + required: true + default: Release + type: choice + options: + - Release + - Debug + - RelWithDebInfo jobs: From ba39ddfb9ca624a3d7ccb873000e1dfa0fb24c42 Mon Sep 17 00:00:00 2001 From: "Szymichowski, Pawel" Date: Tue, 25 Oct 2022 09:23:12 +0200 Subject: [PATCH 6/6] Add names to scheduled jobs --- .github/workflows/scheduled-verification.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/scheduled-verification.yml b/.github/workflows/scheduled-verification.yml index 8491d18e..4f7b9d5f 100644 --- a/.github/workflows/scheduled-verification.yml +++ b/.github/workflows/scheduled-verification.yml @@ -13,6 +13,7 @@ on: jobs: verify-default-branches: + name: Verify `master` branch runs-on: ubuntu-22.04 steps: @@ -27,6 +28,7 @@ jobs: ref_opencl-clang: master verify-release-branches: + name: Verify `ocl-open-*` release branches strategy: matrix: llvm_version: [ 10, 11, 12, 13, 14, 15 ]