-
Notifications
You must be signed in to change notification settings - Fork 39
Add conda-forge workflow #158
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
Open
ndgrigorian
wants to merge
3
commits into
master
Choose a base branch
from
add-conda-forge-workflow
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+455
−13
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,302 @@ | ||
| name: Conda package using conda-forge | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - master | ||
| pull_request: | ||
|
|
||
| permissions: read-all | ||
|
|
||
| env: | ||
| PACKAGE_NAME: mkl-service | ||
| MODULE_NAME: mkl | ||
| TEST_ENV_NAME: test_mkl_service | ||
| VER_SCRIPT1: "import json; f = open('ver.json', 'r'); j = json.load(f); f.close(); " | ||
| VER_SCRIPT2: "d = j['mkl-service'][0]; print('='.join((d[s] for s in ('version', 'build'))))" | ||
|
|
||
| jobs: | ||
| build_linux: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| strategy: | ||
| matrix: | ||
| python: ['3.10', '3.11', '3.12', '3.13', '3.14'] | ||
|
|
||
| steps: | ||
| - name: Cancel Previous Runs | ||
| uses: styfle/cancel-workflow-action@3155a141048f8f89c06b4cdae32e7853e97536bc # 0.13.0 | ||
| with: | ||
| access_token: ${{ github.token }} | ||
|
|
||
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Set pkgs_dirs | ||
| run: | | ||
| echo "pkgs_dirs: [~/.conda/pkgs]" >> ~/.condarc | ||
|
|
||
| - name: Cache conda packages | ||
| uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3 | ||
| env: | ||
| CACHE_NUMBER: 0 # Increase to reset cache | ||
| with: | ||
| path: ~/.conda/pkgs | ||
| key: | ||
| ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-${{hashFiles('**/meta.yaml') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}- | ||
| ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}- | ||
|
|
||
| - name: Add conda to system path | ||
| run: echo "$CONDA/bin" >> "$GITHUB_PATH" | ||
|
|
||
| - name: Install conda-build | ||
| run: conda install conda-build | ||
|
|
||
| - name: Store conda paths as envs | ||
| shell: bash -el {0} | ||
| run: | | ||
| echo "CONDA_BLD=/usr/share/miniconda/conda-bld/linux-64/" >> "$GITHUB_ENV" | ||
| echo "WHEELS_OUTPUT_FOLDER=$GITHUB_WORKSPACE/" >> "$GITHUB_ENV" | ||
|
|
||
| - name: Build conda package | ||
| run: | | ||
| CHANNELS=(-c conda-forge -c conda-forge/label/python_rc --override-channels) | ||
| VERSIONS=(--python "${{ matrix.python }}") | ||
| TEST=(--no-test) | ||
|
|
||
| conda build \ | ||
| "${TEST[@]}" \ | ||
| "${VERSIONS[@]}" \ | ||
| "${CHANNELS[@]}" \ | ||
| conda-recipe-cf | ||
|
|
||
| - name: Upload artifact | ||
| uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 | ||
| with: | ||
| name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }} | ||
| path: ${{ env.CONDA_BLD }}${{ env.PACKAGE_NAME }}-*.conda | ||
|
|
||
| - name: Upload wheels artifact | ||
| uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 | ||
| with: | ||
| name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Wheels Python ${{ matrix.python }} | ||
| path: ${{ env.WHEELS_OUTPUT_FOLDER }}mkl_service-*.whl | ||
|
|
||
| build_windows: | ||
| runs-on: windows-latest | ||
|
|
||
| strategy: | ||
| matrix: | ||
| python: ['3.10', '3.11', '3.12', '3.13', '3.14'] | ||
|
|
||
| steps: | ||
| - name: Cancel Previous Runs | ||
| uses: styfle/cancel-workflow-action@3155a141048f8f89c06b4cdae32e7853e97536bc # 0.13.0 | ||
| with: | ||
| access_token: ${{ github.token }} | ||
|
|
||
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
| with: | ||
| fetch-depth: 0 | ||
| - uses: conda-incubator/setup-miniconda@fc2d68f6413eb2d87b895e92f8584b5b94a10167 # v3.3.0 | ||
| with: | ||
| miniforge-version: latest | ||
| auto-activate: true | ||
| activate-environment: base | ||
| channels: conda-forge | ||
| python-version: ${{ matrix.python }} | ||
|
|
||
| - name: Cache conda packages | ||
| uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3 | ||
| env: | ||
| CACHE_NUMBER: 3 # Increase to reset cache | ||
| with: | ||
| path: /home/runner/conda_pkgs_dir | ||
| key: | ||
| ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-${{hashFiles('**/meta.yaml') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}- | ||
| ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}- | ||
|
|
||
| - name: Install conda-build | ||
| run: conda install conda-build | ||
|
|
||
| - name: Store conda paths as envs | ||
| shell: bash -el {0} | ||
| run: | | ||
| echo "CONDA_BLD=$CONDA_PREFIX\\conda-bld\\win-64\\" >> "$GITHUB_ENV" | ||
| echo "WHEELS_OUTPUT_FOLDER=$GITHUB_WORKSPACE\\" >> "$GITHUB_ENV" | ||
|
|
||
| - name: Build conda package | ||
| run: conda build --no-test --python ${{ matrix.python }} -c conda-forge -c conda-forge/label/python_rc --override-channels conda-recipe-cf | ||
|
|
||
| - name: Upload artifact | ||
| uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 | ||
| with: | ||
| name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }} | ||
| path: ${{ env.CONDA_BLD }}${{ env.PACKAGE_NAME }}-*.conda | ||
|
|
||
| - name: Upload wheels artifact | ||
| uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 | ||
| with: | ||
| name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Wheels Python ${{ matrix.python }} | ||
| path: ${{ env.WHEELS_OUTPUT_FOLDER }}mkl_service-*.whl | ||
|
|
||
| test_linux: | ||
| needs: build_linux | ||
| runs-on: ${{ matrix.runner }} | ||
|
|
||
| strategy: | ||
| matrix: | ||
| python: ['3.10', '3.11', '3.12', '3.13', '3.14'] | ||
| experimental: [false] | ||
| runner: [ubuntu-latest] | ||
| continue-on-error: ${{ matrix.experimental }} | ||
| env: | ||
| CHANNELS: -c conda-forge -c conda-forge/label/python_rc --override-channels | ||
|
|
||
| steps: | ||
| - name: Download artifact | ||
| uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # v8.0.0 | ||
| with: | ||
| name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }} | ||
|
|
||
| - name: Add conda to system path | ||
| run: echo "$CONDA/bin" >> "$GITHUB_PATH" | ||
|
|
||
| - name: Install conda-build | ||
| run: conda install conda-build | ||
|
|
||
| - name: Create conda channel | ||
| run: | | ||
| mkdir -p "$GITHUB_WORKSPACE/channel/linux-64" | ||
| conda index "$GITHUB_WORKSPACE/channel" || exit 1 | ||
| mv "${PACKAGE_NAME}"-*.conda "$GITHUB_WORKSPACE/channel/linux-64" || exit 1 | ||
| conda index "$GITHUB_WORKSPACE/channel" || exit 1 | ||
| # Test channel | ||
| conda search "$PACKAGE_NAME" -c "$GITHUB_WORKSPACE/channel" --override-channels --info --json > "$GITHUB_WORKSPACE/ver.json" | ||
| cat ver.json | ||
|
|
||
| - name: Collect dependencies | ||
| run: | | ||
| . "$CONDA/etc/profile.d/conda.sh" | ||
| CHANNELS=(-c "$GITHUB_WORKSPACE/channel" -c conda-forge -c conda-forge/label/python_rc --override-channels) | ||
| PACKAGE_VERSION="$(python -c "${VER_SCRIPT1} ${VER_SCRIPT2}")" | ||
| export PACKAGE_VERSION | ||
| conda create -n "${{ env.TEST_ENV_NAME }}" "$PACKAGE_NAME=$PACKAGE_VERSION" "python=${{ matrix.python }}" "${CHANNELS[@]}" --only-deps --dry-run > lockfile | ||
| cat lockfile | ||
|
|
||
| - name: Set pkgs_dirs | ||
| run: | | ||
| echo "pkgs_dirs: [~/.conda/pkgs]" >> ~/.condarc | ||
|
|
||
| - name: Cache conda packages | ||
| uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3 | ||
| env: | ||
| CACHE_NUMBER: 0 # Increase to reset cache | ||
| with: | ||
| path: ~/.conda/pkgs | ||
| key: | ||
| ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-${{hashFiles('lockfile') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}- | ||
| ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}- | ||
|
|
||
| - name: Install mkl-service | ||
| run: | | ||
| . "$CONDA/etc/profile.d/conda.sh" | ||
| CHANNELS=(-c "$GITHUB_WORKSPACE/channel" -c conda-forge -c conda-forge/label/python_rc --override-channels) | ||
| PACKAGE_VERSION="$(python -c "${VER_SCRIPT1} ${VER_SCRIPT2}")" | ||
| export PACKAGE_VERSION | ||
| conda create -n "${{ env.TEST_ENV_NAME }}" "$PACKAGE_NAME=$PACKAGE_VERSION" pytest "python=${{ matrix.python }}" "${CHANNELS[@]}" | ||
| # Test installed packages | ||
| conda list | ||
|
|
||
| - name: Run tests | ||
| run: | | ||
| . "$CONDA/etc/profile.d/conda.sh" | ||
| conda activate ${{ env.TEST_ENV_NAME }} | ||
| pytest -vv --pyargs ${{ env.MODULE_NAME }} | ||
|
|
||
| test_windows: | ||
| needs: build_windows | ||
| runs-on: ${{ matrix.runner }} | ||
|
|
||
| strategy: | ||
| matrix: | ||
| python: ['3.10', '3.11', '3.12', '3.13', '3.14'] | ||
| experimental: [false] | ||
| runner: [windows-latest] | ||
| continue-on-error: ${{ matrix.experimental }} | ||
| env: | ||
| CHANNELS: -c conda-forge -c conda-forge/label/python_rc --override-channels | ||
|
|
||
| steps: | ||
| - name: Download artifact | ||
| uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # v8.0.0 | ||
| with: | ||
| name: ${{ env.PACKAGE_NAME }} ${{ runner.os }} Python ${{ matrix.python }} | ||
| - uses: conda-incubator/setup-miniconda@fc2d68f6413eb2d87b895e92f8584b5b94a10167 # v3.3.0 | ||
| with: | ||
| miniforge-version: latest | ||
| channels: conda-forge | ||
| activate-environment: ${{ env.TEST_ENV_NAME }} | ||
| python-version: ${{ matrix.python }} | ||
|
|
||
| - name: Install conda-index | ||
| run: conda install conda-index | ||
|
|
||
| - name: Create conda channel | ||
| run: | | ||
| mkdir ${{ env.GITHUB_WORKSPACE }}/channel/win-64 | ||
| move ${{ env.PACKAGE_NAME }}-*.conda ${{ env.GITHUB_WORKSPACE }}/channel/win-64 | ||
| python -m conda_index ${{ env.GITHUB_WORKSPACE }}/channel | ||
|
|
||
| # Test channel | ||
| conda search ${{ env.PACKAGE_NAME }} -c ${{ env.GITHUB_WORKSPACE }}/channel --override-channels --info --json > ${{ env.GITHUB_WORKSPACE }}/ver.json | ||
| more ${{ env.GITHUB_WORKSPACE }}/ver.json | ||
|
|
||
| - name: Collect dependencies | ||
| shell: cmd | ||
| run: | | ||
| @ECHO ON | ||
| copy /Y ${{ env.GITHUB_WORKSPACE }}\ver.json . | ||
| set "SCRIPT=%VER_SCRIPT1% %VER_SCRIPT2%" | ||
| FOR /F "tokens=* USEBACKQ" %%F IN (`python -c "%SCRIPT%"`) DO ( | ||
| SET PACKAGE_VERSION=%%F | ||
| ) | ||
| conda install -n ${{ env.TEST_ENV_NAME }} ${{ env.PACKAGE_NAME }}=%PACKAGE_VERSION% python=${{ matrix.python }} -c ${{ env.GITHUB_WORKSPACE }}/channel ${{ env.CHANNELS }} --only-deps --dry-run > lockfile | ||
| more lockfile | ||
|
|
||
| - name: Cache conda packages | ||
| uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3 | ||
| env: | ||
| CACHE_NUMBER: 3 # Increase to reset cache | ||
| with: | ||
| path: /home/runner/conda_pkgs_dir | ||
| key: | ||
| ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-${{hashFiles('lockfile') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}- | ||
| ${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}- | ||
|
|
||
| - name: Install mkl-service | ||
| shell: cmd | ||
| run: | | ||
| @ECHO ON | ||
| copy /Y ${{ env.GITHUB_WORKSPACE }}\ver.json . | ||
| set "SCRIPT=%VER_SCRIPT1% %VER_SCRIPT2%" | ||
| FOR /F "tokens=* USEBACKQ" %%F IN (`python -c "%SCRIPT%"`) DO ( | ||
| SET PACKAGE_VERSION=%%F | ||
| ) | ||
| conda create -n ${{ env.TEST_ENV_NAME }} ${{ env.PACKAGE_NAME }}=%PACKAGE_VERSION% pytest python=${{ matrix.python }} -c ${{ env.GITHUB_WORKSPACE }}/channel ${{ env.CHANNELS }} | ||
| # Test installed packages | ||
| conda list | ||
|
|
||
| - name: Run tests | ||
| run: | | ||
| conda activate ${{ env.TEST_ENV_NAME }} | ||
| pytest -v --pyargs ${{ env.MODULE_NAME }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| echo on | ||
| rem set CFLAGS=-I%PREFIX%\Library\include %CFLAGS% | ||
| rem set LDFLAGS=/LIBPATH:%PREFIX% %LDFLAGS% | ||
|
|
||
| set MKLROOT=%CONDA_PREFIX% | ||
|
|
||
| "%PYTHON%" setup.py clean --all | ||
|
|
||
| :: Make CMake verbose | ||
| set "VERBOSE=1" | ||
|
|
||
| :: -wnx flags mean: --wheel --no-isolation --skip-dependency-check | ||
| %PYTHON% -m build -w -n -x | ||
| if %ERRORLEVEL% neq 0 exit 1 | ||
|
|
||
| :: wheel file was renamed | ||
| for /f %%f in ('dir /b /S .\dist') do ( | ||
| %PYTHON% -m pip install %%f ^ | ||
| --no-build-isolation ^ | ||
| --no-deps ^ | ||
| --only-binary :all: ^ | ||
| --no-index ^ | ||
| --prefix %PREFIX% ^ | ||
| -vv | ||
| if %ERRORLEVEL% neq 0 exit 1 | ||
| ) | ||
|
|
||
| :: Copy wheel package | ||
| if NOT "%WHEELS_OUTPUT_FOLDER%"=="" ( | ||
| copy dist\mkl_service*.whl %WHEELS_OUTPUT_FOLDER% | ||
| if %ERRORLEVEL% neq 0 exit 1 | ||
| ) |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
What is reason why it's better to use the base env rather than creating dedicated
buildenv?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.
it isn't better, this is just same behavior as previous iteration of the script. It's the same in dpctl.
I agree though, it would be better in all of these workflows to just make a build env. These PRs may be the right place to do it,
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.
Yes, and it's the reason I asked, because previously I changed that aligning with how it's done in dpnp.
It looks we change that from one approach to another each time. :)
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.
oh, I remember why now: it was silently doing it anyway, because activate-environment: [name] became broken and failed silently at some point
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.
As I remember, I chose to create the separate env for the build in dpnp because it's more isolated and prevent from any conflict with the already installed packages to the base env.