-
Notifications
You must be signed in to change notification settings - Fork 35
Set up CI for Python package with GitHub Actions #360
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
cf8ccb8
40e1a9e
9a2eb81
43c731e
78e40fb
a8955ce
321905b
f1b0c1b
d10a738
ce3af13
2b2f991
74fdda5
d1a62dc
15b3de8
99127bb
94a82bf
1fd28b8
dcde836
605ec59
cedaaad
ce7f041
c922b25
27402d7
3fc0ac9
08f3bbf
ffbf5bf
b26d778
31168c0
5a02f75
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| name: Python package | ||
|
|
||
| on: | ||
| pull_request: | ||
| push: | ||
| branches: [master] | ||
|
|
||
| env: | ||
| LINUX_BASEKIT_URL: https://registrationcenter-download.intel.com/akdlm/irc_nas/17769/l_BaseKit_p_2021.2.0.2883_offline.sh | ||
| LINUX_DPCPP_COMPONENTS_WEB: intel.oneapi.lin.dpcpp-cpp-compiler | ||
|
|
||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| matrix: | ||
| python-version: [3.7, 3.8, 3.9] | ||
|
|
||
| env: | ||
| ONEAPI_ROOT: /opt/intel/oneapi | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v2 | ||
| with: | ||
| fetch-depth: 0 | ||
|
Comment on lines
+24
to
+25
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It fetches whole repository history. Is not necessary but with it we can see package version based on tag. |
||
|
|
||
| - name: Set up Python ${{ matrix.python-version }} | ||
| uses: actions/setup-python@v2 | ||
| with: | ||
| python-version: ${{ matrix.python-version }} | ||
| - name: Install dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | ||
|
|
||
| - name: Cache oneAPI | ||
| id: cache-oneapi | ||
| uses: actions/cache@v2 | ||
| with: | ||
| path: | | ||
| /opt/intel/oneapi/compiler | ||
| /opt/intel/oneapi/tbb | ||
| key: build-${{ env.LINUX_BASEKIT_URL }}-${{ env.LINUX_DPCPP_COMPONENTS_WEB }}-compiler-tbb-${{ hashFiles('**/scripts/cache_exclude_linux.sh') }} | ||
| - name: Install oneAPI | ||
| if: steps.cache-oneapi.outputs.cache-hit != 'true' | ||
| run: scripts/install_linux.sh $LINUX_BASEKIT_URL $LINUX_DPCPP_COMPONENTS_WEB | ||
| - name: Exclude unused files from oneAPI cache | ||
| if: steps.cache-oneapi.outputs.cache-hit != 'true' | ||
| run: scripts/cache_exclude_linux.sh | ||
|
Comment on lines
+47
to
+49
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This makes oneAPI cache folder from 800Mb to 330Mb. |
||
|
|
||
| - name: Install in Development Mode | ||
| run: | | ||
| source $ONEAPI_ROOT/compiler/latest/env/vars.sh | ||
| python setup.py develop | ||
| - name: Test with pytest | ||
| run: | | ||
| source $ONEAPI_ROOT/compiler/latest/env/vars.sh | ||
| source $ONEAPI_ROOT/tbb/latest/env/vars.sh | ||
| pytest | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| Cython | ||
| numpy | ||
| pytest | ||
| pytest-cov | ||
|
Comment on lines
+1
to
+4
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Created |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -85,7 +85,7 @@ | |
| "-DDPCPP_INSTALL_DIR=" + DPCPP_ROOT, | ||
| "-DCMAKE_C_COMPILER:PATH=" + os.path.join(DPCPP_ROOT, "bin", "clang"), | ||
| "-DCMAKE_CXX_COMPILER:PATH=" + os.path.join(DPCPP_ROOT, "bin", "dpcpp"), | ||
| "-DDPCTL_ENABLE_LO_PROGRAM_CREATION=ON", | ||
| # "-DDPCTL_ENABLE_LO_PROGRAM_CREATION=ON", | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is blocker for the PR and should be fixed before merging this PR.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| backends, | ||
| ] | ||
| subprocess.check_call(cmake_args, stderr=subprocess.STDOUT, shell=False) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| #!/bin/bash | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This script from https://github.com/oneapi-src/oneapi-ci |
||
|
|
||
| # SPDX-FileCopyrightText: 2020 Intel Corporation | ||
| # | ||
| # SPDX-License-Identifier: MIT | ||
|
|
||
| #shellcheck disable=SC2010 | ||
| LATEST_VERSION=$(ls -1 /opt/intel/oneapi/compiler/ | grep -v latest | sort | tail -1) | ||
|
|
||
| sudo rm -rf /opt/intel/oneapi/compiler/"$LATEST_VERSION"/linux/compiler/lib/ia32_lin | ||
| sudo rm -rf /opt/intel/oneapi/compiler/"$LATEST_VERSION"/linux/bin/ia32 | ||
| sudo rm -rf /opt/intel/oneapi/compiler/"$LATEST_VERSION"/linux/lib/emu | ||
| sudo rm -rf /opt/intel/oneapi/compiler/"$LATEST_VERSION"/linux/lib/oclfpga | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| #!/bin/bash | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This script from https://github.com/oneapi-src/oneapi-ci |
||
|
|
||
| # SPDX-FileCopyrightText: 2020 Intel Corporation | ||
| # | ||
| # SPDX-License-Identifier: MIT | ||
|
|
||
| URL=$1 | ||
| COMPONENTS=$2 | ||
|
|
||
| curl --output webimage.sh --url "$URL" --retry 5 --retry-delay 5 | ||
| chmod +x webimage.sh | ||
| ./webimage.sh -x -f webimage_extracted --log extract.log | ||
| rm -rf webimage.sh | ||
| WEBIMAGE_NAME=$(ls -1 webimage_extracted/) | ||
| if [ -z "$COMPONENTS" ]; then | ||
| sudo webimage_extracted/"$WEBIMAGE_NAME"/bootstrapper -s --action install --eula=accept --continue-with-optional-error=yes --log-dir=. | ||
| installer_exit_code=$? | ||
| else | ||
| sudo webimage_extracted/"$WEBIMAGE_NAME"/bootstrapper -s --action install --components="$COMPONENTS" --eula=accept --continue-with-optional-error=yes --log-dir=. | ||
| installer_exit_code=$? | ||
| fi | ||
| rm -rf webimage_extracted | ||
| exit $installer_exit_code | ||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@PokhodenkoSA Why use this hard coded url? Instead we should just use the APT oneAPI repo. Github actions allow using password-less
sudo.Another option can be to use nightly builds of dpcpp from https://github.com/intel/llvm/releases. I am working on a set of clean ups to our build system that will make it very easy to build with the open source dpcpp.