forked from hypre-space/hypre
-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add release-driven conda publish workflow #3
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
8c535b2
feat: add release-driven conda publish workflow
Luohaothu be9e114
ci: remove Run CI label gate
Luohaothu f6f5f03
fix: address review feedback for conda release workflow
Luohaothu 49005e5
fix: add SPDX headers for conda recipe files
Luohaothu 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
Some comments aren't visible on the classic Files Changed page.
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
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,116 @@ | ||
| name: Conda Release Publish | ||
|
|
||
| on: | ||
| release: | ||
| types: [published] | ||
| workflow_dispatch: | ||
| inputs: | ||
| release_tag: | ||
| description: Release tag to publish (for example v3.1.0) | ||
| required: true | ||
| type: string | ||
|
|
||
| jobs: | ||
| build-and-publish: | ||
| name: Publish (${{ matrix.os }} | mpi=${{ matrix.mpi }}, openmp=${{ matrix.openmp }}) | ||
| runs-on: ${{ matrix.os }} | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| os: [ubuntu-latest, macos-latest] | ||
| mpi: [nompi, openmpi, mpich] | ||
| openmp: [on, off] | ||
|
|
||
| steps: | ||
| - name: Checkout sources | ||
| uses: actions/checkout@v6 | ||
| with: | ||
| ref: ${{ github.event.release.tag_name || github.event.inputs.release_tag }} | ||
|
|
||
| - name: Resolve package version from release tag | ||
| id: version | ||
| shell: bash | ||
| env: | ||
| RELEASE_TAG: ${{ github.event.release.tag_name || github.event.inputs.release_tag }} | ||
| run: | | ||
| set -euo pipefail | ||
| if [ -z "${RELEASE_TAG:-}" ]; then | ||
| echo "::error::Release tag is empty." | ||
| exit 1 | ||
| fi | ||
| version="${RELEASE_TAG#refs/tags/}" | ||
| version="${version#v}" | ||
| if ! [[ "${version}" =~ ^[0-9]+(\.[0-9]+){1,3}([A-Za-z0-9._-]+)?$ ]]; then | ||
| echo "::error::Unsupported release tag '${RELEASE_TAG}'. Use tags like v3.1.0 or 3.1.0." | ||
| exit 1 | ||
| fi | ||
| echo "version=${version}" >> "${GITHUB_OUTPUT}" | ||
| echo "Using package version ${version}" | ||
| - name: Setup Miniconda | ||
| uses: conda-incubator/setup-miniconda@v3 | ||
| with: | ||
| activate-environment: conda-build-env | ||
| auto-update-conda: false | ||
| channels: conda-forge | ||
| channel-priority: strict | ||
| python-version: "3.12" | ||
|
|
||
| - name: Install conda tooling | ||
| shell: bash -el {0} | ||
| run: | | ||
| conda install -n conda-build-env -y conda-build anaconda-client | ||
| - name: Build package variant | ||
| shell: bash -el {0} | ||
| env: | ||
| CONDA_BLD_PATH: ${{ runner.temp }}/conda-bld | ||
| HYPRE_VERSION: ${{ steps.version.outputs.version }} | ||
| run: | | ||
| set -euo pipefail | ||
| echo "Building version=${HYPRE_VERSION}, mpi=${{ matrix.mpi }}, openmp=${{ matrix.openmp }}" | ||
| variant_json=$(printf '{"mpi":["%s"],"openmp":["%s"]}' "${{ matrix.mpi }}" "${{ matrix.openmp }}") | ||
| conda build conda-recipe \ | ||
| --channel conda-forge \ | ||
| --override-channels \ | ||
| --variants "${variant_json}" \ | ||
| --no-anaconda-upload | ||
| - name: Upload package to Anaconda (opflow-dev) | ||
| shell: bash -el {0} | ||
| env: | ||
| CONDA_BLD_PATH: ${{ runner.temp }}/conda-bld | ||
| HYPRE_VERSION: ${{ steps.version.outputs.version }} | ||
| ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_API_TOKEN }} | ||
| run: | | ||
| set -euo pipefail | ||
| if [ -z "${ANACONDA_API_TOKEN:-}" ]; then | ||
| echo "::error::Missing secret ANACONDA_API_TOKEN." | ||
| exit 1 | ||
| fi | ||
| pkg_files="$( | ||
| find "${CONDA_BLD_PATH}" -type f \ | ||
| \( -name "hypre-${HYPRE_VERSION}-*.conda" -o -name "hypre-${HYPRE_VERSION}-*.tar.bz2" \) \ | ||
| | sort | ||
| )" | ||
| if [ -z "${pkg_files}" ]; then | ||
| echo "::error::No built packages found under ${CONDA_BLD_PATH}." | ||
| exit 1 | ||
| fi | ||
| echo "Uploading packages:" | ||
| printf '%s\n' "${pkg_files}" | ||
| while IFS= read -r pkg; do | ||
| [ -n "${pkg}" ] || continue | ||
| anaconda -t "${ANACONDA_API_TOKEN}" upload \ | ||
| --user opflow-dev \ | ||
| --label main \ | ||
| --skip-existing \ | ||
| "${pkg}" | ||
| done <<< "${pkg_files}" | ||
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
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
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.
Uh oh!
There was an error while loading. Please reload this page.