From 305c5ee51d3a0ce87a245ad6b6eec30cb7da3b2a Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk Date: Fri, 16 Aug 2024 16:48:20 -0500 Subject: [PATCH] Add workflow to build the package and upload to dppy/label/dev Fix post-link script so that tests pass. --- .github/CODEOWNERS | 1 + .github/dependabot.yml | 6 +++ .github/pull_request_template.md | 6 +++ .github/workflows/conda-package.yml | 76 +++++++++++++++++++++++++++++ SECURITY.md | 12 +++++ recipe/meta.yaml | 3 +- recipe/post-link.sh | 12 +++-- 7 files changed, 111 insertions(+), 5 deletions(-) create mode 100644 .github/CODEOWNERS create mode 100644 .github/dependabot.yml create mode 100644 .github/pull_request_template.md create mode 100644 .github/workflows/conda-package.yml create mode 100644 SECURITY.md diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..67d1fb5 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +* @oleksandr-pavlyk @xaleryb @ZzEeKkAa @ndgrigorian diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..5ace460 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,6 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000..d7f0029 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,6 @@ +## Summary of the proposed change + +### Additional details + +### Example illustrating what changed + diff --git a/.github/workflows/conda-package.yml b/.github/workflows/conda-package.yml new file mode 100644 index 0000000..9c22fa9 --- /dev/null +++ b/.github/workflows/conda-package.yml @@ -0,0 +1,76 @@ +name: Conda package + +on: + push: + branches: + - master + pull_request: + +permissions: read-all + +env: + PACKAGE_NAME: intel-gpu-ocl-icd-system + + +jobs: + build_and_test_linux: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4.1.7 + with: + fetch-depth: 0 + + - name: Set pkgs_dirs + run: | + echo "pkgs_dirs: [~/.conda/pkgs]" >> ~/.condarc + + - name: Add conda to system path + run: echo $CONDA/bin >> $GITHUB_PATH + + - name: Install conda-build + run: conda install conda-build -c conda-forge --override-channels + + - name: Build conda package + run: | + # use bootstrap channel to pull NumPy linked with OpenBLAS + CHANNELS="-c conda-forge --override-channels" + conda build \ + $CHANNELS \ + conda-recipe + + - name: Upload artifact + uses: actions/upload-artifact@v4.3.6 + with: + name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} + path: /usr/share/miniconda/conda-bld/noarch/${{ env.PACKAGE_NAME }}-*.tar.bz2 + + upload_linux: + needs: build_and_test_linux + if: ${{github.ref == 'refs/heads/master' || (startsWith(github.ref, 'refs/heads/release') == true) || github.event_name == 'push' && contains(github.ref, 'refs/tags/')}} + runs-on: ubuntu-latest + steps: + - name: Download conda artifact + uses: actions/download-artifact@v4 + with: + name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} + + - name: Install anaconda-client + run: conda install anaconda-client -c conda-forge --override-channels + - name: Add conda to system path + run: echo $CONDA/bin >> $GITHUB_PATH + - name: Package version + run: echo "PACKAGE_VERSION=$(basename ${{ env.PACKAGE_NAME }}-*.tar.bz2 | sed 's/^${{ env.PACKAGE_NAME }}-\([^-]*\).*/\1/')" >> $GITHUB_ENV + + - name: Upload + env: + ANACONDA_TOKEN: ${{ secrets.ANACONDA_TOKEN }} + run: | + anaconda --token $ANACONDA_TOKEN upload --user dppy --label dev ${PACKAGE_NAME}-*.tar.bz2 + + - name: Upload Wheels + env: + ANACONDA_TOKEN: ${{ secrets.ANACONDA_TOKEN }} + run: anaconda --token ${{ env.ANACONDA_TOKEN }} upload --user dppy --label dev ${{ env.PACKAGE_NAME }}-*.whl --version ${{ env.PACKAGE_VERSION }} + + diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..556938b --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,12 @@ +# Security Policy + +## Report a Vulnerability + +Please report security issues or vulnerabilities to the [Intel® Security Center]. + +For more information on how Intel® works to resolve security issues, see +[Vulnerability Handling Guidelines]. + +[Intel® Security Center]:https://www.intel.com/content/www/us/en/security-center/default.html + +[Vulnerability Handling Guidelines]:https://www.intel.com/content/www/us/en/security-center/vulnerability-handling-guidelines.html diff --git a/recipe/meta.yaml b/recipe/meta.yaml index 30d2b6b..e53838e 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -6,6 +6,7 @@ package: version: {{ version }} build: + noarch: generic number: 0 skip: True # [not linux] @@ -16,7 +17,7 @@ requirements: test: commands: - export ICD_FN=${CONDA_PREFIX}/etc/OpenCL/vendors/intel-ocl-gpu.icd - - test -h ${ICD_FN} || test ! -a ${ICD_FN} + - test -h ${ICD_FN} about: home: https://github.com/IntelPython/{{ name|lower }}-feedstock diff --git a/recipe/post-link.sh b/recipe/post-link.sh index 0327b60..7f5dc22 100644 --- a/recipe/post-link.sh +++ b/recipe/post-link.sh @@ -16,7 +16,7 @@ systemwide_vendors=/etc/OpenCL/vendors env_vendors=${PREFIX}/etc/OpenCL/vendors -env_icd_fn=$local_vendors/intel-ocl-gpu.icd +env_icd_fn=$env_vendors/intel-ocl-gpu.icd if [[ -d $systemwide_vendors ]] then @@ -24,10 +24,14 @@ then if [[ -f $systemwide_icd_fn ]] then ln -s $systemwide_icd_fn $env_icd_fn - echo "Symbolic link was successfully created. OpenCL GPU device should be discoverable by OpenCL loader." >> ${PREFIX}/.messages.txt + echo "Symbolic link was successfully created. OpenCL GPU device should be discoverable by OpenCL loader.\n" >> ${PREFIX}/.messages.txt else - echo "No ICD file for Intel(R) GPU device was found in '${systemwise_vendors}'." >> ${PREFIX}/.messages.txt + echo "No ICD file for Intel(R) GPU device was found in '${systemwise_vendors}'.\n" >> ${PREFIX}/.messages.txt + echo "Creating default symbolic link.\n" >> ${PREFIX}/.messages.txt + ln -s ${systemwide_vendors}/intel.icd $env_icd_fn fi else - echo "Folder '${systemwide_vendors}' does not exist. Try installing GPU drivers and then reinstall intel-gpu-ocl-icd-system conda package" >> $PREFIX/.messages.txt + echo "Folder '${systemwide_vendors}' does not exist. \n" >> $PREFIX/.messages.txt + echo "Creating default symbolic link. \n" >> ${PREFIX}/.messages.txt + ln -s ${systemwide_vendors}/intel.icd $env_icd_fn fi